diff --git a/frontend/src/components/regex/RegexCard.jsx b/frontend/src/components/regex/RegexCard.jsx index 52e332e..de6f000 100644 --- a/frontend/src/components/regex/RegexCard.jsx +++ b/frontend/src/components/regex/RegexCard.jsx @@ -1,7 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {Copy, Check} from 'lucide-react'; +import {Copy, Check, FlaskConical} from 'lucide-react'; import Tooltip from '@ui/Tooltip'; +import ReactMarkdown from 'react-markdown'; const RegexCard = ({ pattern, @@ -33,132 +34,151 @@ const RegexCard = ({ }; const handleMouseDown = e => { - // Prevent text selection when shift-clicking if (e.shiftKey) { e.preventDefault(); } }; + const getTestColor = () => { + if (totalTests === 0) return 'text-gray-400'; + if (passRate === 100) return 'text-green-400'; + if (passRate >= 80) return 'text-yellow-400'; + return 'text-red-400'; + }; + return (
-
+
{/* Header Section */} -
-

- {pattern.name} -

-
- {isSelectionMode ? ( - -
- {isSelected && ( - - )} - {willBeSelected && !isSelected && ( -
- )} +
+
+
+

+ {pattern.name} +

+ {pattern.tags && pattern.tags.length > 0 && ( +
+ {pattern.tags.map(tag => ( + + {tag} + + ))}
- - ) : ( - - )} + )} +
+
+
+ {isSelectionMode ? ( + +
+ {isSelected && ( + + )} + {willBeSelected && !isSelected && ( +
+ )} +
+ + ) : ( + + )} +
+
+
+ + {/* Pattern Display */} +
+ + {pattern.pattern} +
- {/* Pattern Display */} -
- - {pattern.pattern} - -
+
- {/* Description */} - {pattern.description && ( -

- {pattern.description} -

- )} - - {/* Bottom Metadata */} -
- {/* Test Results */} -
- {totalTests > 0 ? ( - <> - = 80 - ? 'text-yellow-600 dark:text-yellow-400' - : 'text-red-600 dark:text-red-400' - }`}> - {passRate}% Pass Rate - - - ({passedTests}/{totalTests} tests) - - - ) : ( - - No tests - - )} -
- - {/* Tags */} - {pattern.tags && pattern.tags.length > 0 && ( -
- {pattern.tags.map(tag => ( - - {tag} - - ))} + {/* Description and Footer Section */} +
+ {pattern.description && ( +
+ {pattern.description}
)} +
+ +
+ +
+
+ {totalTests > 0 ? ( +
= 80 + ? 'bg-yellow-500/10 text-yellow-400' + : 'bg-red-500/10 text-red-400' + }`}> + + + {passedTests}/{totalTests} passing + +
+ ) : ( +
+ + + No tests + +
+ )} +
- {/* Modified Date */} {sortBy === 'dateModified' && pattern.modified_date && ( - - Modified: {formatDate(pattern.modified_date)} + + Modified {formatDate(pattern.modified_date)} )}