Skip to content

armgit / ente

Public Imported from GitHub
0

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

fin

Manav Rathi002a652cfdad
diff --git a/web/apps/photos/src/components/Collections/CollectionCard.tsx b/web/apps/photos/src/components/Collections/CollectionCard.tsx
deleted file mode 100644
index 9451d6c082..0000000000
--- a/web/apps/photos/src/components/Collections/CollectionCard.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import {
- LoadingThumbnail,
- StaticThumbnail,
-} from "@/new/photos/components/PlaceholderThumbnails";
-import downloadManager from "@/new/photos/services/download";
-import { EnteFile } from "@/new/photos/types/file";
-import { useEffect, useState } from "react";
-
-/** Deprecated in favor of {@link ItemCard}. */
-export default function CollectionCard(props: {
- children?: any;
- coverFile: EnteFile;
- onClick: () => void;
- collectionTile: any;
- isScrolling?: boolean;
-}) {
- const {
- coverFile: file,
- onClick,
- children,
- collectionTile: CustomCollectionTile,
- isScrolling,
- } = props;
-
- const [coverImageURL, setCoverImageURL] = useState(null);
-
- useEffect(() => {
- const main = async () => {
- if (!file) {
- return;
- }
- const url = await downloadManager.getThumbnailForPreview(
- file,
- isScrolling,
- );
- if (url) {
- setCoverImageURL(url);
- }
- };
- main();
- }, [file, isScrolling]);
-
- return (
- <CustomCollectionTile onClick={onClick}>
- {file?.metadata.hasStaticThumbnail ? (
- <StaticThumbnail fileType={file?.metadata.fileType} />
- ) : coverImageURL ? (
- <img src={coverImageURL} />
- ) : (
- <LoadingThumbnail />
- )}
- {children}
- </CustomCollectionTile>
- );
-}
diff --git a/web/apps/photos/src/components/ExportPendingList.tsx b/web/apps/photos/src/components/ExportPendingList.tsx
index dbc9a60ca4..1aeb0d1b42 100644
--- a/web/apps/photos/src/components/ExportPendingList.tsx
+++ b/web/apps/photos/src/components/ExportPendingList.tsx
@@ -1,11 +1,10 @@
-import { PreviewItemTile } from "@/new/photos/components/ItemCards";
+import { ItemCard, PreviewItemTile } from "@/new/photos/components/ItemCards";
import { EnteFile } from "@/new/photos/types/file";
import { FlexWrapper } from "@ente/shared/components/Container";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
import { Box, styled } from "@mui/material";
import ItemList from "components/ItemList";
import { t } from "i18next";
-import CollectionCard from "./Collections/CollectionCard";
interface Iprops {
isOpen: boolean;
@@ -29,11 +28,10 @@ const ExportPendingList = (props: Iprops) => {
return (
<FlexWrapper>
<Box sx={{ marginRight: "8px" }}>
- <CollectionCard
+ <ItemCard
key={file.id}
+ TileComponent={PreviewItemTile}
coverFile={file}
- onClick={() => null}
- collectionTile={PreviewItemTile}
/>
</Box>
<ItemContainer>
@@ -59,6 +57,7 @@ const ExportPendingList = (props: Iprops) => {
<DialogBoxV2
open={props.isOpen}
onClose={props.onClose}
+ fullWidth
PaperProps={{
sx: { maxWidth: "444px" },
}}
diff --git a/web/packages/new/photos/components/ItemCards.tsx b/web/packages/new/photos/components/ItemCards.tsx
index a35a6726e7..95aab19609 100644
--- a/web/packages/new/photos/components/ItemCards.tsx
+++ b/web/packages/new/photos/components/ItemCards.tsx
@@ -8,10 +8,12 @@ import { styled } from "@mui/material";
import React, { useEffect, useState } from "react";
interface ItemCardProps {
- /** One of the *Tile components to use as the top level element. */
+ /**
+ * One of the *Tile components to use as the top level element.
+ */
TileComponent: React.FC<React.PropsWithChildren>;
/**
- * The file (if any) whose thumbnail (if any) should be should be shown.
+ * Optional file whose thumbnail (if any) should be should be shown.
*/
coverFile?: EnteFile | undefined;
/**
@@ -21,14 +23,14 @@ interface ItemCardProps {
* downloads.
*/
isScrolling?: boolean;
- /** Optional click handler. */
+ /**
+ * Optional click handler.
+ */
onClick?: () => void;
}
/**
- * A generic card that can be be used to represent collections, files, people -
- * anything that has an associated "cover photo".
- *
- * This is a simplified variant / almost-duplicate of {@link CollectionCard}.
+ * A generic card that can be be used to represent collections, files, people -
+ * anything that (usually) has an associated "cover photo".
*/
export const ItemCard: React.FC<React.PropsWithChildren<ItemCardProps>> = ({
TileComponent,