From befa3f82ed9eaacd33dde10183080a9c55a27a61 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Mon, 9 Sep 2024 16:47:11 +0530 Subject: [PATCH] Inline --- .../Collections/styledComponents.ts | 2 +- .../src/components/PhotoList/dedupe.tsx | 18 +++++++++--------- .../photos/src/components/PhotoList/index.tsx | 19 +++++++++---------- web/apps/photos/src/components/SearchBar.tsx | 2 +- .../components/pages/gallery/PreviewCard.tsx | 2 +- web/apps/photos/src/constants/gallery.ts | 10 ---------- 6 files changed, 21 insertions(+), 32 deletions(-) delete mode 100644 web/apps/photos/src/constants/gallery.ts diff --git a/web/apps/photos/src/components/Collections/styledComponents.ts b/web/apps/photos/src/components/Collections/styledComponents.ts index 2b64e081a2..936fb61e68 100644 --- a/web/apps/photos/src/components/Collections/styledComponents.ts +++ b/web/apps/photos/src/components/Collections/styledComponents.ts @@ -1,6 +1,6 @@ import { Overlay } from "@ente/shared/components/Container"; import { Box, styled } from "@mui/material"; -import { IMAGE_CONTAINER_MAX_WIDTH, MIN_COLUMNS } from "constants/gallery"; +import { IMAGE_CONTAINER_MAX_WIDTH, MIN_COLUMNS } from "components/PhotoList"; export const CollectionListWrapper = styled(Box)` position: relative; overflow: hidden; diff --git a/web/apps/photos/src/components/PhotoList/dedupe.tsx b/web/apps/photos/src/components/PhotoList/dedupe.tsx index 1652ff176f..bd42aa6f1b 100644 --- a/web/apps/photos/src/components/PhotoList/dedupe.tsx +++ b/web/apps/photos/src/components/PhotoList/dedupe.tsx @@ -2,15 +2,6 @@ import { EnteFile } from "@/new/photos/types/file"; import { formattedByteSize } from "@/new/photos/utils/units"; import { FlexWrapper } from "@ente/shared/components/Container"; import { Box, styled } from "@mui/material"; -import { - DATE_CONTAINER_HEIGHT, - GAP_BTW_TILES, - IMAGE_CONTAINER_MAX_HEIGHT, - IMAGE_CONTAINER_MAX_WIDTH, - MIN_COLUMNS, - SIZE_AND_COUNT_CONTAINER_HEIGHT, - SPACE_BTW_DATES, -} from "constants/gallery"; import { t } from "i18next"; import memoize from "memoize-one"; import React, { useEffect, useMemo, useRef, useState } from "react"; @@ -20,6 +11,15 @@ import { areEqual, } from "react-window"; import { Duplicate } from "services/deduplicationService"; +import { + DATE_CONTAINER_HEIGHT, + GAP_BTW_TILES, + IMAGE_CONTAINER_MAX_HEIGHT, + IMAGE_CONTAINER_MAX_WIDTH, + MIN_COLUMNS, + SIZE_AND_COUNT_CONTAINER_HEIGHT, + SPACE_BTW_DATES, +} from "."; export enum ITEM_TYPE { TIME = "TIME", diff --git a/web/apps/photos/src/components/PhotoList/index.tsx b/web/apps/photos/src/components/PhotoList/index.tsx index fec632b416..b0172fb873 100644 --- a/web/apps/photos/src/components/PhotoList/index.tsx +++ b/web/apps/photos/src/components/PhotoList/index.tsx @@ -3,16 +3,6 @@ import { formattedByteSize } from "@/new/photos/utils/units"; import { FlexWrapper } from "@ente/shared/components/Container"; import { formatDate } from "@ente/shared/time/format"; import { Box, Checkbox, Link, Typography, styled } from "@mui/material"; -import { - DATE_CONTAINER_HEIGHT, - GAP_BTW_TILES, - IMAGE_CONTAINER_MAX_HEIGHT, - IMAGE_CONTAINER_MAX_WIDTH, - MIN_COLUMNS, - SIZE_AND_COUNT_CONTAINER_HEIGHT, - SPACE_BTW_DATES, - SPACE_BTW_DATES_TO_IMAGE_CONTAINER_WIDTH_RATIO, -} from "constants/gallery"; import { t } from "i18next"; import memoize from "memoize-one"; import { GalleryContext } from "pages/gallery"; @@ -30,6 +20,15 @@ const FOOTER_HEIGHT = 90; const ALBUM_FOOTER_HEIGHT = 75; const ALBUM_FOOTER_HEIGHT_WITH_REFERRAL = 113; +export const GAP_BTW_TILES = 4; +export const DATE_CONTAINER_HEIGHT = 48; +export const SIZE_AND_COUNT_CONTAINER_HEIGHT = 72; +export const IMAGE_CONTAINER_MAX_HEIGHT = 180; +export const IMAGE_CONTAINER_MAX_WIDTH = 180; +export const MIN_COLUMNS = 4; +export const SPACE_BTW_DATES = 44; +export const SPACE_BTW_DATES_TO_IMAGE_CONTAINER_WIDTH_RATIO = 0.244; + export enum ITEM_TYPE { TIME = "TIME", FILE = "FILE", diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx index 979e660e37..f09d3e44a3 100644 --- a/web/apps/photos/src/components/SearchBar.tsx +++ b/web/apps/photos/src/components/SearchBar.tsx @@ -42,7 +42,7 @@ import { } from "@mui/material"; import CollectionCard from "components/Collections/CollectionCard"; import { ResultPreviewTile } from "components/Collections/styledComponents"; -import { IMAGE_CONTAINER_MAX_WIDTH, MIN_COLUMNS } from "constants/gallery"; +import { IMAGE_CONTAINER_MAX_WIDTH, MIN_COLUMNS } from "components/PhotoList"; import { t } from "i18next"; import memoize from "memoize-one"; import pDebounce from "p-debounce"; diff --git a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx index 3951b82be8..402dda4a65 100644 --- a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx +++ b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx @@ -8,11 +8,11 @@ import useLongPress from "@ente/shared/hooks/useLongPress"; import AlbumOutlined from "@mui/icons-material/AlbumOutlined"; import PlayCircleOutlineOutlinedIcon from "@mui/icons-material/PlayCircleOutlineOutlined"; import { Tooltip, styled } from "@mui/material"; +import { GAP_BTW_TILES, IMAGE_CONTAINER_MAX_WIDTH } from "components/PhotoList"; import { LoadingThumbnail, StaticThumbnail, } from "components/PlaceholderThumbnails"; -import { GAP_BTW_TILES, IMAGE_CONTAINER_MAX_WIDTH } from "constants/gallery"; import i18n from "i18next"; import { DeduplicateContext } from "pages/deduplicate"; import { GalleryContext } from "pages/gallery"; diff --git a/web/apps/photos/src/constants/gallery.ts b/web/apps/photos/src/constants/gallery.ts deleted file mode 100644 index 36e64b4aa7..0000000000 --- a/web/apps/photos/src/constants/gallery.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const GAP_BTW_TILES = 4; -export const DATE_CONTAINER_HEIGHT = 48; -export const SIZE_AND_COUNT_CONTAINER_HEIGHT = 72; -export const IMAGE_CONTAINER_MAX_HEIGHT = 180; -export const IMAGE_CONTAINER_MAX_WIDTH = 180; -export const MIN_COLUMNS = 4; -export const SPACE_BTW_DATES = 44; -export const SPACE_BTW_DATES_TO_IMAGE_CONTAINER_WIDTH_RATIO = 0.244; - -