diff --git a/frontend/src/components/profile/ProfileCard.jsx b/frontend/src/components/profile/ProfileCard.jsx index 20cdb04..bb02452 100644 --- a/frontend/src/components/profile/ProfileCard.jsx +++ b/frontend/src/components/profile/ProfileCard.jsx @@ -1,6 +1,13 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {Copy, Globe2, Settings2, ArrowUpCircle, Check} from 'lucide-react'; +import { + Copy, + Globe2, + Settings2, + ArrowUpCircle, + Check, + ChevronRight +} from 'lucide-react'; import Tooltip from '@ui/Tooltip'; function unsanitize(text) { @@ -8,6 +15,23 @@ function unsanitize(text) { return text.replace(/\\:/g, ':').replace(/\\n/g, '\n'); } +function parseLanguage(languageStr) { + if (!languageStr || languageStr === 'any') return 'Any'; + + const [type, language] = languageStr.split('_'); + const capitalizedLanguage = + language.charAt(0).toUpperCase() + language.slice(1); + + switch (type) { + case 'only': + return `Must Only Be: ${capitalizedLanguage}`; + case 'must': + return `Must Include: ${capitalizedLanguage}`; + default: + return capitalizedLanguage; + } +} + const MAX_DESCRIPTION_LENGTH = 1000; const ProfileCard = ({ @@ -44,7 +68,6 @@ const ProfileCard = ({ }; const handleMouseDown = e => { - // Prevent text selection when shift-clicking if (e.shiftKey) { e.preventDefault(); } @@ -56,33 +79,50 @@ const ProfileCard = ({ return text.substring(0, MAX_DESCRIPTION_LENGTH) + '...'; }; + // Get quality preferences as an array + const qualityPreferences = content.qualities?.map(q => q.name) || []; + return (
-
+
{/* Header Section */} -
-

- {unsanitize(content.name)} -

+
+
+

+ {unsanitize(content.name)} +

+ {content.tags && content.tags.length > 0 && ( +
+ {content.tags.map(tag => ( + + {unsanitize(tag)} + + ))} +
+ )} +
+
{(sortBy === 'dateModified' || sortBy === 'dateCreated') && ( - + {sortBy === 'dateModified' ? 'Modified' : 'Created'} @@ -109,8 +149,8 @@ const ProfileCard = ({ isSelected ? 'bg-blue-500' : willBeSelected - ? 'bg-blue-200 dark:bg-blue-800' - : 'bg-gray-200 dark:bg-gray-700' + ? 'bg-blue-200/20' + : 'bg-gray-200/20' } transition-colors hover:bg-blue-600`}> {isSelected && ( - + className='text-gray-400 hover:text-white transition-colors'> + )}
- {/* Main Content */} -
- {/* Description */} - {content.description && ( -

+ {/* Quality Preferences */} + {qualityPreferences.length > 0 && ( +

+ {qualityPreferences.map((pref, index) => ( + + + {pref} + + {index < qualityPreferences.length - 1 && ( + + )} + + ))} +
+ )} + +
+ + {/* Description */} + {content.description && ( +
+

{truncateDescription( unsanitize(content.description) )}

- )} - - {/* Metadata Row */} -
-
- - - {activeCustomFormats} format - {activeCustomFormats !== 1 ? 's' : ''} - -
- -
- - - {content.language || 'any'} - -
- - {content.upgradesAllowed && ( - - - Upgrades allowed - - )} - - {content.tags && content.tags.length > 0 && ( -
- {content.tags.map(tag => ( - - {unsanitize(tag)} - - ))} -
- )}
+ )} + +
+ + {/* Metadata Row */} +
+
+ + + {activeCustomFormats} format + {activeCustomFormats !== 1 ? 's' : ''} + +
+ +
+ + {parseLanguage(content.language)} +
+ + {content.upgradesAllowed && ( +
+ + Upgrades Allowed +
+ )}
@@ -203,7 +248,13 @@ ProfileCard.propTypes = { }) ), language: PropTypes.string, - upgradesAllowed: PropTypes.bool + upgradesAllowed: PropTypes.bool, + qualities: PropTypes.arrayOf( + PropTypes.shape({ + id: PropTypes.number, + name: PropTypes.string + }) + ) }).isRequired }).isRequired, onEdit: PropTypes.func.isRequired,