Skip to content

armgit / ente

Public Imported from GitHub
0

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

Show public album date range next to memories count

Anand Baburajan17556fe32b71
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 81e1db7ffa..e00279b70e 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -62,7 +62,7 @@ import { updateShouldDisableCFUploadProxy } from "ente-gallery/services/upload";
import { sortFiles } from "ente-gallery/utils/file";
import type { Collection } from "ente-media/collection";
import { type EnteFile } from "ente-media/file";
-import { fileFileName } from "ente-media/file-metadata";
+import { fileCreationTime, fileFileName } from "ente-media/file-metadata";
import { FileType } from "ente-media/file-type";
import {
removePublicCollectionAccessTokenJWT,
@@ -91,6 +91,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { type FileWithPath } from "react-dropzone";
import { uploadManager } from "services/upload-manager";
import { getSelectedFiles, type SelectedState } from "utils/file";
+import { quickLinkDateRangeForCreationTimes } from "utils/quick-link";
import { getEnteURL } from "utils/public-album";
export default function PublicCollectionGallery() {
@@ -886,6 +887,21 @@ const FileListHeader: React.FC<FileListHeaderProps> = ({
onShowFeed,
hasSelection,
}) => {
+ const memoriesDateRange = useMemo(() => {
+ if (!publicFiles.length) return undefined;
+
+ // publicFiles is already creation-time sorted, so the ends hold min/max.
+ const firstCreationTime = fileCreationTime(publicFiles[0]!);
+ const lastCreationTime = fileCreationTime(
+ publicFiles[publicFiles.length - 1]!,
+ );
+
+ return quickLinkDateRangeForCreationTimes(
+ Math.min(firstCreationTime, lastCreationTime),
+ Math.max(firstCreationTime, lastCreationTime),
+ );
+ }, [publicFiles]);
+
const downloadAllFiles = () =>
downloadAndSaveCollectionFiles(
publicCollection.name,
@@ -902,6 +918,19 @@ const FileListHeader: React.FC<FileListHeaderProps> = ({
<GalleryItemsSummary
name={publicCollection.name}
fileCount={publicFiles.length}
+ endIcon={
+ memoriesDateRange ? (
+ <Typography
+ variant="small"
+ sx={{ color: "text.muted", ml: "-6px" }}
+ >
+ <Box component="span" sx={{ mr: "6px" }}>
+ {"\u00b7"}
+ </Box>
+ {memoriesDateRange}
+ </Typography>
+ ) : undefined
+ }
nameProps={{ noWrap: true }}
/>
</Box>
diff --git a/web/apps/photos/src/utils/quick-link.ts b/web/apps/photos/src/utils/quick-link.ts
index c1c9bc86fa..879648fb26 100644
--- a/web/apps/photos/src/utils/quick-link.ts
+++ b/web/apps/photos/src/utils/quick-link.ts
@@ -19,9 +19,9 @@ const shortMonths = [
];
/**
- * Mobile parity naming for quick-link collections.
+ * Date-range formatting used by quick-link naming (kept in mobile parity).
*/
-const getQuickLinkNameForDateRange = (
+export const quickLinkDateRangeForCreationTimes = (
firstCreationTime: number,
secondCreationTime: number,
) => {
@@ -51,7 +51,7 @@ export const quickLinkNameForFiles = (files: EnteFile[]) => {
if (creationTime > maxCreationTime) maxCreationTime = creationTime;
}
- return getQuickLinkNameForDateRange(minCreationTime, maxCreationTime);
+ return quickLinkDateRangeForCreationTimes(minCreationTime, maxCreationTime);
};
const substituteCustomDomainIfNeeded = (