Skip to content

armgit / ente

Public Imported from GitHub
0

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

Start deduping

Manav Rathib68fda70ef75
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx
index b419a81296..c6dfc04278 100644
--- a/web/apps/photos/src/components/FileList.tsx
+++ b/web/apps/photos/src/components/FileList.tsx
@@ -26,6 +26,10 @@ import {
StaticThumbnail,
} from "ente-new/photos/components/PlaceholderThumbnails";
import { TileBottomTextOverlay } from "ente-new/photos/components/Tiles";
+import {
+ getFractionFittableColumns,
+ getShrinkRatio,
+} from "ente-new/photos/components/utils/thumbnail-grid-layout";
import { PseudoCollectionID } from "ente-new/photos/services/collection-summary";
import { t } from "i18next";
import memoize from "memoize-one";
@@ -800,30 +804,6 @@ const getTemplateColumns = (
}
};
-function getFractionFittableColumns(width: number): number {
- return (
- (width - 2 * getGapFromScreenEdge(width) + GAP_BTW_TILES) /
- (IMAGE_CONTAINER_MAX_WIDTH + GAP_BTW_TILES)
- );
-}
-
-function getGapFromScreenEdge(width: number) {
- if (width > MIN_COLUMNS * IMAGE_CONTAINER_MAX_WIDTH) {
- return 24;
- } else {
- return 4;
- }
-}
-
-function getShrinkRatio(width: number, columns: number) {
- return (
- (width -
- 2 * getGapFromScreenEdge(width) -
- (columns - 1) * GAP_BTW_TILES) /
- (columns * IMAGE_CONTAINER_MAX_WIDTH)
- );
-}
-
const ListContainer = styled(Box, {
shouldForwardProp: (propName) => propName != "gridTemplateColumns",
})<{ gridTemplateColumns: string }>`
diff --git a/web/packages/new/photos/components/utils/thumbnail-grid-layout.ts b/web/packages/new/photos/components/utils/thumbnail-grid-layout.ts
index 62cc057699..9e796ae8f1 100644
--- a/web/packages/new/photos/components/utils/thumbnail-grid-layout.ts
+++ b/web/packages/new/photos/components/utils/thumbnail-grid-layout.ts
@@ -84,26 +84,13 @@ const IMAGE_CONTAINER_MAX_HEIGHT = 180;
const IMAGE_CONTAINER_MAX_WIDTH = 180;
const MIN_COLUMNS = 4;
-function getFractionFittableColumns(width: number): number {
- return (
- (width - 2 * getGapFromScreenEdge(width) + GAP_BTW_TILES) /
- (IMAGE_CONTAINER_MAX_WIDTH + GAP_BTW_TILES)
- );
-}
+export const getFractionFittableColumns = (width: number): number =>
+ (width - 2 * getGapFromScreenEdge(width) + GAP_BTW_TILES) /
+ (IMAGE_CONTAINER_MAX_WIDTH + GAP_BTW_TILES);
-function getGapFromScreenEdge(width: number) {
- if (width > MIN_COLUMNS * IMAGE_CONTAINER_MAX_WIDTH) {
- return 24;
- } else {
- return 4;
- }
-}
+export const getGapFromScreenEdge = (width: number) =>
+ width > MIN_COLUMNS * IMAGE_CONTAINER_MAX_WIDTH ? 24 : 4;
-function getShrinkRatio(width: number, columns: number) {
- return (
- (width -
- 2 * getGapFromScreenEdge(width) -
- (columns - 1) * GAP_BTW_TILES) /
- (columns * IMAGE_CONTAINER_MAX_WIDTH)
- );
-}
+export const getShrinkRatio = (width: number, columns: number) =>
+ (width - 2 * getGapFromScreenEdge(width) - (columns - 1) * GAP_BTW_TILES) /
+ (columns * IMAGE_CONTAINER_MAX_WIDTH);