diff --git a/web/apps/photos/src/components/Collections/CollectionListBar.tsx b/web/apps/photos/src/components/Collections/CollectionListBar.tsx index 40992bd713..d6b8c15e9d 100644 --- a/web/apps/photos/src/components/Collections/CollectionListBar.tsx +++ b/web/apps/photos/src/components/Collections/CollectionListBar.tsx @@ -1,6 +1,9 @@ import { useIsMobileWidth } from "@/base/hooks"; import type { Person } from "@/new/photos/services/ml/cgroups"; -import type { CollectionSummary } from "@/new/photos/types/collection"; +import type { + CollectionSummary, + CollectionSummaryType, +} from "@/new/photos/types/collection"; import { ensure } from "@/utils/ensure"; import { IconButtonWithBG, Overlay } from "@ente/shared/components/Container"; import ArchiveIcon from "@mui/icons-material/Archive"; @@ -455,8 +458,8 @@ const CollectionBarCard: React.FC = ({ coverFile={collectionSummary.coverFile} onClick={() => onCollectionClick(collectionSummary.id)} > - - + + {activeCollectionID === collectionSummary.id && } @@ -467,7 +470,17 @@ const CollectionBarTile = styled(CollectionTile)` height: 64px; `; -const CollectionBarTileText = styled(Overlay)` +interface CardTextProps { + text: string; +} + +const CardText: React.FC = ({ text }) => ( + + + +); + +const CardText_ = styled(Overlay)` padding: 4px; background: linear-gradient( 0deg, @@ -476,7 +489,50 @@ const CollectionBarTileText = styled(Overlay)` ); `; -const CollectionBarTileIcon = styled(Overlay)` +const TruncatedText: React.FC = ({ text }) => ( + + + + {text} + + + +); + +const Ellipsized = styled(Typography)` + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; // number of lines to show + line-clamp: 2; + -webkit-box-orient: vertical; +`; + +interface CollectionBarCardIconProps { + type: CollectionSummaryType; +} + +const CollectionBarCardIcon: React.FC = ({ + type, +}) => ( + + {type == "favorites" && } + {type == "archived" && ( + ({ + color: theme.colors.white.muted, + })} + /> + )} + {type == "outgoingShare" && } + {(type == "incomingShareViewer" || + type == "incomingShareCollaborator") && } + {type == "sharedOnlyViaLink" && } + {type == "pinned" && } + +); + +const CollectionBarCardIcon_ = styled(Overlay)` padding: 4px; display: flex; justify-content: flex-start; @@ -486,57 +542,6 @@ const CollectionBarTileIcon = styled(Overlay)` } `; -function CollectionCardText({ collectionName }) { - return ( - - - - ); -} - -function CollectionCardIcon({ collectionType }) { - return ( - - {collectionType == "favorites" && } - {collectionType == "archived" && ( - ({ - color: theme.colors.white.muted, - })} - /> - )} - {collectionType == "outgoingShare" && } - {(collectionType == "incomingShareViewer" || - collectionType == "incomingShareCollaborator") && ( - - )} - {collectionType == "sharedOnlyViaLink" && } - {collectionType == "pinned" && } - - ); -} - -const TruncateText = ({ text }) => { - return ( - - - - {text} - - - - ); -}; - -const Ellipse = styled(Typography)` - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; //number of lines to show - line-clamp: 2; - -webkit-box-orient: vertical; -`; - const ActiveIndicator = styled("div")` height: 3px; background-color: ${({ theme }) => theme.palette.primary.main}; @@ -559,8 +564,7 @@ const PersonCard = ({ person, activePerson }: PersonCardProps) => ( //onCollectionClick(collectionSummary.id); }} > - - {/* */} + {activePerson.id === person.id && }