π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Start using the existing function
Manav Rathi99a8f5152afc
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsxindex c6dfc04278..1685ec9cb3 100644--- a/web/apps/photos/src/components/FileList.tsx+++ b/web/apps/photos/src/components/FileList.tsx@@ -16,7 +16,6 @@ import { fileCreationTime, fileDurationString } from "ente-media/file-metadata";import { FileType } from "ente-media/file-type";import {GAP_BTW_TILES,- IMAGE_CONTAINER_MAX_HEIGHT,IMAGE_CONTAINER_MAX_WIDTH,MIN_COLUMNS,} from "ente-new/photos/components/FileList";@@ -27,7 +26,7 @@ import {} from "ente-new/photos/components/PlaceholderThumbnails";import { TileBottomTextOverlay } from "ente-new/photos/components/Tiles";import {- getFractionFittableColumns,+ computeThumbnailGridLayoutParams,getShrinkRatio,} from "ente-new/photos/components/utils/thumbnail-grid-layout";import { PseudoCollectionID } from "ente-new/photos/services/collection-summary";@@ -51,8 +50,6 @@ import {handleSelectCreatorMulti,} from "utils/photoFrame";-export const SPACE_BTW_DATES = 44;-/*** A component with an explicit height suitable for being plugged in as the* {@link header} or {@link footer} of the {@link FileList}.@@ -233,18 +230,22 @@ export const FileList: React.FC<FileListProps> = ({const [currentHover, setCurrentHover] = useState<number | null>(null);const [isShiftKeyPressed, setIsShiftKeyPressed] = useState(false);- const fittableColumns = getFractionFittableColumns(width);- let columns = Math.floor(fittableColumns);-- let skipMerge = false;- if (columns < MIN_COLUMNS) {- columns = MIN_COLUMNS;- skipMerge = true;- }-+ const layoutParams = useMemo(+ () => computeThumbnailGridLayoutParams(width),+ [width],+ );+ const {+ // containerWidth,+ isSmallerLayout,+ // paddingInline,+ columns,+ // itemWidth,+ itemHeight,+ gap,+ } = layoutParams;+ // TODO(RE):const shrinkRatio = getShrinkRatio(width, columns);- const listItemHeight =- IMAGE_CONTAINER_MAX_HEIGHT * shrinkRatio + GAP_BTW_TILES;+ const listItemHeight = itemHeight + gap;useEffect(() => {// Since width and height are dependencies, there might be too many@@ -267,7 +268,7 @@ export const FileList: React.FC<FileListProps> = ({groupByTime(timeStampList);}- if (!skipMerge) {+ if (!isSmallerLayout) {timeStampList = mergeTimeStampList(timeStampList, columns);}@@ -786,17 +787,15 @@ const getTemplateColumns = (groups?: number[],): string => {if (groups) {- // need to confirm why this was there- // const sum = groups.reduce((acc, item) => acc + item, 0);- // if (sum < columns) {- // groups[groups.length - 1] += columns - sum;- // }- return groups- .map(- (x) =>- `repeat(${x}, ${IMAGE_CONTAINER_MAX_WIDTH * shrinkRatio}px)`,- )- .join(` ${SPACE_BTW_DATES}px `);+ return (+ groups+ .map(+ (x) =>+ `repeat(${x}, ${IMAGE_CONTAINER_MAX_WIDTH * shrinkRatio}px)`,+ )+ // Space between date groups+ .join(` 44px `)+ );} else {return `repeat(${columns},${IMAGE_CONTAINER_MAX_WIDTH * shrinkRatio