diff --git a/frontend/src/components/format/FormatCard.jsx b/frontend/src/components/format/FormatCard.jsx index 453aedd..a2703b2 100644 --- a/frontend/src/components/format/FormatCard.jsx +++ b/frontend/src/components/format/FormatCard.jsx @@ -1,7 +1,8 @@ -import React from 'react'; +import React, {useState} from 'react'; import PropTypes from 'prop-types'; -import {Copy, Check} from 'lucide-react'; +import {Copy, Check, FlaskConical, FileText, ListFilter} from 'lucide-react'; import Tooltip from '@ui/Tooltip'; +import ReactMarkdown from 'react-markdown'; function FormatCard({ format, @@ -13,6 +14,7 @@ function FormatCard({ willBeSelected, onSelect }) { + const [showDescription, setShowDescription] = useState(true); const {content} = format; const totalTests = content.tests?.length || 0; const passedTests = content.tests?.filter(t => t.passes)?.length || 0; @@ -20,37 +22,12 @@ function FormatCard({ const getConditionStyle = condition => { if (condition.negate) { - return 'bg-red-100 border-red-200 text-red-700 dark:bg-red-900/30 dark:border-red-700 dark:text-red-300'; + return 'bg-red-500/20 text-red-400 border border-red-500/20'; } if (condition.required) { - return 'bg-green-100 border-green-200 text-green-700 dark:bg-green-900/30 dark:border-green-700 dark:text-green-300'; + return 'bg-green-500/20 text-green-400 border border-green-500/20'; } - return 'bg-blue-100 border-blue-200 text-blue-700 dark:bg-blue-900/30 dark:border-blue-700 dark:text-blue-300'; - }; - - const getDisplayConditions = conditions => { - if (!conditions?.length) return []; - - // Sort conditions: required first, then non-required - const sortedConditions = [...conditions].sort((a, b) => { - if (a.required && !b.required) return -1; - if (!a.required && b.required) return 1; - return 0; - }); - - if (sortedConditions.length <= 5) return sortedConditions; - - // Take first 6 conditions and add a count of remaining ones - const displayConditions = sortedConditions.slice(0, 6); - const remainingCount = sortedConditions.length - 6; - - // Add a virtual condition for the count - displayConditions.push({ - name: `+${remainingCount} more...`, - isCounter: true - }); - - return displayConditions; + return 'bg-blue-500/20 text-blue-400 border border-blue-500/20'; }; const handleClick = e => { @@ -66,8 +43,12 @@ function FormatCard({ onClone(format); }; + const handleViewToggle = e => { + e.stopPropagation(); + setShowDescription(!showDescription); + }; + const handleMouseDown = e => { - // Prevent text selection when shift-clicking if (e.shiftKey) { e.preventDefault(); } @@ -75,39 +56,66 @@ function FormatCard({ return (
- Modified:{' '} - {new Date( - format.modified_date - ).toLocaleString()} -
- )} +- {content.description} -
- )} +