π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web][photos] Reserve two lines for mobile gallery titles
AswinAsok4c1963488b52
diff --git a/web/apps/photos/src/components/collections/CollectionHeader.tsx b/web/apps/photos/src/components/collections/CollectionHeader.tsxindex b6cd49b643..44c123973d 100644--- a/web/apps/photos/src/components/collections/CollectionHeader.tsx+++ b/web/apps/photos/src/components/collections/CollectionHeader.tsx@@ -1,4 +1,8 @@import type { RemotePullOpts } from "@/components/gallery";+import {+ isAlbumSummary,+ twoLineMobileTitleSx,+} from "@/components/gallery/header-layout";import { downloadAndSaveCollectionFiles } from "@/services/save";import {CleanIcon,@@ -182,9 +186,7 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = (props) => {)}<GalleryItemsSummarynameProps={- isAlbum- ? { sx: { overflowWrap: "anywhere" } }- : undefined+ isAlbum ? { sx: twoLineMobileTitleSx } : undefined}name={name}description={isAlbum ? undefined : description}@@ -218,9 +220,6 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = (props) => {);};-const isAlbumSummary = ({ type }: CollectionSummary) =>- type == "album" || type == "folder" || type == "sharedIncoming";-const shouldShowOptions = (type: CollectionSummaryType) =>type != "all" && type != "archiveItems";diff --git a/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsxindex bc0ede89f6..ecc0d20081 100644--- a/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx+++ b/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx@@ -1,3 +1,4 @@+import { isAlbumSummary } from "@/components/gallery/header-layout";// TODO: Audit this fileimport {CollectionShare,@@ -7,6 +8,7 @@ import {import type { FileListHeaderOrFooter } from "@/components/FileList";import { PeopleHeader } from "@/components/gallery/PeopleHeader";import type { GalleryBarMode } from "@/components/gallery/reducer";+import { useIsSmallWidth } from "ente-base/components/utils/hooks";import { useModalVisibility } from "ente-base/components/utils/modal";import type { Collection } from "ente-media/collection";import {@@ -98,6 +100,12 @@ export const GalleryBarAndListHeader: React.FC<collectionShareVisibilityProps.onClose();}, [collectionShareVisibilityProps]);+ const isSmallWidth = useIsSmallWidth();+ const hasTwoLineTitle =+ isSmallWidth &&+ (!!activePerson ||+ (!!collectionSummary && isAlbumSummary(collectionSummary)));+const albumDescription =activeCollection?.pubMagicMetadata?.data.caption?.trim();const [descriptionHeight, setDescriptionHeight] = useState(0);@@ -149,7 +157,10 @@ export const GalleryBarAndListHeader: React.FC<) : (<></>),- height: 72 + (albumDescription ? descriptionHeight : 0),+ height:+ 72 ++ (hasTwoLineTitle ? 32 : 0) ++ (albumDescription ? descriptionHeight : 0),});// eslint-disable-next-line react-hooks/exhaustive-deps}, [@@ -170,6 +181,7 @@ export const GalleryBarAndListHeader: React.FC<onCollectionSlideshow,onBackToAlbums,onEditAlbumDetails,+ hasTwoLineTitle,albumDescription,descriptionHeight,// TODO: Clusterdiff --git a/web/apps/photos/src/components/gallery/PeopleHeader.tsx b/web/apps/photos/src/components/gallery/PeopleHeader.tsxindex 2c9790eed1..59f8e5c37e 100644--- a/web/apps/photos/src/components/gallery/PeopleHeader.tsx+++ b/web/apps/photos/src/components/gallery/PeopleHeader.tsx@@ -1,3 +1,4 @@+import { twoLineMobileTitleSx } from "@/components/gallery/header-layout";import { useWrapAsyncOperation } from "@/components/utils/use-wrap-async";import AddIcon from "@mui/icons-material/Add";import CheckIcon from "@mui/icons-material/Check";@@ -145,7 +146,7 @@ const PersonHeaderSummary = ({fileCount={person.fileIDs.length}nameProps={{...summaryProps.nameProps,- sx: { overflowWrap: "anywhere" },+ sx: twoLineMobileTitleSx,}}/></Stack>diff --git a/web/apps/photos/src/components/gallery/header-layout.ts b/web/apps/photos/src/components/gallery/header-layout.tsnew file mode 100644index 0000000000..ae9f8971f9--- /dev/null+++ b/web/apps/photos/src/components/gallery/header-layout.ts@@ -0,0 +1,13 @@+import type { CollectionSummary } from "ente-new/photos/services/collection-summary";++export const isAlbumSummary = ({ type }: CollectionSummary) =>+ type == "album" || type == "folder" || type == "sharedIncoming";++export const twoLineMobileTitleSx = {+ overflowWrap: "anywhere",+ minHeight: { xs: "64px", sm: 0 },+ display: { xs: "-webkit-box", sm: "block" },+ overflow: { xs: "hidden", sm: "visible" },+ WebkitBoxOrient: "vertical",+ WebkitLineClamp: { xs: 2, sm: "unset" },+} as const;