π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Extract and merge, part 2
Manav Rathif9adbdf639ad
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsxindex 16ba5b41a9..e7eaa88228 100644--- a/web/apps/photos/src/components/FileList.tsx+++ b/web/apps/photos/src/components/FileList.tsx@@ -3,7 +3,7 @@import AlbumOutlinedIcon from "@mui/icons-material/AlbumOutlined";import FavoriteRoundedIcon from "@mui/icons-material/FavoriteRounded";import PlayCircleOutlineOutlinedIcon from "@mui/icons-material/PlayCircleOutlineOutlined";-import { Box, Checkbox, Link, Typography, styled } from "@mui/material";+import { Box, Checkbox, Typography, styled } from "@mui/material";import Avatar from "components/Avatar";import type { LocalUser } from "ente-accounts/services/user";import { assertionFailed } from "ente-base/assert";@@ -31,7 +31,6 @@ import { PseudoCollectionID } from "ente-new/photos/services/collection-summary"import { t } from "i18next";import memoize from "memoize-one";import React, { useContext, useEffect, useMemo, useRef, useState } from "react";-import { Trans } from "react-i18next";import {VariableSizeList as List,type ListChildComponentProps,@@ -49,10 +48,6 @@ export const SPACE_BTW_DATES = 44;const SPACE_BTW_DATES_TO_IMAGE_CONTAINER_WIDTH_RATIO = 0.244;-const FOOTER_HEIGHT = 90;-const ALBUM_FOOTER_HEIGHT = 75;-const ALBUM_FOOTER_HEIGHT_WITH_REFERRAL = 113;-/*** A component with an explicit height suitable for being plugged in as the* {@link header} or {@link footer} of the {@link FileList}.@@ -274,15 +269,12 @@ export const FileList: React.FC<FileListProps> = ({if (timeStampList.length === 1) {timeStampList.push(getEmptyListItem());}- timeStampList.push(getVacuumItem(timeStampList));+ const footerHeight = footer?.height ?? 0;+ timeStampList.push(getVacuumItem(timeStampList, footerHeight));if (footer) {timeStampList.push(asFullSpanListItem(footer));}- if (publicCollectionGalleryContext.credentials) {- timeStampList.push(getAlbumsFooter());- }-setTimeStampList(timeStampList);refreshInProgress.current = false;if (shouldRefresh.current) {@@ -372,15 +364,7 @@ export const FileList: React.FC<FileListProps> = ({};};- const getVacuumItem = (timeStampList) => {- let footerHeight;- if (publicCollectionGalleryContext.credentials) {- footerHeight = publicCollectionGalleryContext.referralCode- ? ALBUM_FOOTER_HEIGHT_WITH_REFERRAL- : ALBUM_FOOTER_HEIGHT;- } else {- footerHeight = FOOTER_HEIGHT;- }+ const getVacuumItem = (timeStampList, footerHeight: number) => {const fileListHeight = (() => {let sum = 0;const getCurrentItemSize = getItemSize(timeStampList);@@ -398,64 +382,6 @@ export const FileList: React.FC<FileListProps> = ({};};- const getAlbumsFooter = (): TimeStampListItem => ({- height: publicCollectionGalleryContext.referralCode- ? ALBUM_FOOTER_HEIGHT_WITH_REFERRAL- : ALBUM_FOOTER_HEIGHT,- item: (- <AlbumFooterContainer- span={columns}- hasReferral={!!publicCollectionGalleryContext.referralCode}- >- {/* Make the entire area tappable, otherwise it is hard to- get at on mobile devices. */}- <Box sx={{ width: "100%" }}>- <Link- color="text.base"- sx={{ "&:hover": { color: "inherit" } }}- target="_blank"- href={"https://ente.io"}- >- <Typography variant="small">- <Trans- i18nKey="shared_using"- components={{- a: (- <Typography- variant="small"- component="span"- sx={{ color: "accent.main" }}- />- ),- }}- values={{ url: "ente.io" }}- />- </Typography>- </Link>- {publicCollectionGalleryContext.referralCode ? (- <FullStretchContainer>- <Typography- sx={{- marginTop: "12px",- padding: "8px",- color: "accent.contrastText",- }}- >- <Trans- i18nKey={"sharing_referral_code"}- values={{- referralCode:- publicCollectionGalleryContext.referralCode,- }}- />- </Typography>- </FullStretchContainer>- ) : null}- </Box>- </AlbumFooterContainer>- ),- });-/*** Checks and merge multiple dates into a single row.*/@@ -936,29 +862,6 @@ const DateContainer = styled(ListItemContainer)(`,);-const AlbumFooterContainer = styled(ListItemContainer, {- shouldForwardProp: (propName) => propName != "hasReferral",-})<{ hasReferral: boolean }>`- margin-top: 48px;- margin-bottom: ${({ hasReferral }) => (!hasReferral ? `10px` : "0px")};- text-align: center;- justify-content: center;-`;--const FullStretchContainer = styled("div")(- ({ theme }) => `- margin: 0 -24px;- width: calc(100% + 46px);- left: -24px;- @media (max-width: ${IMAGE_CONTAINER_MAX_WIDTH * MIN_COLUMNS}px) {- margin: 0 -4px;- width: calc(100% + 6px);- left: -4px;- }- background-color: ${theme.vars.palette.accent.main};-`,-);-const NothingContainer = styled(ListItemContainer)`text-align: center;justify-content: center;diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex ea565c7adb..b69f07e549 100644--- a/web/apps/photos/src/pages/shared-albums.tsx+++ b/web/apps/photos/src/pages/shared-albums.tsx@@ -3,7 +3,15 @@ import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternateimport CloseIcon from "@mui/icons-material/Close";import DownloadIcon from "@mui/icons-material/Download";import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";-import { Box, Button, IconButton, Stack, styled, Tooltip } from "@mui/material";+import {+ Box,+ Button,+ IconButton,+ Link,+ Stack,+ styled,+ Tooltip,+} from "@mui/material";import Typography from "@mui/material/Typography";import { DownloadStatusNotifications } from "components/DownloadStatusNotifications";import { FileListWithViewer } from "components/FileListWithViewer";@@ -74,6 +82,10 @@ import {removePublicCollectionFileData,verifyPublicAlbumPassword,} from "ente-new/albums/services/public-collection";+import {+ IMAGE_CONTAINER_MAX_WIDTH,+ MIN_COLUMNS,+} from "ente-new/photos/components/FileList";import {GalleryItemsHeaderAdapter,GalleryItemsSummary,@@ -84,6 +96,7 @@ import { t } from "i18next";import { useRouter } from "next/router";import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { type FileWithPath } from "react-dropzone";+import { Trans } from "react-i18next";import { uploadManager } from "services/upload-manager";import { getSelectedFiles, type SelectedState } from "utils/file";import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery";@@ -699,63 +712,80 @@ const FileListFooter: React.FC<FileListFooterProps> = ({referralCode,onAddPhotos,}) => {- if (onAddPhotos)- return (- <CenteredFill sx={{ marginTop: "56px" }}>- <AddMorePhotosButton onClick={onAddPhotos} />- </CenteredFill>- );-return (- <AlbumFooterContainer- span={columns}- hasReferral={!!publicCollectionGalleryContext.referralCode}- >- {/* Make the entire area tappable, otherwise it is hard to+ <Stack>+ {onAddPhotos && (+ <CenteredFill sx={{ marginTop: "56px" }}>+ <AddMorePhotosButton onClick={onAddPhotos} />+ </CenteredFill>+ )}+ <AlbumFooterContainer hasReferral={!!referralCode}>+ {/* Make the entire area tappable, otherwise it is hard toget at on mobile devices. */}- <Box sx={{ width: "100%" }}>- <Link- color="text.base"- sx={{ "&:hover": { color: "inherit" } }}- target="_blank"- href={"https://ente.io"}- >- <Typography variant="small">- <Trans- i18nKey="shared_using"- components={{- a: (- <Typography- variant="small"- component="span"- sx={{ color: "accent.main" }}- />- ),- }}- values={{ url: "ente.io" }}- />- </Typography>- </Link>- {publicCollectionGalleryContext.referralCode ? (- <FullStretchContainer>- <Typography- sx={{- marginTop: "12px",- padding: "8px",- color: "accent.contrastText",- }}- >+ <Box sx={{ width: "100%" }}>+ <Link+ color="text.base"+ sx={{ "&:hover": { color: "inherit" } }}+ target="_blank"+ href={"https://ente.io"}+ >+ <Typography variant="small"><Trans- i18nKey={"sharing_referral_code"}- values={{- referralCode:- publicCollectionGalleryContext.referralCode,+ i18nKey="shared_using"+ components={{+ a: (+ <Typography+ variant="small"+ component="span"+ sx={{ color: "accent.main" }}+ />+ ),}}+ values={{ url: "ente.io" }}/></Typography>- </FullStretchContainer>- ) : null}- </Box>- </AlbumFooterContainer>+ </Link>+ {referralCode ? (+ <FullStretchContainer>+ <Typography+ sx={{+ marginTop: "12px",+ padding: "8px",+ color: "accent.contrastText",+ }}+ >+ <Trans+ i18nKey={"sharing_referral_code"}+ values={{ referralCode }}+ />+ </Typography>+ </FullStretchContainer>+ ) : null}+ </Box>+ </AlbumFooterContainer>+ </Stack>);};++const AlbumFooterContainer = styled("div", {+ shouldForwardProp: (propName) => propName != "hasReferral",+})<{ hasReferral: boolean }>`+ margin-top: 48px;+ margin-bottom: ${({ hasReferral }) => (!hasReferral ? `10px` : "0px")};+ text-align: center;+ justify-content: center;+`;++const FullStretchContainer = styled("div")(+ ({ theme }) => `+ margin: 0 -24px;+ width: calc(100% + 46px);+ left: -24px;+ @media (max-width: ${IMAGE_CONTAINER_MAX_WIDTH * MIN_COLUMNS}px) {+ margin: 0 -4px;+ width: calc(100% + 6px);+ left: -4px;+ }+ background-color: ${theme.vars.palette.accent.main};+`,+);