From 3aae9addcd0fefccbb0cad2b3fa356a9462f6d62 Mon Sep 17 00:00:00 2001 From: Sam Chau Date: Sat, 18 Jan 2025 13:49:21 +1030 Subject: [PATCH] feat: remove truncated description logic - cards are now a fixed height and the description section can be scrolled --- .../src/components/profile/ProfileCard.jsx | 247 +++++++++--------- 1 file changed, 123 insertions(+), 124 deletions(-) diff --git a/frontend/src/components/profile/ProfileCard.jsx b/frontend/src/components/profile/ProfileCard.jsx index 705d985..333bb85 100644 --- a/frontend/src/components/profile/ProfileCard.jsx +++ b/frontend/src/components/profile/ProfileCard.jsx @@ -33,8 +33,6 @@ function parseLanguage(languageStr) { } } -const MAX_DESCRIPTION_LENGTH = 1000; - const ProfileCard = ({ profile, onEdit, @@ -74,18 +72,12 @@ const ProfileCard = ({ } }; - const truncateDescription = text => { - if (!text) return ''; - if (text.length <= MAX_DESCRIPTION_LENGTH) return text; - 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)} -

- {content.tags && content.tags.length > 0 && ( -
- {content.tags.map(tag => ( - - {unsanitize(tag)} - - ))} -
- )} -
- -
-
- {isSelectionMode ? ( - -
- {isSelected && ( - - )} - {willBeSelected && !isSelected && ( -
- )} -
- - ) : ( - +
+ {/* Header Section - Fixed Height */} +
+
+
+

+ {unsanitize(content.name)} +

+ {content.tags && content.tags.length > 0 && ( +
+ {content.tags.map(tag => ( + + {unsanitize(tag)} + + ))} +
)}
+ +
+
+ {isSelectionMode ? ( + +
+ {isSelected && ( + + )} + {willBeSelected && !isSelected && ( +
+ )} +
+ + ) : ( + + )} +
+
+ + {/* Quality Preferences */} + {qualityPreferences.length > 0 && ( +
+ {qualityPreferences.map((pref, index) => ( + + + {pref} + + {index < qualityPreferences.length - 1 && ( + + )} + + ))} +
+ )}
- {/* 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' : ''} - + {/* Description - Fixed Height with Scroll */} +
+ {content.description && ( +
+ + {unsanitize(content.description)} +
+ )} +
-
- - {parseLanguage(content.language)} -
+ {/* Footer Section - Fixed Height */} +
+
- {content.upgradesAllowed && ( + {/* Metadata Row */} +
+
- - Upgrades Allowed + + + {activeCustomFormats} format + {activeCustomFormats !== 1 ? 's' : ''} +
+ +
+ + {parseLanguage(content.language)} +
+ + {content.upgradesAllowed && ( +
+ + Upgrades Allowed +
+ )} +
+ + {(sortBy === 'dateModified' || + sortBy === 'dateCreated') && ( + + {sortBy === 'dateModified' + ? 'Modified' + : 'Created'} + :{' '} + {formatDate( + sortBy === 'dateModified' + ? profile.modified_date + : profile.created_date + )} + )}
- - {(sortBy === 'dateModified' || - sortBy === 'dateCreated') && ( - - {sortBy === 'dateModified' ? 'Modified' : 'Created'} - :{' '} - {formatDate( - sortBy === 'dateModified' - ? profile.modified_date - : profile.created_date - )} - - )}