Skip to content

armgit / ente

Public Imported from GitHub
0

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

Tile dup

Manav Rathi03b6ed6f1ade
diff --git a/web/apps/photos/src/components/Collections/CollectionCard.tsx b/web/apps/photos/src/components/Collections/CollectionCard.tsx
index b6d4b36c49..2a60d9ce72 100644
--- a/web/apps/photos/src/components/Collections/CollectionCard.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionCard.tsx
@@ -6,6 +6,7 @@ import {
} from "@/new/photos/components/PlaceholderThumbnails";
import { useEffect, useState } from "react";
+/** See also: {@link ItemCard}. */
export default function CollectionCard(props: {
children?: any;
coverFile: EnteFile;
diff --git a/web/apps/photos/src/components/Collections/styledComponents.ts b/web/apps/photos/src/components/Collections/styledComponents.ts
index d7bfcbde94..91dfdc9c58 100644
--- a/web/apps/photos/src/components/Collections/styledComponents.ts
+++ b/web/apps/photos/src/components/Collections/styledComponents.ts
@@ -35,6 +35,7 @@ export const ScrollContainer = styled("div")`
gap: 4px;
`;
+/** See also: {@link ItemTile}. */
export const CollectionTile = styled("div")`
display: flex;
position: relative;
@@ -67,11 +68,6 @@ export const AllCollectionTile = styled(CollectionTile)`
height: 150px;
`;
-export const ResultPreviewTile = styled(CollectionTile)`
- width: 48px;
- height: 48px;
-`;
-
export const CollectionBarTileText = styled(Overlay)`
padding: 4px;
background: linear-gradient(
diff --git a/web/apps/photos/src/components/ExportPendingList.tsx b/web/apps/photos/src/components/ExportPendingList.tsx
index 88abf66b22..7b1267903a 100644
--- a/web/apps/photos/src/components/ExportPendingList.tsx
+++ b/web/apps/photos/src/components/ExportPendingList.tsx
@@ -1,3 +1,4 @@
+import { ResultPreviewTile } 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";
@@ -5,7 +6,6 @@ import { Box, styled } from "@mui/material";
import ItemList from "components/ItemList";
import { t } from "i18next";
import CollectionCard from "./Collections/CollectionCard";
-import { ResultPreviewTile } from "./Collections/styledComponents";
interface Iprops {
isOpen: boolean;
diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
index 541afb524e..57040915b0 100644
--- a/web/apps/photos/src/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -1,7 +1,7 @@
import { assertionFailed } from "@/base/assert";
import { useIsMobileWidth } from "@/base/hooks";
import { FileType } from "@/media/file-type";
-import { ItemCard } from "@/new/photos/components/ItemCards";
+import { ItemCard, ResultPreviewTile } from "@/new/photos/components/ItemCards";
import {
isMLSupported,
mlStatusSnapshot,
@@ -38,7 +38,6 @@ import {
useTheme,
type Theme,
} from "@mui/material";
-import { ResultPreviewTile } from "components/Collections/styledComponents";
import { t } from "i18next";
import pDebounce from "p-debounce";
import {
@@ -547,7 +546,6 @@ async function getAllPeople(limit: number = undefined) {
// return result;
}
-
*/
const Option: React.FC<OptionProps<SearchOption, false>> = (props) => (
diff --git a/web/packages/new/photos/components/ItemCards.tsx b/web/packages/new/photos/components/ItemCards.tsx
index 9bfa8afb89..4487351ac2 100644
--- a/web/packages/new/photos/components/ItemCards.tsx
+++ b/web/packages/new/photos/components/ItemCards.tsx
@@ -4,10 +4,13 @@ import {
} from "@/new/photos/components/PlaceholderThumbnails";
import downloadManager from "@/new/photos/services/download";
import { type EnteFile } from "@/new/photos/types/file";
+import { styled } from "@mui/material";
import React, { useEffect, useState } from "react";
interface ItemCardProps {
+ /** The file whose thumbnail (if any) should be should be shown. */
coverFile: EnteFile;
+ /** One of the *Tile components to use as the top level element. */
TileComponent: React.FC<React.PropsWithChildren>;
}
@@ -41,3 +44,26 @@ export const ItemCard: React.FC<ItemCardProps> = ({
</TileComponent>
);
};
+
+/**
+ * A verbatim copy of CollectionTile, meant to be used with ItemCards.
+ */
+export const ItemTile = styled("div")`
+ display: flex;
+ position: relative;
+ border-radius: 4px;
+ overflow: hidden;
+ cursor: pointer;
+ & > img {
+ object-fit: cover;
+ width: 100%;
+ height: 100%;
+ pointer-events: none;
+ }
+ user-select: none;
+`;
+
+export const ResultPreviewTile = styled(ItemTile)`
+ width: 48px;
+ height: 48px;
+`;