Skip to content

armgit / ente

Public Imported from GitHub
0

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

occam

Manav Rathi6b9e4b186e1f
diff --git a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
index 7d97ea6b30..f1effdcae1 100644
--- a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
+++ b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
@@ -9,7 +9,7 @@ import {
LoadingThumbnail,
StaticThumbnail,
} from "@/new/photos/components/PlaceholderThumbnails";
-import { BottomTextItemTileOverlay } from "@/new/photos/components/Tiles";
+import { TileBottomTextOverlay } from "@/new/photos/components/Tiles";
import { TRASH_SECTION } from "@/new/photos/services/collection";
import useLongPress from "@ente/shared/hooks/useLongPress";
import AlbumOutlinedIcon from "@mui/icons-material/AlbumOutlined";
@@ -334,11 +334,11 @@ export default function PreviewCard(props: IProps) {
)}
{props?.activeCollectionID === TRASH_SECTION && file.isTrashed && (
- <BottomTextItemTileOverlay>
+ <TileBottomTextOverlay>
<Typography variant="small">
{formattedDateRelative(enteFileDeletionDate(file))}
</Typography>
- </BottomTextItemTileOverlay>
+ </TileBottomTextOverlay>
)}
</Cont>
);
diff --git a/web/packages/base/components/containers.tsx b/web/packages/base/components/containers.tsx
index 2c4a17694f..d3aaa0558c 100644
--- a/web/packages/base/components/containers.tsx
+++ b/web/packages/base/components/containers.tsx
@@ -46,8 +46,16 @@ export const CenteredFill = styled("div")`
`;
/**
- * An absolute positioned div that fills the entire nearest relatively
- * positioned ancestor.
+ * An empty overlay on top of the nearest relative positioned ancestor.
+ *
+ * {@link Overlay} is an an absolute positioned div that fills the entire
+ * nearest relatively positioned ancestor. It is usually used in tandem with a
+ * derivate of {@link BaseTile} or {@link BaseTileButton} to show various
+ * indicators on top of thumbnails; but it can be used in any context where we
+ * want to overlay (usually) transparent content on top of a component.
+ *
+ * For filling much larger areas (e.g. showing a translucent overlay on top of
+ * the entire screen), use the MUI {@link Backdrop} instead.
*/
export const Overlay = styled("div")`
position: absolute;
diff --git a/web/packages/new/photos/components/Tiles.tsx b/web/packages/new/photos/components/Tiles.tsx
index f5bc6503cc..4a054230c8 100644
--- a/web/packages/new/photos/components/Tiles.tsx
+++ b/web/packages/new/photos/components/Tiles.tsx
@@ -1,3 +1,4 @@
+import { Overlay } from "@/base/components/containers";
import { downloadManager } from "@/gallery/services/download";
import { type EnteFile } from "@/media/file";
import {
@@ -99,12 +100,12 @@ export const ItemCard: React.FC<React.PropsWithChildren<ItemCardProps>> = ({
* A generic "base" tile, meant to be used (after setting dimensions) as the
* {@link TileComponent} provided to an {@link ItemCard}.
*
- * Use {@link ItemTileOverlay} (usually via one of its presets) to overlay
- * content on top of the tile.
+ * Use {@link Overlay} (usually via one of its presets) to overlay content on
+ * top of the tile.
*/
const BaseTile = styled("div")`
display: flex;
- /* Act as container for the absolutely positioned ItemTileOverlays. */
+ /* Act as container for the absolutely positioned 'Overlay's. */
position: relative;
border-radius: 4px;
overflow: hidden;
@@ -156,7 +157,7 @@ export const BaseTileButton = styled(UnstyledButton)`
/* Rest of this is mostly verbatim from BaseTile ... */
display: flex;
- /* Act as container for the absolutely positioned ItemTileOverlays. */
+ /* Act as container for the absolutely positioned 'Overlay's. */
position: relative;
border-radius: 4px;
overflow: hidden;
@@ -178,24 +179,10 @@ export const LargeTileButton = styled(BaseTileButton)`
`;
/**
- * An empty overlay on top of the nearest relative positioned ancestor.
- *
- * This is meant to be used in tandem with a derivate of {@link BaseTile} or
- * {@link BaseTileButton}.
- */
-export const ItemTileOverlay = styled("div")`
- position: absolute;
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
-`;
-
-/**
- * An {@link ItemTileOverlay} suitable for hosting textual content at the top
- * left of small and medium sized tiles.
+ * An {@link Overlay} suitable for hosting textual content at the top left of
+ * small and medium sized tiles.
*/
-export const TileTextOverlay = styled(ItemTileOverlay)`
+export const TileTextOverlay = styled(Overlay)`
padding: 4px;
background: linear-gradient(
0deg,
@@ -208,7 +195,7 @@ export const TileTextOverlay = styled(ItemTileOverlay)`
* A variation of {@link TileTextOverlay} for use with larger tiles like the
* {@link CollectionTile}.
*/
-export const LargeTileTextOverlay = styled(ItemTileOverlay)`
+export const LargeTileTextOverlay = styled(Overlay)`
padding: 8px;
background: linear-gradient(
0deg,
@@ -220,7 +207,7 @@ export const LargeTileTextOverlay = styled(ItemTileOverlay)`
/**
* A container for "+", suitable for use with a {@link LargeTileTextOverlay}.
*/
-export const LargeTilePlusOverlay = styled(ItemTileOverlay)(
+export const LargeTilePlusOverlay = styled(Overlay)(
({ theme }) => `
display: flex;
justify-content: center;
@@ -231,11 +218,11 @@ export const LargeTilePlusOverlay = styled(ItemTileOverlay)(
);
/**
- * An {@link ItemTileOverlay} suitable for showing text at the bottom center of
- * the tile. Used by the tiles in trash (for showing the days until deletion)
- * and duplicate listing (for showing the collection name).
+ * An {@link Overlay} suitable for showing text at the bottom center of the
+ * tile. Used by the tiles in trash (for showing the days until deletion) and
+ * duplicate listing (for showing the collection name).
*/
-export const BottomTextItemTileOverlay = styled(ItemTileOverlay)`
+export const TileBottomTextOverlay = styled(Overlay)`
display: flex;
justify-content: center;
align-items: flex-end;
diff --git a/web/packages/new/photos/pages/duplicates.tsx b/web/packages/new/photos/pages/duplicates.tsx
index b7a317b1d2..c939dcfdef 100644
--- a/web/packages/new/photos/pages/duplicates.tsx
+++ b/web/packages/new/photos/pages/duplicates.tsx
@@ -41,9 +41,9 @@ import {
type ListChildComponentProps,
} from "react-window";
import {
- BottomTextItemTileOverlay,
DuplicateItemTile,
ItemCard,
+ TileBottomTextOverlay,
} from "../components/Tiles";
import {
computeThumbnailGridLayoutParams,
@@ -600,11 +600,11 @@ const ListItem: React.FC<ListChildComponentProps<DuplicatesListItemData>> =
TileComponent={DuplicateItemTile}
coverFile={item.file}
>
- <BottomTextItemTileOverlay>
+ <TileBottomTextOverlay>
<Ellipsized2LineTypography variant="small">
{item.collectionName}
</Ellipsized2LineTypography>
- </BottomTextItemTileOverlay>
+ </TileBottomTextOverlay>
</ItemCard>
))}
</ItemGrid>