Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[web][photos] Render header inside public link details

AswinAsok8d452ee46545
diff --git a/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx b/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx
index 33f5a7cc7a..c094fd3a5a 100644
--- a/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx
+++ b/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx
@@ -24,12 +24,11 @@ import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapsh
import { updateCollectionDetails } from "ente-new/photos/services/collection";
import { openURL } from "ente-new/photos/utils/web";
import { t } from "i18next";
-import type { ReactNode } from "react";
import type { RemotePullOpts } from ".";
interface PublicLinkDetailsProps {
- header: ReactNode;
collection: Collection;
+ fileCount: number;
coverFile?: EnteFile;
files: EnteFile[];
user: LocalUser;
@@ -37,8 +36,8 @@ interface PublicLinkDetailsProps {
}
export const PublicLinkDetails = ({
- header,
collection,
+ fileCount,
coverFile,
files,
user,
@@ -84,7 +83,34 @@ export const PublicLinkDetails = ({
pb: { xs: "24px", md: "36px" },
}}
>
- {header}
+ <Stack
+ component="header"
+ sx={{ minWidth: 0, minHeight: 54, gap: "2px", mb: "24px" }}
+ >
+ <Typography
+ component="h1"
+ noWrap
+ title={collection.name}
+ sx={{
+ fontFamily: '"Outfit Variable", Outfit, sans-serif',
+ fontSize: 24,
+ fontWeight: 600,
+ lineHeight: "32px",
+ }}
+ >
+ {collection.name}
+ </Typography>
+ <Typography
+ sx={{
+ color: "text.muted",
+ fontSize: 14,
+ fontWeight: 500,
+ lineHeight: "20px",
+ }}
+ >
+ {t("photos_count", { count: fileCount })}
+ </Typography>
+ </Stack>
<Stack sx={{ width: "100%", maxWidth: 364, gap: "14px" }}>
<Box sx={{ position: "relative" }}>
<Box role="img" aria-label={collection.name}>
diff --git a/web/apps/photos/src/components/gallery/PublicLinkHeader.tsx b/web/apps/photos/src/components/gallery/PublicLinkHeader.tsx
deleted file mode 100644
index b21e360b22..0000000000
--- a/web/apps/photos/src/components/gallery/PublicLinkHeader.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import { Stack, Typography } from "@mui/material";
-import { t } from "i18next";
-
-interface PublicLinkHeaderProps {
- name: string;
- fileCount: number;
-}
-
-export const PublicLinkHeader = ({
- name,
- fileCount,
-}: PublicLinkHeaderProps) => (
- <Stack
- component="header"
- sx={{ minWidth: 0, minHeight: 54, gap: "2px", mb: "24px" }}
- >
- <Typography
- component="h1"
- noWrap
- title={name}
- sx={{
- fontFamily: '"Outfit Variable", Outfit, sans-serif',
- fontSize: 24,
- fontWeight: 600,
- lineHeight: "32px",
- }}
- >
- {name}
- </Typography>
- <Typography
- sx={{
- color: "text.muted",
- fontSize: 14,
- fontWeight: 500,
- lineHeight: "20px",
- }}
- >
- {t("photos_count", { count: fileCount })}
- </Typography>
- </Stack>
-);
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index d4f7724de4..8d1863eab4 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -40,7 +40,6 @@ import { LargeFilesView } from "@/components/gallery/LargeFilesView";
import { PeopleOverview } from "@/components/gallery/PeopleOverview";
import { PhotosNavigationShell } from "@/components/gallery/PhotosNavigationShell";
import { PublicLinkDetails } from "@/components/gallery/PublicLinkDetails";
-import { PublicLinkHeader } from "@/components/gallery/PublicLinkHeader";
import {
albumShortcutCollectionID,
findCollectionCreatingIfNeeded,
@@ -2268,23 +2267,15 @@ const Page: React.FC = () => {
selectedLink ? (
<PublicLinkDetails
key={selectedLink.id}
- header={
- selectedLinkSummary && (
- <PublicLinkHeader
- name={selectedLink.name}
- fileCount={
- selectedLinkSummary.fileCount
- }
- />
- )
- }
collection={selectedLink}
+ fileCount={
+ selectedLinkSummary?.fileCount ??
+ selectedLinkFiles.length
+ }
files={selectedLinkFiles}
user={user}
onRemotePull={remotePull}
- coverFile={
- linkSummaries.get(selectedLink.id)?.coverFile
- }
+ coverFile={selectedLinkSummary?.coverFile}
/>
) : null
) : !isInSearchMode &&