Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move

Manav Rathif02974045b30
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index 751d97ca56..119c4f7107 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -23,7 +23,7 @@ import {
import { AllAlbums } from "components/Collections/AllAlbums";
import { SetCollectionNamerAttributes } from "components/Collections/CollectionNamer";
import { CollectionShare } from "components/Collections/CollectionShare";
-import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
+import { ITEM_TYPE, TimeStampListItem } from "components/FileList";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import { sortCollectionSummaries } from "services/collectionService";
import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";
diff --git a/web/apps/photos/src/components/PhotoList/index.tsx b/web/apps/photos/src/components/FileList.tsx
similarity index 99%
rename from web/apps/photos/src/components/PhotoList/index.tsx
rename to web/apps/photos/src/components/FileList.tsx
index 6a85f02b46..2e7aebc834 100644
--- a/web/apps/photos/src/components/PhotoList/index.tsx
+++ b/web/apps/photos/src/components/FileList.tsx
@@ -6,7 +6,7 @@ import {
IMAGE_CONTAINER_MAX_HEIGHT,
IMAGE_CONTAINER_MAX_WIDTH,
MIN_COLUMNS,
-} from "@/new/photos/components/PhotoList";
+} from "@/new/photos/components/FileList";
import { FlexWrapper } from "@ente/shared/components/Container";
import { Box, Checkbox, Link, Typography, styled } from "@mui/material";
import type { PhotoFrameProps } from "components/PhotoFrame";
@@ -188,7 +188,7 @@ export interface FileListAnnotatedFile {
timelineDateString: string;
}
-type Props = Pick<PhotoFrameProps, "mode" | "modePlus"> & {
+type FileListProps = Pick<PhotoFrameProps, "mode" | "modePlus"> & {
height: number;
width: number;
annotatedFiles: FileListAnnotatedFile[];
@@ -248,10 +248,7 @@ const PhotoListRow = React.memo(
areEqual,
);
-/**
- * TODO: Rename me to FileList.
- */
-export function PhotoList({
+export const FileList: React.FC<FileListProps> = ({
height,
width,
mode,
@@ -261,7 +258,7 @@ export function PhotoList({
getThumbnail,
activeCollectionID,
activePersonID,
-}: Props) {
+}) => {
const galleryContext = useContext(GalleryContext);
const publicCollectionGalleryContext = useContext(
PublicCollectionGalleryContext,
@@ -918,4 +915,4 @@ export function PhotoList({
{PhotoListRow}
</List>
);
-}
+};
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsx
index 5d164c9ad3..e96063455f 100644
--- a/web/apps/photos/src/components/PhotoFrame.tsx
+++ b/web/apps/photos/src/components/PhotoFrame.tsx
@@ -23,7 +23,7 @@ import {
} from "types/gallery";
import { downloadSingleFile } from "utils/file";
import { handleSelectCreator } from "utils/photoFrame";
-import { PhotoList, type FileListAnnotatedFile } from "./PhotoList";
+import { FileList, type FileListAnnotatedFile } from "./FileList";
import PreviewCard from "./pages/gallery/PreviewCard";
const Container = styled("div")`
@@ -178,12 +178,14 @@ const PhotoFrame = ({
const [currentHover, setCurrentHover] = useState(null);
const [isShiftKeyPressed, setIsShiftKeyPressed] = useState(false);
- const annotatedFileListFiles = useMemo((): FileListAnnotatedFile[] => {
- return files.map((file) => ({
- file,
- timelineDateString: fileTimelineDateString(file),
- }));
- }, [files]);
+ const annotatedFiles = useMemo(
+ (): FileListAnnotatedFile[] =>
+ files.map((file) => ({
+ file,
+ timelineDateString: fileTimelineDateString(file),
+ })),
+ [files],
+ );
const handleThumbnailClick = useCallback((index: number) => {
setCurrentIndex(index);
@@ -294,17 +296,16 @@ const PhotoFrame = ({
(index - i) * direction >= 0;
i += direction
) {
- checked =
- checked && !!selected[annotatedFileListFiles[i].file.id];
+ checked = checked && !!selected[annotatedFiles[i].file.id];
}
for (
let i = rangeStart;
(index - i) * direction > 0;
i += direction
) {
- handleSelect(annotatedFileListFiles[i].file)(!checked);
+ handleSelect(annotatedFiles[i].file)(!checked);
}
- handleSelect(annotatedFileListFiles[index].file, index)(!checked);
+ handleSelect(annotatedFiles[index].file, index)(!checked);
}
};
@@ -369,7 +370,7 @@ const PhotoFrame = ({
};
*/
- if (!annotatedFileListFiles.length) {
+ if (!files.length) {
return <></>;
}
@@ -377,13 +378,13 @@ const PhotoFrame = ({
<Container>
<AutoSizer>
{({ height, width }) => (
- <PhotoList
+ <FileList
width={width}
height={height}
getThumbnail={getThumbnail}
mode={mode}
modePlus={modePlus}
- annotatedFiles={annotatedFileListFiles}
+ annotatedFiles={annotatedFiles}
activeCollectionID={activeCollectionID}
activePersonID={activePersonID}
showAppDownloadBanner={showAppDownloadBanner}
diff --git a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
index ad496e9d06..5b3700971f 100644
--- a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
+++ b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
@@ -4,7 +4,7 @@ import log from "@/base/log";
import { downloadManager } from "@/gallery/services/download";
import { enteFileDeletionDate } from "@/media/file";
import { FileType } from "@/media/file-type";
-import { GAP_BTW_TILES } from "@/new/photos/components/PhotoList";
+import { GAP_BTW_TILES } from "@/new/photos/components/FileList";
import {
LoadingThumbnail,
StaticThumbnail,
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 208341d5fc..580bc49d58 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -95,6 +95,7 @@ import CollectionNamer, {
} from "components/Collections/CollectionNamer";
import { GalleryBarAndListHeader } from "components/Collections/GalleryBarAndListHeader";
import { Export } from "components/Export";
+import { ITEM_TYPE, TimeStampListItem } from "components/FileList";
import {
FilesDownloadProgress,
FilesDownloadProgressAttributes,
@@ -102,7 +103,6 @@ import {
import { FixCreationTime } from "components/FixCreationTime";
import GalleryEmptyState from "components/GalleryEmptyState";
import PhotoFrame from "components/PhotoFrame";
-import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
import { Sidebar } from "components/Sidebar";
import { Upload, type UploadTypeSelectorIntent } from "components/Upload";
import SelectedFileOptions from "components/pages/gallery/SelectedFileOptions";
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 64557cc936..63b02cfc72 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -51,12 +51,12 @@ import DownloadIcon from "@mui/icons-material/Download";
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import { Box, Button, IconButton, Stack, styled, Tooltip } from "@mui/material";
import Typography from "@mui/material/Typography";
+import { ITEM_TYPE, TimeStampListItem } from "components/FileList";
import {
FilesDownloadProgress,
FilesDownloadProgressAttributes,
} from "components/FilesDownloadProgress";
import PhotoFrame from "components/PhotoFrame";
-import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
import { Upload } from "components/Upload";
import { t } from "i18next";
import { useRouter } from "next/router";
diff --git a/web/apps/photos/src/types/gallery/index.ts b/web/apps/photos/src/types/gallery/index.ts
index 264dd314cf..5d6b13f33b 100644
--- a/web/apps/photos/src/types/gallery/index.ts
+++ b/web/apps/photos/src/types/gallery/index.ts
@@ -1,7 +1,7 @@
import { type SelectionContext } from "@/new/photos/components/gallery";
import type { User } from "@ente/shared/user/types";
+import { TimeStampListItem } from "components/FileList";
import { FilesDownloadProgressAttributes } from "components/FilesDownloadProgress";
-import { TimeStampListItem } from "components/PhotoList";
export interface SelectedState {
[k: number]: boolean;
diff --git a/web/apps/photos/src/utils/publicCollectionGallery/index.ts b/web/apps/photos/src/utils/publicCollectionGallery/index.ts
index d5334d7f3f..f8d1b470c1 100644
--- a/web/apps/photos/src/utils/publicCollectionGallery/index.ts
+++ b/web/apps/photos/src/utils/publicCollectionGallery/index.ts
@@ -1,5 +1,5 @@
import type { PublicAlbumsCredentials } from "@/base/http";
-import { TimeStampListItem } from "components/PhotoList";
+import { TimeStampListItem } from "components/FileList";
import { createContext } from "react";
export interface PublicCollectionGalleryContextType {
diff --git a/web/packages/new/photos/components/PhotoList.ts b/web/packages/new/photos/components/FileList.ts
similarity index 100%
rename from web/packages/new/photos/components/PhotoList.ts
rename to web/packages/new/photos/components/FileList.ts
diff --git a/web/packages/new/photos/components/gallery/BarImpl.tsx b/web/packages/new/photos/components/gallery/BarImpl.tsx
index ec4b8ede59..b60e501451 100644
--- a/web/packages/new/photos/components/gallery/BarImpl.tsx
+++ b/web/packages/new/photos/components/gallery/BarImpl.tsx
@@ -6,7 +6,7 @@ import { CollectionsSortOptions } from "@/new/photos/components/CollectionsSortO
import {
IMAGE_CONTAINER_MAX_WIDTH,
MIN_COLUMNS,
-} from "@/new/photos/components/PhotoList";
+} from "@/new/photos/components/FileList";
import {
BarItemTile,
ItemCard,