Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Restore default FileList presentation

AswinAsok78004203ccaf
diff --git a/web/apps/photos/src/components/Collections/PickCoverPhotoDialog.tsx b/web/apps/photos/src/components/Collections/PickCoverPhotoDialog.tsx
index 756c320d27..6765a4cc88 100644
--- a/web/apps/photos/src/components/Collections/PickCoverPhotoDialog.tsx
+++ b/web/apps/photos/src/components/Collections/PickCoverPhotoDialog.tsx
@@ -1,9 +1,5 @@
import { fileTimelineDateString, type SelectedState } from "@/utils/file";
-import {
- ArrowLeft02Icon,
- Cancel01Icon,
- Tick02Icon,
-} from "@hugeicons/core-free-icons";
+import { ArrowLeft02Icon, Cancel01Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import {
Box,
@@ -32,7 +28,6 @@ import type { Collection } from "ente-media/collection";
import type { EnteFile } from "ente-media/file";
import { FileType } from "ente-media/file-type";
import { SlideUpTransition } from "ente-new/photos/components/mui/SlideUpTransition";
-import type { ThumbnailGridLayoutParams } from "ente-new/photos/components/utils/thumbnail-grid-layout";
import { t } from "i18next";
import React, { useCallback, useEffect, useId, useMemo, useState } from "react";
import AutoSizer from "react-virtualized-auto-sizer";
@@ -193,20 +188,6 @@ export const PickCoverPhotoDialog: React.FC<PickCoverPhotoDialogProps> = ({
activeCollectionID={collection.id}
onItemClick={handleItemClick}
disableGrouping
- thumbnailGridLayout={
- coverThumbnailGridLayout
- }
- thumbnailSx={thumbnailSx}
- selectedOverlay={
- <Box sx={selectionSx}>
- <Box sx={checkSx}>
- <HugeiconsIcon
- icon={Tick02Icon}
- size={13}
- />
- </Box>
- </Box>
- }
/>
) : (
<></>
@@ -288,23 +269,6 @@ const createSingleSelection = (
context: { mode: "albums", collectionID },
});
-const coverThumbnailGridLayout = (width: number): ThumbnailGridLayoutParams => {
- const columns = width < 400 ? 3 : 4;
- const gap = 10;
- const itemSize = (width - (columns - 1) * gap) / columns;
- return {
- containerWidth: width,
- isSmallerLayout: true,
- paddingInline: 0,
- columns,
- itemWidth: itemSize,
- itemHeight: itemSize,
- gap,
- };
-};
-const thumbnailSx = { borderRadius: "12px", mb: "10px" };
-
-const green = v2SubmitButtonSx.backgroundColor;
const paperSx = {
width: "min(714px, calc(100svw - 32px))",
maxWidth: "714px",
@@ -335,27 +299,6 @@ const backButtonSx = {
flexShrink: 0,
color: "text.base",
};
-const selectionSx = {
- position: "absolute",
- inset: 0,
- border: `3px solid ${green}`,
- borderRadius: "12px",
- pointerEvents: "none",
-};
-const checkSx = {
- position: "absolute",
- top: 9,
- right: 9,
- width: 26,
- height: 26,
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- borderRadius: "50%",
- border: "2px solid #fff",
- backgroundColor: green,
- color: "#fff",
-};
// Shared actions normally share a row; keep these stacked at their full height.
const actionButtonSx = {
flex: "none",
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx
index 92a1c54e74..d91dfd2e7a 100644
--- a/web/apps/photos/src/components/FileList.tsx
+++ b/web/apps/photos/src/components/FileList.tsx
@@ -23,15 +23,7 @@ import AlbumOutlinedIcon from "@mui/icons-material/AlbumOutlined";
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
import PlayArrowRoundedIcon from "@mui/icons-material/PlayArrowRounded";
import PlayCircleOutlineOutlinedIcon from "@mui/icons-material/PlayCircleOutlineOutlined";
-import {
- Box,
- Checkbox,
- Fab,
- Typography,
- styled,
- type SxProps,
- type Theme,
-} from "@mui/material";
+import { Box, Checkbox, Fab, Typography, styled } from "@mui/material";
import type { LocalUser } from "ente-accounts/services/user";
import { assertionFailed } from "ente-base/assert";
import { Overlay } from "ente-base/components/containers";
@@ -110,10 +102,6 @@ export interface FileListProps {
height: number;
width: number;
listBorderRadius?: string;
- // Optional presentation overrides for embedded pickers.
- thumbnailGridLayout?: (width: number) => ThumbnailGridLayoutParams;
- thumbnailSx?: SxProps<Theme>;
- selectedOverlay?: React.ReactNode;
annotatedFiles: FileListAnnotatedFile[];
mode?: GalleryBarMode;
modePlus?: GalleryBarMode | "search";
@@ -149,9 +137,6 @@ export const FileList: React.FC<FileListProps> = ({
height,
width,
listBorderRadius,
- thumbnailGridLayout,
- thumbnailSx,
- selectedOverlay,
mode,
modePlus,
header,
@@ -202,8 +187,8 @@ export const FileList: React.FC<FileListProps> = ({
const outerRef = useRef<HTMLDivElement | null>(null);
const layoutParams = useMemo(
- () => (thumbnailGridLayout ?? computeThumbnailGridLayoutParams)(width),
- [width, thumbnailGridLayout],
+ () => computeThumbnailGridLayoutParams(width),
+ [width],
);
useEffect(() => {
@@ -678,8 +663,6 @@ export const FileList: React.FC<FileListProps> = ({
!suppressSelectionUI,
}}
file={file}
- thumbnailSx={thumbnailSx}
- selectedOverlay={selectedOverlay}
selected={isFileSelected(file)}
selectOnClick={haveSelection}
isRangeSelectActive={
@@ -726,8 +709,6 @@ export const FileList: React.FC<FileListProps> = ({
[
activeCollectionID,
checkedTimelineDateStrings,
- thumbnailSx,
- selectedOverlay,
contextMenu,
emailByUserID,
favoriteFileIDs,
@@ -1002,19 +983,10 @@ type FileThumbnailProps = {
onRangeSelect: () => void;
onContextMenu?: (event: React.MouseEvent) => void;
style?: React.CSSProperties;
-} & Pick<
- FileListProps,
- | "user"
- | "emailByUserID"
- | "enableSelect"
- | "thumbnailSx"
- | "selectedOverlay"
->;
+} & Pick<FileListProps, "user" | "emailByUserID" | "enableSelect">;
const FileThumbnail: React.FC<FileThumbnailProps> = ({
file,
- thumbnailSx,
- selectedOverlay,
user,
enableSelect,
selected,
@@ -1111,7 +1083,6 @@ const FileThumbnail: React.FC<FileThumbnailProps> = ({
onMouseEnter={handleHover}
disabled={!imageURL}
style={style}
- sx={thumbnailSx}
{...(enableSelect && longPressHandlers)}
>
{enableSelect && (
@@ -1139,7 +1110,7 @@ const FileThumbnail: React.FC<FileThumbnailProps> = ({
<VideoDurationOverlay duration={fileDurationString(file)} />
)
)}
- {selected && (selectedOverlay ?? <SelectedOverlay />)}
+ {selected && <SelectedOverlay />}
{shouldShowAvatar(file, user) && (
<AvatarOverlay>
<Avatar {...{ user, file, emailByUserID }} />