Skip to content

armgit / ente

Public Imported from GitHub
0

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

Reuse

Manav Rathic3f8e6a11d75
diff --git a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
index cebd5424a5..7d97ea6b30 100644
--- a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
+++ b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
@@ -4,20 +4,18 @@ 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,
- IMAGE_CONTAINER_MAX_WIDTH,
-} from "@/new/photos/components/PhotoList";
+import { GAP_BTW_TILES } from "@/new/photos/components/PhotoList";
import {
LoadingThumbnail,
StaticThumbnail,
} from "@/new/photos/components/PlaceholderThumbnails";
+import { BottomTextItemTileOverlay } 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";
import FavoriteRoundedIcon from "@mui/icons-material/FavoriteRounded";
import PlayCircleOutlineOutlinedIcon from "@mui/icons-material/PlayCircleOutlineOutlined";
-import { styled } from "@mui/material";
+import { styled, Typography } from "@mui/material";
import type { DisplayFile } from "components/PhotoFrame";
import { GalleryContext } from "pages/gallery";
import React, { useContext, useEffect, useRef, useState } from "react";
@@ -128,6 +126,7 @@ const FavOverlay = styled(Overlay)`
padding-left: 5px;
padding-bottom: 5px;
opacity: 0.9;
+ color: white;
`;
const InSelectRangeOverlay = styled(Overlay)(
@@ -138,30 +137,6 @@ const InSelectRangeOverlay = styled(Overlay)(
`,
);
-const FileAndCollectionNameOverlay = styled("div")`
- width: 100%;
- bottom: 0;
- left: 0;
- max-height: 40%;
- width: 100%;
- background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 2));
- & > p {
- max-width: calc(${IMAGE_CONTAINER_MAX_WIDTH}px - 10px);
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- margin: 2px;
- text-align: center;
- }
- padding: 7px;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- color: white;
- position: absolute;
-`;
-
const SelectedOverlay = styled(Overlay)(
({ theme }) => `
z-index: 5;
@@ -359,9 +334,11 @@ export default function PreviewCard(props: IProps) {
)}
{props?.activeCollectionID === TRASH_SECTION && file.isTrashed && (
- <FileAndCollectionNameOverlay>
- <p>{formattedDateRelative(enteFileDeletionDate(file))}</p>
- </FileAndCollectionNameOverlay>
+ <BottomTextItemTileOverlay>
+ <Typography variant="small">
+ {formattedDateRelative(enteFileDeletionDate(file))}
+ </Typography>
+ </BottomTextItemTileOverlay>
)}
</Cont>
);
diff --git a/web/packages/new/photos/components/Tiles.tsx b/web/packages/new/photos/components/Tiles.tsx
index 13d88d2bef..f5bc6503cc 100644
--- a/web/packages/new/photos/components/Tiles.tsx
+++ b/web/packages/new/photos/components/Tiles.tsx
@@ -231,14 +231,15 @@ export const LargeTilePlusOverlay = styled(ItemTileOverlay)(
);
/**
- * An {@link ItemTileOverlay} suitable for holding the collection name shown
- * atop the tiles in the duplicates listing.
+ * 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).
*/
-export const DuplicateTileTextOverlay = styled(ItemTileOverlay)`
+export const BottomTextItemTileOverlay = styled(ItemTileOverlay)`
display: flex;
justify-content: center;
align-items: flex-end;
- padding: 4px;
+ padding: 6px;
background: linear-gradient(transparent 30%, 80%, rgba(0 0 0 / 0.7));
color: white;
`;
diff --git a/web/packages/new/photos/pages/duplicates.tsx b/web/packages/new/photos/pages/duplicates.tsx
index dfa9503006..b7a317b1d2 100644
--- a/web/packages/new/photos/pages/duplicates.tsx
+++ b/web/packages/new/photos/pages/duplicates.tsx
@@ -41,8 +41,8 @@ import {
type ListChildComponentProps,
} from "react-window";
import {
+ BottomTextItemTileOverlay,
DuplicateItemTile,
- DuplicateTileTextOverlay,
ItemCard,
} from "../components/Tiles";
import {
@@ -600,11 +600,11 @@ const ListItem: React.FC<ListChildComponentProps<DuplicatesListItemData>> =
TileComponent={DuplicateItemTile}
coverFile={item.file}
>
- <DuplicateTileTextOverlay>
+ <BottomTextItemTileOverlay>
<Ellipsized2LineTypography variant="small">
{item.collectionName}
</Ellipsized2LineTypography>
- </DuplicateTileTextOverlay>
+ </BottomTextItemTileOverlay>
</ItemCard>
))}
</ItemGrid>