Move
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -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}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user