Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Add public link header

AswinAsok6c43e6b7e389
diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
index fc43920857..9c32dbdc6b 100644
--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
@@ -27,6 +27,7 @@ import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton"
import { NavbarBase } from "ente-base/components/Navbar";
import { useIsSmallWidth } from "ente-base/components/utils/hooks";
import { useModalVisibility } from "ente-base/components/utils/modal";
+import { isDevBuild } from "ente-base/env";
import { ut } from "ente-base/i18n";
import { thumbnailGridPadding } from "ente-new/photos/components/utils/thumbnail-grid-layout";
import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
@@ -344,7 +345,7 @@ const NormalNavigationRail: React.FC<
/>
{(["albums", "people", "links"] as const).map((item) =>
(item == "people" && !isMLSupported) ||
- (item == "links" && !isInternalUser) ? null : (
+ (item == "links" && !isInternalUser && !isDevBuild) ? null : (
<Tooltip key={item} title={t(item)}>
<FocusVisibleButton
color="secondary"
diff --git a/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx b/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx
index b88d78146f..33f5a7cc7a 100644
--- a/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx
+++ b/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx
@@ -24,9 +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;
coverFile?: EnteFile;
files: EnteFile[];
@@ -35,6 +37,7 @@ interface PublicLinkDetailsProps {
}
export const PublicLinkDetails = ({
+ header,
collection,
coverFile,
files,
@@ -76,9 +79,12 @@ export const PublicLinkDetails = ({
flex: 1,
minHeight: 0,
overflow: "auto",
- p: { xs: "24px", md: "36px" },
+ px: "24px",
+ pt: { xs: "12px", md: 0 },
+ pb: { xs: "24px", md: "36px" },
}}
>
+ {header}
<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
new file mode 100644
index 0000000000..b21e360b22
--- /dev/null
+++ b/web/apps/photos/src/components/gallery/PublicLinkHeader.tsx
@@ -0,0 +1,41 @@
+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 1b76e306d8..d4f7724de4 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -40,6 +40,7 @@ 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,
@@ -490,6 +491,8 @@ const Page: React.FC = () => {
[quickLinks, normalCollectionSummaries],
);
const selectedLink = quickLinks.find(({ id }) => id === selectedLinkID);
+ const selectedLinkSummary =
+ selectedLink && linkSummaries.get(selectedLink.id);
const selectedLinkFiles = useMemo(
() =>
selectedLinkID === undefined
@@ -2265,6 +2268,16 @@ const Page: React.FC = () => {
selectedLink ? (
<PublicLinkDetails
key={selectedLink.id}
+ header={
+ selectedLinkSummary && (
+ <PublicLinkHeader
+ name={selectedLink.name}
+ fileCount={
+ selectedLinkSummary.fileCount
+ }
+ />
+ )
+ }
collection={selectedLink}
files={selectedLinkFiles}
user={user}