π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Clean up albums app and fix web lint
Anand Baburajan1ad996e4bf3c
diff --git a/web/apps/albums/src/gallery/components/FileInfo.tsx b/web/apps/albums/src/gallery/components/FileInfo.tsxindex baf7c95f9f..eca960bd95 100644--- a/web/apps/albums/src/gallery/components/FileInfo.tsx+++ b/web/apps/albums/src/gallery/components/FileInfo.tsx@@ -1,3 +1,6 @@+import { CopyButton } from "@/gallery/components/FileInfoComponents";+import { tagNumericValue, type RawExifTags } from "@/gallery/services/exif";+import { formattedByteSize } from "@/gallery/utils/units";import CalendarTodayIcon from "@mui/icons-material/CalendarToday";import CameraOutlinedIcon from "@mui/icons-material/CameraOutlined";import LocationOnOutlinedIcon from "@mui/icons-material/LocationOnOutlined";@@ -25,9 +28,6 @@ import {} from "ente-base/components/utils/modal";import { formattedDate, formattedTime } from "ente-base/i18n-date";import type { Location } from "ente-base/types";-import { CopyButton } from "@/gallery/components/FileInfoComponents";-import { tagNumericValue, type RawExifTags } from "@/gallery/services/exif";-import { formattedByteSize } from "@/gallery/utils/units";import type { EnteFile } from "ente-media/file";import {fileCreationPhotoDate,@@ -67,7 +67,8 @@ export const FileInfo: React.FC<FileInfoProps> = ({const { show: showRawExif, props: rawExifVisibilityProps } =useModalVisibility();- const caption = file.pubMagicMetadata?.data.caption ?? exif?.parsed?.description;+ const caption =+ file.pubMagicMetadata?.data.caption ?? exif?.parsed?.description;const location = fileLocation(file) ?? exif?.parsed?.location;const uploaderName = file.pubMagicMetadata?.data.uploaderName;const annotatedExif = useMemo(() => annotateExif(exif), [exif]);@@ -83,7 +84,10 @@ export const FileInfo: React.FC<FileInfoProps> = ({{caption ? (<Box sx={{ px: 1 }}><Typography- sx={{ whiteSpace: "pre-wrap", wordBreak: "break-word" }}+ sx={{+ whiteSpace: "pre-wrap",+ wordBreak: "break-word",+ }}>{caption}</Typography>@@ -202,9 +206,7 @@ const FileInfoSidebar = styled(/>),)(({ theme }) => ({- "& .MuiDrawer-paper": {- overflowX: "hidden",- },+ "& .MuiDrawer-paper": { overflowX: "hidden" },...theme.applyStyles("light", {".MuiBackdrop-root": {backgroundColor: theme.vars.palette.backdrop.faint,diff --git a/web/apps/albums/src/gallery/components/viewer/CommentsSidebar.tsx b/web/apps/albums/src/gallery/components/viewer/CommentsSidebar.tsxindex dc20066b7b..98cdbcf74b 100644--- a/web/apps/albums/src/gallery/components/viewer/CommentsSidebar.tsx+++ b/web/apps/albums/src/gallery/components/viewer/CommentsSidebar.tsx@@ -1,3 +1,15 @@+import {+ addPublicComment,+ deletePublicComment,+} from "@/albums/services/public-comment";+import {+ addPublicCommentReaction,+ createAnonIdentity,+ deletePublicReaction,+ getStoredAnonIdentity,+} from "@/albums/services/public-reaction";+import { downloadManager } from "@/gallery/services/download";+import { getAvatarColor } from "@/gallery/utils/avatar-colors";import CloseIcon from "@mui/icons-material/Close";import {Avatar,@@ -15,19 +27,7 @@ import {import { type ModalVisibilityProps } from "ente-base/components/utils/modal";import type { PublicAlbumsCredentials } from "ente-base/http";import log from "ente-base/log";-import { downloadManager } from "@/gallery/services/download";-import { getAvatarColor } from "@/gallery/utils/avatar-colors";import type { EnteFile } from "ente-media/file";-import {- addPublicComment,- deletePublicComment,-} from "@/albums/services/public-comment";-import {- addPublicCommentReaction,- createAnonIdentity,- deletePublicReaction,- getStoredAnonIdentity,-} from "@/albums/services/public-reaction";import i18n, { t } from "i18next";import React, {useCallback,@@ -903,12 +903,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({}}setLikedComments(newLikedComments);- }, [- open,- selectedCollectionInfo,- reactionsByCollection,- currentUserID,- ]);+ }, [open, selectedCollectionInfo, reactionsByCollection, currentUserID]);const handleSend = async () => {if (!commentText.trim() || !file || !selectedCollectionInfo) return;@@ -1101,8 +1096,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({};// Check if user needs to set up identity before commenting.- const needsIdentityToComment =- !!selectedCollectionInfo && !hasAnonIdentity;+ const needsIdentityToComment = !!selectedCollectionInfo && !hasAnonIdentity;const handleReply = (commentToReply: Comment) => {setReplyingTo(commentToReply);@@ -1253,7 +1247,9 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({case "delete":try {if (!publicAlbumsCredentials) {- log.error("Missing credentials for public comment delete");+ log.error(+ "Missing credentials for public comment delete",+ );return;}@@ -1268,7 +1264,9 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({storedIdentity,);} else {- log.error("No stored identity for public comment delete");+ log.error(+ "No stored identity for public comment delete",+ );return;}diff --git a/web/apps/albums/src/gallery/components/viewer/FileViewer.tsx b/web/apps/albums/src/gallery/components/viewer/FileViewer.tsxindex 575d662206..03287b10e6 100644--- a/web/apps/albums/src/gallery/components/viewer/FileViewer.tsx+++ b/web/apps/albums/src/gallery/components/viewer/FileViewer.tsx@@ -1,3 +1,13 @@+import {+ addPublicReaction,+ createAnonIdentity,+ deletePublicReaction,+ getPublicAnonProfiles,+ getPublicParticipantsMaskedEmails,+ getPublicSocialDiff,+ getStoredAnonIdentity,+} from "@/albums/services/public-reaction";+import { FileInfo, type FileInfoExif } from "@/gallery/components/FileInfo";import ContentCopyIcon from "@mui/icons-material/ContentCopy";import FullscreenExitOutlinedIcon from "@mui/icons-material/FullscreenExitOutlined";import FullscreenOutlinedIcon from "@mui/icons-material/FullscreenOutlined";@@ -18,28 +28,10 @@ import { useBaseContext } from "ente-base/context";import type { PublicAlbumsCredentials } from "ente-base/http";import { formattedListJoin, ut } from "ente-base/i18n";import log from "ente-base/log";-import {- FileInfo,- type FileInfoExif,-} from "@/gallery/components/FileInfo";import { FileType } from "ente-media/file-type";import type { EnteFile } from "ente-media/file.js";-import {- addPublicReaction,- createAnonIdentity,- deletePublicReaction,- getPublicAnonProfiles,- getPublicParticipantsMaskedEmails,- getPublicSocialDiff,- getStoredAnonIdentity,-} from "@/albums/services/public-reaction";import { t } from "i18next";-import React, {- useCallback,- useEffect,- useRef,- useState,-} from "react";+import React, { useCallback, useEffect, useRef, useState } from "react";import { AddNameModal } from "./AddNameModal";import { CommentsSidebar } from "./CommentsSidebar";import { fileInfoExifForFile, type ItemData } from "./data-source";@@ -675,10 +667,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({const showSocialButtons = true;// Delegate callback to check if social buttons should be shown for a file.- const shouldShowSocialButtons_ = useCallback(- (): boolean => false,- [],- );+ const shouldShowSocialButtons_ = useCallback((): boolean => false, []);const getFiles = useCallback(() => files, [files]);@@ -1498,7 +1487,6 @@ const Shortcut: React.FC<ShortcutProps> = ({ action, shortcut }) => (</tr>);-/*** Return a promise that resolves with a "image/png" blob derived from the given* {@link imageURL} that can be written to the navigator's clipboard.diff --git a/web/apps/albums/src/gallery/components/viewer/LikesSidebar.tsx b/web/apps/albums/src/gallery/components/viewer/LikesSidebar.tsxindex 4ab8861c70..6c1c327f38 100644--- a/web/apps/albums/src/gallery/components/viewer/LikesSidebar.tsx+++ b/web/apps/albums/src/gallery/components/viewer/LikesSidebar.tsx@@ -1,3 +1,6 @@+import { getStoredAnonIdentity } from "@/albums/services/public-reaction";+import { downloadManager } from "@/gallery/services/download";+import { getAvatarColor } from "@/gallery/utils/avatar-colors";import CloseIcon from "@mui/icons-material/Close";import {Avatar,@@ -11,10 +14,7 @@ import {} from "@mui/material";import { type ModalVisibilityProps } from "ente-base/components/utils/modal";import log from "ente-base/log";-import { downloadManager } from "@/gallery/services/download";-import { getAvatarColor } from "@/gallery/utils/avatar-colors";import type { EnteFile } from "ente-media/file";-import { getStoredAnonIdentity } from "@/albums/services/public-reaction";import { t } from "i18next";import React, {useCallback,diff --git a/web/apps/albums/src/gallery/components/viewer/PublicFeedSidebar.tsx b/web/apps/albums/src/gallery/components/viewer/PublicFeedSidebar.tsxindex 74c09b72bd..b811b5c9f7 100644--- a/web/apps/albums/src/gallery/components/viewer/PublicFeedSidebar.tsx+++ b/web/apps/albums/src/gallery/components/viewer/PublicFeedSidebar.tsx@@ -1,3 +1,12 @@+import {+ getPublicAlbumFeed,+ getPublicAnonProfiles,+ getPublicParticipantsMaskedEmails,+ type PublicFeedComment,+ type PublicFeedReaction,+} from "@/albums/services/public-reaction";+import { downloadManager } from "@/gallery/services/download";+import { getAvatarColor } from "@/gallery/utils/avatar-colors";import CloseIcon from "@mui/icons-material/Close";import {Avatar,@@ -14,17 +23,8 @@ import { useInterval } from "ente-base/components/utils/hooks";import { type ModalVisibilityProps } from "ente-base/components/utils/modal";import type { PublicAlbumsCredentials } from "ente-base/http";import log from "ente-base/log";-import { downloadManager } from "@/gallery/services/download";-import { getAvatarColor } from "@/gallery/utils/avatar-colors";import type { EnteFile } from "ente-media/file";import { FileType } from "ente-media/file-type";-import {- getPublicAlbumFeed,- getPublicAnonProfiles,- getPublicParticipantsMaskedEmails,- type PublicFeedComment,- type PublicFeedReaction,-} from "@/albums/services/public-reaction";import { t } from "i18next";import React, { useCallback, useEffect, useMemo, useState } from "react";diff --git a/web/apps/albums/src/gallery/components/viewer/data-source.ts b/web/apps/albums/src/gallery/components/viewer/data-source.tsindex 352efac496..78c3c3d542 100644--- a/web/apps/albums/src/gallery/components/viewer/data-source.ts+++ b/web/apps/albums/src/gallery/components/viewer/data-source.ts@@ -1,4 +1,3 @@-import log from "ente-base/log";import type { FileInfoExif } from "@/gallery/components/FileInfo";import { downloadManager } from "@/gallery/services/download";import { extractRawExif, parseExif } from "@/gallery/services/exif";@@ -6,6 +5,7 @@ import {hlsPlaylistDataForFile,type HLSPlaylistDataForFile,} from "@/gallery/services/video";+import log from "ente-base/log";import type { EnteFile } from "ente-media/file";import { FileType } from "ente-media/file-type";import { ensureString } from "ente-utils/ensure";diff --git a/web/apps/albums/src/gallery/components/viewer/lazy.ts b/web/apps/albums/src/gallery/components/viewer/lazy.tsindex da76433bb0..5f4f78ab0c 100644--- a/web/apps/albums/src/gallery/components/viewer/lazy.ts+++ b/web/apps/albums/src/gallery/components/viewer/lazy.ts@@ -49,9 +49,7 @@ export const scheduleFileViewerPreload = () => {: undefined;if (requestIdleCallback) {- idleCallbackID = requestIdleCallback(warmViewer, {- timeout: 1500,- });+ idleCallbackID = requestIdleCallback(warmViewer, { timeout: 1500 });} else {idleCallbackID = window.setTimeout(warmViewer, 0);}diff --git a/web/apps/albums/src/gallery/services/convert.ts b/web/apps/albums/src/gallery/services/convert.tsindex 0983120797..dd5c8814d9 100644--- a/web/apps/albums/src/gallery/services/convert.ts+++ b/web/apps/albums/src/gallery/services/convert.ts@@ -174,7 +174,8 @@ export const playableVideoURL = async (const isPlayable = await isPlaybackPossible(videoObjectURL);const shouldConvert =- !isPlayable && videoBlob.size < 100 * 1024 * 1024 /* 100 MB, arbitrary */;+ !isPlayable &&+ videoBlob.size < 100 * 1024 * 1024; /* 100 MB, arbitrary */if (shouldConvert) {try {diff --git a/web/apps/albums/src/gallery/services/download.ts b/web/apps/albums/src/gallery/services/download.tsindex 0ab5e2eecb..8a061e027a 100644--- a/web/apps/albums/src/gallery/services/download.ts+++ b/web/apps/albums/src/gallery/services/download.ts@@ -17,13 +17,13 @@ import type { EnteFile } from "ente-media/file";import { fileFileName } from "ente-media/file-metadata";import { FileType } from "ente-media/file-type";import { decodeLivePhoto } from "ente-media/live-photo";+import { detectFileTypeInfoFromChunk } from "../utils/detect-type";+import { playableVideoURL, renderableImageBlob } from "./convert";import {getPublicAlbumsCredentials,requirePublicAlbumsCredentials,setPublicAlbumsCredentials,} from "./public-albums-credentials";-import { detectFileTypeInfoFromChunk } from "../utils/detect-type";-import { playableVideoURL, renderableImageBlob } from "./convert";/*** URL(s) for the original image or video, alongwith with potential conversionsdiff --git a/web/apps/albums/src/gallery/services/ffmpeg/index.ts b/web/apps/albums/src/gallery/services/ffmpeg/index.tsindex ceb436f0a1..21bf4d3f86 100644--- a/web/apps/albums/src/gallery/services/ffmpeg/index.ts+++ b/web/apps/albums/src/gallery/services/ffmpeg/index.ts@@ -137,8 +137,9 @@ const parseFFMetadataDate = (s: string | undefined) => {return d;};-export const determineVideoDuration = async (uploadItem: File): Promise<number> =>- determineVideoDurationWeb(uploadItem);+export const determineVideoDuration = async (+ uploadItem: File,+): Promise<number> => determineVideoDurationWeb(uploadItem);export const convertToMP4 = async (blob: Blob): Promise<Blob | Uint8Array> => {const command = [diff --git a/web/apps/albums/src/gallery/services/save.ts b/web/apps/albums/src/gallery/services/save.tsindex 8d160e3cc8..cd8041ea4c 100644--- a/web/apps/albums/src/gallery/services/save.ts+++ b/web/apps/albums/src/gallery/services/save.ts@@ -1,8 +1,8 @@+import { downloadManager } from "@/gallery/services/download";import { assertionFailed } from "ente-base/assert";import { nameAndExtension } from "ente-base/file-name";import log from "ente-base/log";import { saveAsFileAndRevokeObjectURL } from "ente-base/utils/web";-import { downloadManager } from "@/gallery/services/download";import type { EnteFile } from "ente-media/file";import { fileFileName } from "ente-media/file-metadata";import { FileType } from "ente-media/file-type";@@ -32,9 +32,8 @@ const createJSZip = async (): Promise<JSZip> => {const JSZipConstructor = await (jsZipConstructorPromise ??= import("jszip").then((module) => {- const candidate = (- module as unknown as { default?: JSZipConstructor }- ).default;+ const candidate = (module as unknown as { default?: JSZipConstructor })+ .default;return candidate ?? (module as unknown as JSZipConstructor);}));return new JSZipConstructor();diff --git a/web/apps/albums/src/gallery/services/thumbnail-crypto.ts b/web/apps/albums/src/gallery/services/thumbnail-crypto.tsindex 36001fc04f..0f76f443dc 100644--- a/web/apps/albums/src/gallery/services/thumbnail-crypto.ts+++ b/web/apps/albums/src/gallery/services/thumbnail-crypto.ts@@ -1,5 +1,5 @@-import { ComlinkWorker } from "ente-base/worker/comlink-worker";import type { BytesOrB64, EncryptedBlob } from "ente-base/crypto/types";+import { ComlinkWorker } from "ente-base/worker/comlink-worker";import type { ThumbnailCryptoWorker } from "./thumbnail-crypto.worker";let _comlinkWorker: ComlinkWorker<typeof ThumbnailCryptoWorker> | undefined;diff --git a/web/apps/albums/src/gallery/services/thumbnail-crypto.worker.ts b/web/apps/albums/src/gallery/services/thumbnail-crypto.worker.tsindex 6fca8539ea..3698210862 100644--- a/web/apps/albums/src/gallery/services/thumbnail-crypto.worker.ts+++ b/web/apps/albums/src/gallery/services/thumbnail-crypto.worker.ts@@ -1,7 +1,7 @@import { expose } from "comlink";import { decryptBlobBytes } from "ente-base/crypto/libsodium";-import { logUnhandledErrorsAndRejectionsInWorker } from "ente-base/log-web";import type { BytesOrB64, EncryptedBlob } from "ente-base/crypto/types";+import { logUnhandledErrorsAndRejectionsInWorker } from "ente-base/log-web";export class ThumbnailCryptoWorker {decryptBlobBytes(blob: EncryptedBlob, key: BytesOrB64) {diff --git a/web/apps/albums/src/gallery/services/thumbnail-manager.ts b/web/apps/albums/src/gallery/services/thumbnail-manager.tsindex 04378a688a..0b3c49781f 100644--- a/web/apps/albums/src/gallery/services/thumbnail-manager.ts+++ b/web/apps/albums/src/gallery/services/thumbnail-manager.ts@@ -17,7 +17,10 @@ import { decryptThumbnailBlobBytes } from "./thumbnail-crypto";class ThumbnailManager {private thumbnailCache: BlobCache | null | undefined;- private thumbnailURLPromises = new Map<number, Promise<string | undefined>>();+ private thumbnailURLPromises = new Map<+ number,+ Promise<string | undefined>+ >();get publicAlbumsCredentials() {return getPublicAlbumsCredentials();diff --git a/web/apps/albums/src/gallery/services/upload/index.ts b/web/apps/albums/src/gallery/services/upload/index.tsindex 22675641e1..e33351998e 100644--- a/web/apps/albums/src/gallery/services/upload/index.ts+++ b/web/apps/albums/src/gallery/services/upload/index.ts@@ -1,7 +1,7 @@+import { exportMetadataDirectoryName } from "@/gallery/export-dirs";import { basename, dirname } from "ente-base/file-name";import log from "ente-base/log";import { customAPIOrigin } from "ente-base/origins";-import { exportMetadataDirectoryName } from "@/gallery/export-dirs";import type { Collection } from "ente-media/collection";import type { EnteFile } from "ente-media/file";import { nullToUndefined } from "ente-utils/transform";diff --git a/web/apps/albums/src/gallery/services/upload/metadata-json.ts b/web/apps/albums/src/gallery/services/upload/metadata-json.tsindex 978cff63a9..8ccb2f9fa9 100644--- a/web/apps/albums/src/gallery/services/upload/metadata-json.ts+++ b/web/apps/albums/src/gallery/services/upload/metadata-json.ts@@ -1,12 +1,9 @@/** @file Dealing with the JSON metadata sidecar files */+import type { UploadItem, UploadPathPrefix } from "@/gallery/services/upload";import { nameAndExtension } from "ente-base/file-name";import log from "ente-base/log";import { type Location } from "ente-base/types";-import type {- UploadItem,- UploadPathPrefix,-} from "@/gallery/services/upload";/*** The data we read from the JSON metadata sidecar files.@@ -192,7 +189,8 @@ export const tryParseTakeoutMetadataJSON = async (}};-const uploadItemText = async (uploadItem: UploadItem) => await uploadItem.text();+const uploadItemText = async (uploadItem: UploadItem) =>+ await uploadItem.text();const parseMetadataJSONText = (text: string) => {const metadataJSON_ = JSON.parse(text) as unknown;diff --git a/web/apps/albums/src/gallery/services/upload/thumbnail.ts b/web/apps/albums/src/gallery/services/upload/thumbnail.tsindex 1010d95215..508d9a452d 100644--- a/web/apps/albums/src/gallery/services/upload/thumbnail.ts+++ b/web/apps/albums/src/gallery/services/upload/thumbnail.ts@@ -1,5 +1,5 @@-import log from "ente-base/log";import * as ffmpeg from "@/gallery/services/ffmpeg";+import log from "ente-base/log";import { FileType, type FileTypeInfo } from "ente-media/file-type";import { isHEICExtension } from "ente-media/formats";import { heicToJPEG } from "ente-media/heic-convert";diff --git a/web/apps/albums/src/gallery/services/upload/upload-service.ts b/web/apps/albums/src/gallery/services/upload/upload-service.tsindex 17c7ad4f64..b9fb4a1784 100644--- a/web/apps/albums/src/gallery/services/upload/upload-service.ts+++ b/web/apps/albums/src/gallery/services/upload/upload-service.ts@@ -1,6 +1,15 @@// TODO: Audit this file/* eslint-disable @typescript-eslint/ban-ts-comment */+import { extractExif } from "@/gallery/services/exif";+import {+ determineVideoDuration,+ extractVideoMetadata,+} from "@/gallery/services/ffmpeg";+import {+ detectFileTypeInfoFromChunk,+ isFileTypeNotSupportedError,+} from "@/gallery/utils/detect-type";import type { BytesOrB64 } from "ente-base/crypto/types";import { streamEncryptionChunkSize } from "ente-base/crypto/types";import { type CryptoWorker } from "ente-base/crypto/worker";@@ -13,15 +22,6 @@ import {type PublicAlbumsCredentials,} from "ente-base/http";import log from "ente-base/log";-import { extractExif } from "@/gallery/services/exif";-import {- determineVideoDuration,- extractVideoMetadata,-} from "@/gallery/services/ffmpeg";-import {- detectFileTypeInfoFromChunk,- isFileTypeNotSupportedError,-} from "@/gallery/utils/detect-type";import { decryptRemoteFile, type EnteFile } from "ente-media/file";import {fileFileName,@@ -63,10 +63,7 @@ import {type MultipartCompletedPart,type PostEnteFileRequest,} from "./remote";-import {- fallbackThumbnail,- generateThumbnailWeb,-} from "./thumbnail";+import { fallbackThumbnail, generateThumbnailWeb } from "./thumbnail";const bitFlipErrorPrefix = "BitFlipDetected";@@ -145,11 +142,7 @@ class UploadService {if (!credentials) {throw new Error("Missing public album credentials");}- if (- !metadata ||- metadata.contentLength < 0 ||- !metadata.contentMd5- ) {+ if (!metadata || metadata.contentLength < 0 || !metadata.contentMd5) {throw new Error("Public uploads require content metadata");}try {@@ -180,7 +173,9 @@ class UploadService {metadata.partLength <= 0 ||metadata.partMd5s.length == 0) {- throw new Error("Public multipart uploads require content metadata");+ throw new Error(+ "Public multipart uploads require content metadata",+ );}return fetchPublicAlbumsMultipartUploadURLsWithMetadata(metadata,@@ -1293,11 +1288,7 @@ const augmentWithThumbnail = async (hasStaticThumbnail = true;}- return {- fileStreamOrData: fileStream,- thumbnail,- hasStaticThumbnail,- };+ return { fileStreamOrData: fileStream, thumbnail, hasStaticThumbnail };};const encryptFile = async (@@ -1664,12 +1655,10 @@ const uploadStreamUsingMultipart = async (throw new Error("Multipart part length missing");}- const multipartUploadURLs =- await uploadService.fetchMultipartUploadURLs(uploadPartCount, {- contentLength: fileSize,- partLength,- partMd5s,- });+ const multipartUploadURLs = await uploadService.fetchMultipartUploadURLs(+ uploadPartCount,+ { contentLength: fileSize, partLength, partMd5s },+ );const percentPerPart = maxPercent / uploadPartCount;const completedParts: MultipartCompletedPart[] = [];diff --git a/web/apps/albums/src/gallery/services/video.ts b/web/apps/albums/src/gallery/services/video.tsindex 4720924a33..05b4acbfec 100644--- a/web/apps/albums/src/gallery/services/video.ts+++ b/web/apps/albums/src/gallery/services/video.ts@@ -1,10 +1,10 @@import { decryptBlobBytes } from "ente-base/crypto";import type { EncryptedBlob } from "ente-base/crypto/types";import type { PublicAlbumsCredentials } from "ente-base/http";+import log from "ente-base/log";import { fileLogID, type EnteFile } from "ente-media/file";import { FileType } from "ente-media/file-type";import { ensurePrecondition } from "ente-utils/ensure";-import log from "ente-base/log";import { z } from "zod";import { fetchFileData, fetchFilePreviewData } from "./file-data";diff --git a/web/apps/albums/src/pages/_app.tsx b/web/apps/albums/src/pages/_app.tsxindex 21ee7d1008..cb06bf077b 100644--- a/web/apps/albums/src/pages/_app.tsx+++ b/web/apps/albums/src/pages/_app.tsx@@ -1,11 +1,14 @@-import "@fontsource-variable/inter";-import { CssBaseline } from "@mui/material";-import { ThemeProvider } from "@mui/material/styles";+import { ThemedLoadingBar } from "@/photos/components/ThemedLoadingBar";+import { useLoadingBar } from "@/photos/components/utils/use-loading-bar";+import { PhotosAppContext } from "@/photos/types/context";import {LazyAttributedMiniDialog,LazyNotification,} from "@/public-album/components/lazy-ui";import { useNotification } from "@/public-album/hooks/useNotification";+import "@fontsource-variable/inter";+import { CssBaseline } from "@mui/material";+import { ThemeProvider } from "@mui/material/styles";import { staticAppTitle } from "ente-base/app";import { CustomHeadAlbums } from "ente-base/components/Head";import { LoadingIndicator } from "ente-base/components/loaders";@@ -13,9 +16,6 @@ import { useAttributedMiniDialog } from "ente-base/components/utils/dialog";import { useSetupI18n } from "ente-base/components/utils/hooks-app";import { photosTheme } from "ente-base/components/utils/theme";import { BaseContext, deriveBaseContext } from "ente-base/context";-import { ThemedLoadingBar } from "@/photos/components/ThemedLoadingBar";-import { useLoadingBar } from "@/photos/components/utils/use-loading-bar";-import { PhotosAppContext } from "@/photos/types/context";import { t } from "i18next";import type { AppProps } from "next/app";import { useCallback, useMemo } from "react";@@ -40,11 +40,7 @@ const App: React.FC<AlbumsAppProps> = ({ Component, pageProps }) => {[logout, showMiniDialog],);const appContext = useMemo(- () => ({- showLoadingBar,- hideLoadingBar,- showNotification,- }),+ () => ({ showLoadingBar, hideLoadingBar, showNotification }),[showLoadingBar, hideLoadingBar, showNotification],);const title = isI18nReady ? t("title_photos") : staticAppTitle;@@ -58,7 +54,9 @@ const App: React.FC<AlbumsAppProps> = ({ Component, pageProps }) => {{miniDialogProps.open && (<LazyAttributedMiniDialog {...miniDialogProps} />)}- {notificationProps.open && <LazyNotification {...notificationProps} />}+ {notificationProps.open && (+ <LazyNotification {...notificationProps} />+ )}<BaseContext value={baseContext}><PhotosAppContext value={appContext}>diff --git a/web/apps/albums/src/pages/index.tsx b/web/apps/albums/src/pages/index.tsxindex b041a4aced..eef070ed26 100644--- a/web/apps/albums/src/pages/index.tsx+++ b/web/apps/albums/src/pages/index.tsx@@ -1,5 +1,35 @@// TODO: Audit this file (too many null assertions + other issues)/* eslint-disable @typescript-eslint/no-floating-promises */+import type { FullScreenDropZoneProps } from "@/gallery/components/FullScreenDropZone";+import {+ useSaveGroupsActions,+ type AddSaveGroup,+} from "@/gallery/components/utils/save-groups";+import { type FileViewerInitialSidebar } from "@/gallery/components/viewer/FileViewer";+import { LazyPublicFeedSidebar } from "@/gallery/components/viewer/lazy";+import { type PublicFeedItemClickInfo } from "@/gallery/components/viewer/PublicFeedSidebar";+import { setPublicAlbumsCredentials } from "@/gallery/services/public-albums-credentials";+import { sortFiles } from "@/gallery/utils/file";+import {+ GalleryItemsHeaderAdapter,+ GalleryItemsSummary,+} from "@/photos/components/gallery/ListHeader";+import { usePhotosAppContext } from "@/photos/types/context";+import { ActiveDownloadStatusNotifications } from "@/public-album/components/ActiveDownloadStatusNotifications";+import { FeedIcon } from "@/public-album/components/Collections/FeedIcon";+import { type FileListHeaderOrFooter } from "@/public-album/components/FileList";+import { FileListWithViewer } from "@/public-album/components/FileListWithViewer";+import { LazyNotification } from "@/public-album/components/lazy-ui";+import type { PasswordUnlockScreenProps } from "@/public-album/components/PasswordUnlockScreen";+import type { PublicAlbumSingleFileViewerProps } from "@/public-album/components/PublicAlbumSingleFileViewer";+import type { TripLayoutProps } from "@/public-album/components/TripLayout";+import type { UploadProps } from "@/public-album/components/Upload";+import {+ getSelectedFiles,+ type SelectedState,+} from "@/public-album/utils/file";+import { getEnteURL } from "@/public-album/utils/public-album";+import { quickLinkDateRangeForFiles } from "@/public-album/utils/quick-link";import {Download01Icon,ImageAdd02Icon,@@ -18,13 +48,6 @@ import {useMediaQuery,} from "@mui/material";import Typography from "@mui/material/Typography";-import { ActiveDownloadStatusNotifications } from "@/public-album/components/ActiveDownloadStatusNotifications";-import { FeedIcon } from "@/public-album/components/Collections/FeedIcon";-import { type FileListHeaderOrFooter } from "@/public-album/components/FileList";-import { FileListWithViewer } from "@/public-album/components/FileListWithViewer";-import type { PublicAlbumSingleFileViewerProps } from "@/public-album/components/PublicAlbumSingleFileViewer";-import type { TripLayoutProps } from "@/public-album/components/TripLayout";-import type { UploadProps } from "@/public-album/components/Upload";import { SpacedRow, Stack100vhCenter } from "ente-base/components/containers";import { EnteLogo } from "ente-base/components/EnteLogo";import {@@ -49,49 +72,32 @@ import {isOfficialAlbumsApp,photosAppOrigin,} from "ente-base/origins";-import type { FullScreenDropZoneProps } from "@/gallery/components/FullScreenDropZone";-import {- useSaveGroupsActions,- type AddSaveGroup,-} from "@/gallery/components/utils/save-groups";-import { type FileViewerInitialSidebar } from "@/gallery/components/viewer/FileViewer";-import { type PublicFeedItemClickInfo } from "@/gallery/components/viewer/PublicFeedSidebar";-import { LazyPublicFeedSidebar } from "@/gallery/components/viewer/lazy";-import { setPublicAlbumsCredentials } from "@/gallery/services/public-albums-credentials";-import { sortFiles } from "@/gallery/utils/file";import type { Collection } from "ente-media/collection";import { type EnteFile } from "ente-media/file";import { fileFileName } from "ente-media/file-metadata";import { FileType } from "ente-media/file-type";-import {- GalleryItemsHeaderAdapter,- GalleryItemsSummary,-} from "@/photos/components/gallery/ListHeader";-import { usePhotosAppContext } from "@/photos/types/context";import { t } from "i18next";import dynamic from "next/dynamic";import { useRouter } from "next/router";import {- type ComponentType,- type PropsWithChildren,useCallback,useEffect,useMemo,useRef,useState,+ type ComponentType,+ type PropsWithChildren,} from "react";import { type FileWithPath } from "react-dropzone";-import { LazyNotification } from "@/public-album/components/lazy-ui";-import type { PasswordUnlockScreenProps } from "@/public-album/components/PasswordUnlockScreen";-import { getSelectedFiles, type SelectedState } from "@/public-album/utils/file";-import { getEnteURL } from "@/public-album/utils/public-album";-import { quickLinkDateRangeForFiles } from "@/public-album/utils/quick-link";const LazyPublicAlbumSingleFileViewer =dynamic<PublicAlbumSingleFileViewerProps>(() =>- import("@/public-album/components/PublicAlbumSingleFileViewer").then(- ({ PublicAlbumSingleFileViewer }) => PublicAlbumSingleFileViewer,+ import(+ "@/public-album/components/PublicAlbumSingleFileViewer"+ ).then(+ ({ PublicAlbumSingleFileViewer }) =>+ PublicAlbumSingleFileViewer,),{ ssr: false, loading: () => <LoadingIndicator /> },);@@ -105,7 +111,8 @@ const LazyTripLayout = dynamic<TripLayoutProps>();const LazyUpload = dynamic<UploadProps>(- () => import("@/public-album/components/Upload").then(({ Upload }) => Upload),+ () =>+ import("@/public-album/components/Upload").then(({ Upload }) => Upload),{ ssr: false },);@@ -117,8 +124,7 @@ const LazyPasswordUnlockScreen = dynamic<PasswordUnlockScreenProps>({ ssr: false, loading: () => <LoadingIndicator /> },);-const loadPublicAlbumsFDB = () =>- import("@/albums/services/public-albums-fdb");+const loadPublicAlbumsFDB = () => import("@/albums/services/public-albums-fdb");const loadPublicCollectionService = () =>import("@/albums/services/public-collection");@@ -151,9 +157,7 @@ export default function PublicCollectionGallery() {const [dragAndDropFiles, setDragAndDropFiles] = useState<FileWithPath[]>([],);- const [selected, setSelected] = useState<SelectedState>({- count: 0,- });+ const [selected, setSelected] = useState<SelectedState>({ count: 0 });// TODO: Can we convert these to stateconst credentials = useRef<PublicAlbumsCredentials | undefined>(undefined);@@ -314,7 +318,8 @@ export default function PublicCollectionGallery() {const downloadEnabled =publicCollection?.publicURLs[0]?.enableDownload ?? true;- const collectEnabled = publicCollection?.publicURLs[0]?.enableCollect ?? false;+ const collectEnabled =+ publicCollection?.publicURLs[0]?.enableCollect ?? false;useEffect(() => {if (!collectEnabled) return;@@ -519,9 +524,7 @@ export default function PublicCollectionGallery() {if (!selected.count) {return;}- setSelected({- count: 0,- });+ setSelected({ count: 0 });};const handleUploadFile = (file: EnteFile) =>@@ -781,14 +784,14 @@ export default function PublicCollectionGallery() {{publicFeedVisibilityProps.open &&publicCollection &&collectionKey.current && (- <LazyPublicFeedSidebar- {...publicFeedVisibilityProps}- files={publicFiles}- credentials={credentials.current}- collectionKey={collectionKey.current}- onItemClick={handleFeedItemClick}- />- )}+ <LazyPublicFeedSidebar+ {...publicFeedVisibilityProps}+ files={publicFiles}+ credentials={credentials.current}+ collectionKey={collectionKey.current}+ onItemClick={handleFeedItemClick}+ />+ )}</>);@@ -822,9 +825,10 @@ const normalizedPublicAlbumLayout = (layout: string | undefined) => {};type LazyCollectDropZoneProps = PropsWithChildren<- {- enabled: boolean;- } & Pick<FullScreenDropZoneProps, "disabled" | "message" | "onDrop">+ { enabled: boolean } & Pick<+ FullScreenDropZoneProps,+ "disabled" | "message" | "onDrop"+ >>;const LazyCollectDropZone: React.FC<LazyCollectDropZoneProps> = ({@@ -832,10 +836,9 @@ const LazyCollectDropZone: React.FC<LazyCollectDropZoneProps> = ({children,...props}) => {- const [DropZoneComponent, setDropZoneComponent] =- useState<- ComponentType<PropsWithChildren<FullScreenDropZoneProps>> | null- >(null);+ const [DropZoneComponent, setDropZoneComponent] = useState<ComponentType<+ PropsWithChildren<FullScreenDropZoneProps>+ > | null>(null);useEffect(() => {if (!enabled || DropZoneComponent) return;diff --git a/web/apps/albums/src/photos/types/context.ts b/web/apps/albums/src/photos/types/context.tsindex 34afb399b4..5c5b75d2ea 100644--- a/web/apps/albums/src/photos/types/context.ts+++ b/web/apps/albums/src/photos/types/context.ts@@ -1,5 +1,5 @@-import type { NotificationAttributes } from "../components/Notification";import { createContext, useContext } from "react";+import type { NotificationAttributes } from "../components/Notification";/*** The type of the React context available to all pages in the photos app.diff --git a/web/apps/albums/src/public-album/components/ActiveDownloadStatusNotifications.tsx b/web/apps/albums/src/public-album/components/ActiveDownloadStatusNotifications.tsxindex a70f2daaba..e61cc28f07 100644--- a/web/apps/albums/src/public-album/components/ActiveDownloadStatusNotifications.tsx+++ b/web/apps/albums/src/public-album/components/ActiveDownloadStatusNotifications.tsx@@ -6,7 +6,8 @@ const LazyDownloadStatusNotifications =dynamic<DownloadStatusNotificationsProps>(() =>import("./DownloadStatusNotifications").then(- ({ DownloadStatusNotifications }) => DownloadStatusNotifications,+ ({ DownloadStatusNotifications }) =>+ DownloadStatusNotifications,),{ ssr: false },);diff --git a/web/apps/albums/src/public-album/components/DownloadStatusNotifications.tsx b/web/apps/albums/src/public-album/components/DownloadStatusNotifications.tsxindex 58239be1a7..6ef829963b 100644--- a/web/apps/albums/src/public-album/components/DownloadStatusNotifications.tsx+++ b/web/apps/albums/src/public-album/components/DownloadStatusNotifications.tsx@@ -1,3 +1,9 @@+import {+ isSaveComplete,+ isSaveCompleteWithErrors,+ type SaveGroup,+} from "@/gallery/components/utils/save-groups";+import { Notification } from "@/photos/components/Notification";import {Download01Icon,Loading03Icon,@@ -15,12 +21,6 @@ import {Typography,} from "@mui/material";import { useBaseContext } from "ente-base/context";-import {- isSaveComplete,- isSaveCompleteWithErrors,- type SaveGroup,-} from "@/gallery/components/utils/save-groups";-import { Notification } from "@/photos/components/Notification";import { t } from "i18next";import { useState } from "react";diff --git a/web/apps/albums/src/public-album/components/FileList.tsx b/web/apps/albums/src/public-album/components/FileList.tsxindex 10078ced9f..0b2ae64d1a 100644--- a/web/apps/albums/src/public-album/components/FileList.tsx+++ b/web/apps/albums/src/public-album/components/FileList.tsx@@ -1,14 +1,4 @@-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 } from "@mui/material";-import { Overlay } from "ente-base/components/containers";-import log from "ente-base/log";import { thumbnailManager } from "@/gallery/services/thumbnail-manager";-import type { EnteFile } from "ente-media/file";-import { fileDurationString } from "ente-media/file-metadata";-import { FileType } from "ente-media/file-type";import {LoadingThumbnail,StaticThumbnail,@@ -18,6 +8,21 @@ import {thumbnailGap,type ThumbnailGridLayoutParams,} from "@/photos/components/utils/thumbnail-grid-layout";+import { type SelectedState } from "@/public-album/utils/file";+import {+ handleSelectCreator,+ handleSelectCreatorMulti,+} from "@/public-album/utils/photo-frame";+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 } from "@mui/material";+import { Overlay } from "ente-base/components/containers";+import log from "ente-base/log";+import type { EnteFile } from "ente-media/file";+import { fileDurationString } from "ente-media/file-metadata";+import { FileType } from "ente-media/file-type";import { batch } from "ente-utils/array";import { t } from "i18next";import React, {@@ -34,11 +39,6 @@ import {areEqual,type ListChildComponentProps,} from "react-window";-import { type SelectedState } from "@/public-album/utils/file";-import {- handleSelectCreator,- handleSelectCreatorMulti,-} from "@/public-album/utils/photo-frame";/*** A component with an explicit height suitable for being plugged in as the@@ -323,7 +323,10 @@ export const FileList: React.FC<FileListProps> = ({let pendingSplits = new Array<FileListAnnotatedFile[]>();for (const split of splitByDate(annotatedFiles)) {- const filledColumns = pendingSplits.reduce((a, s) => a + s.length, 0);+ const filledColumns = pendingSplits.reduce(+ (a, s) => a + s.length,+ 0,+ );const incomingColumns = split.length;// Check if the files in this split can be added to same row.@@ -797,22 +800,19 @@ export const FileList: React.FC<FileListProps> = ({]);const handleMasonryScroll: React.UIEventHandler<HTMLDivElement> =- useCallback(- (event) => {- const scrollOffset = event.currentTarget.scrollTop;- setShowBackToTop(scrollOffset > 500);- setMasonryScrollTop(scrollOffset);- setMasonryIsScrolling(true);- if (masonryScrollIdleTimeoutRef.current) {- clearTimeout(masonryScrollIdleTimeoutRef.current);- }- masonryScrollIdleTimeoutRef.current = setTimeout(() => {- setMasonryIsScrolling(false);- masonryScrollIdleTimeoutRef.current = undefined;- }, masonryScrollIdleMs);- },- [],- );+ useCallback((event) => {+ const scrollOffset = event.currentTarget.scrollTop;+ setShowBackToTop(scrollOffset > 500);+ setMasonryScrollTop(scrollOffset);+ setMasonryIsScrolling(true);+ if (masonryScrollIdleTimeoutRef.current) {+ clearTimeout(masonryScrollIdleTimeoutRef.current);+ }+ masonryScrollIdleTimeoutRef.current = setTimeout(() => {+ setMasonryIsScrolling(false);+ masonryScrollIdleTimeoutRef.current = undefined;+ }, masonryScrollIdleMs);+ }, []);useEffect(() => () => {@@ -903,11 +903,7 @@ export const FileList: React.FC<FileListProps> = ({<Box sx={{ position: "relative", width, height }}><Boxref={outerRef}- sx={{- width: "100%",- height: "100%",- overflowY: "auto",- }}+ sx={{ width: "100%", height: "100%", overflowY: "auto" }}onScroll={handleMasonryScroll}>{header && (diff --git a/web/apps/albums/src/public-album/components/FileListWithViewer.tsx b/web/apps/albums/src/public-album/components/FileListWithViewer.tsxindex d447bad93b..ce205a2a59 100644--- a/web/apps/albums/src/public-album/components/FileListWithViewer.tsx+++ b/web/apps/albums/src/public-album/components/FileListWithViewer.tsx@@ -1,24 +1,19 @@-import { styled } from "@mui/material";-import { isSameDay } from "ente-base/date";-import { formattedDate } from "ente-base/i18n-date";import type { AddSaveGroup } from "@/gallery/components/utils/save-groups";import {- type FileViewerProps,type FileViewerInitialSidebar,+ type FileViewerProps,} from "@/gallery/components/viewer/FileViewer";import {LazyFileViewer,scheduleFileViewerPreload,} from "@/gallery/components/viewer/lazy";+import { styled } from "@mui/material";+import { isSameDay } from "ente-base/date";+import { formattedDate } from "ente-base/i18n-date";import type { EnteFile } from "ente-media/file";import { fileCreationTime, fileFileName } from "ente-media/file-metadata";import { t } from "i18next";-import {- useCallback,- useEffect,- useMemo,- useState,-} from "react";+import { useCallback, useEffect, useMemo, useState } from "react";import AutoSizer from "react-virtualized-auto-sizer";import {FileList,diff --git a/web/apps/albums/src/public-album/components/PasswordUnlockScreen.tsx b/web/apps/albums/src/public-album/components/PasswordUnlockScreen.tsxindex 354d519e09..373f6cca10 100644--- a/web/apps/albums/src/public-album/components/PasswordUnlockScreen.tsx+++ b/web/apps/albums/src/public-album/components/PasswordUnlockScreen.tsx@@ -1,13 +1,13 @@+import {+ PublicAccessPageContents,+ PublicAccessPageTitle,+} from "@/public-album/components/PublicAccessPage";import { Stack, Typography } from "@mui/material";import {SingleInputForm,type SingleInputFormProps,} from "ente-base/components/SingleInputForm";import { t } from "i18next";-import {- PublicAccessPageContents,- PublicAccessPageTitle,-} from "@/public-album/components/PublicAccessPage";export interface PasswordUnlockScreenProps {onSubmit: SingleInputFormProps["onSubmit"];diff --git a/web/apps/albums/src/public-album/components/PublicAccessPage.tsx b/web/apps/albums/src/public-album/components/PublicAccessPage.tsxindex 0fc81d5012..67b37b48b4 100644--- a/web/apps/albums/src/public-album/components/PublicAccessPage.tsx+++ b/web/apps/albums/src/public-album/components/PublicAccessPage.tsx@@ -28,7 +28,7 @@ export const PublicAccessPageContents: React.FC<React.PropsWithChildren> = ({(theme) =>theme.applyStyles("dark", {bgcolor: "background.default",- }),+ }),]}><PublicAccessPagePaper>{children}</PublicAccessPagePaper>diff --git a/web/apps/albums/src/public-album/components/PublicAlbumSingleFileViewer.tsx b/web/apps/albums/src/public-album/components/PublicAlbumSingleFileViewer.tsxindex 7c549760f6..cdba01a7ce 100644--- a/web/apps/albums/src/public-album/components/PublicAlbumSingleFileViewer.tsx+++ b/web/apps/albums/src/public-album/components/PublicAlbumSingleFileViewer.tsx@@ -1,3 +1,9 @@+import type { AddSaveGroup } from "@/gallery/components/utils/save-groups";+import { FileViewer } from "@/gallery/components/viewer/FileViewer";+import { createPSRegisterElementIconHTML } from "@/gallery/components/viewer/icons";+import { downloadManager } from "@/gallery/services/download";+import { LazyNotification } from "@/public-album/components/lazy-ui";+import { getEnteURL } from "@/public-album/utils/public-album";import CheckIcon from "@mui/icons-material/Check";import ContentCopyIcon from "@mui/icons-material/ContentCopy";import DownloadOutlinedIcon from "@mui/icons-material/DownloadOutlined";@@ -22,17 +28,11 @@ import { ActivityIndicator } from "ente-base/components/mui/ActivityIndicator";import { useBaseContext } from "ente-base/context";import type { PublicAlbumsCredentials } from "ente-base/http";import log from "ente-base/log";-import { LazyNotification } from "@/public-album/components/lazy-ui";-import type { AddSaveGroup } from "@/gallery/components/utils/save-groups";-import { FileViewer } from "@/gallery/components/viewer/FileViewer";-import { createPSRegisterElementIconHTML } from "@/gallery/components/viewer/icons";-import { downloadManager } from "@/gallery/services/download";import type { EnteFile } from "ente-media/file";import { fileFileName } from "ente-media/file-metadata";import { FileType } from "ente-media/file-type";import { t } from "i18next";import { useCallback, useEffect, useMemo, useState } from "react";-import { getEnteURL } from "@/public-album/utils/public-album";export interface PublicAlbumSingleFileViewerProps {file: EnteFile;diff --git a/web/apps/albums/src/public-album/components/TripLayout/MobileNavBar.tsx b/web/apps/albums/src/public-album/components/TripLayout/MobileNavBar.tsxindex 80c2965b5f..517f678afb 100644--- a/web/apps/albums/src/public-album/components/TripLayout/MobileNavBar.tsx+++ b/web/apps/albums/src/public-album/components/TripLayout/MobileNavBar.tsx@@ -1,17 +1,17 @@+import { FeedIcon } from "@/public-album/components/Collections/FeedIcon";+import { LazyNotification } from "@/public-album/components/lazy-ui";+import { useJoinAlbum } from "@/public-album/hooks/useJoinAlbum";+import { getEnteURL } from "@/public-album/utils/public-album";import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternateOutlined";import CheckIcon from "@mui/icons-material/Check";import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";import ShareIcon from "@mui/icons-material/Share";import { Box, Button, IconButton, styled } from "@mui/material";-import { FeedIcon } from "@/public-album/components/Collections/FeedIcon";-import { LazyNotification } from "@/public-album/components/lazy-ui";import { EnteLogo } from "ente-base/components/EnteLogo";import type { PublicAlbumsCredentials } from "ente-base/http";import type { Collection } from "ente-media/collection";-import { useJoinAlbum } from "@/public-album/hooks/useJoinAlbum";import { t } from "i18next";import { useState } from "react";-import { getEnteURL } from "@/public-album/utils/public-album";interface MobileNavBarProps {onAddPhotos?: () => void;diff --git a/web/apps/albums/src/public-album/components/TripLayout/TopNavButtons.tsx b/web/apps/albums/src/public-album/components/TripLayout/TopNavButtons.tsxindex 85c9c9a61a..696ad51f8c 100644--- a/web/apps/albums/src/public-album/components/TripLayout/TopNavButtons.tsx+++ b/web/apps/albums/src/public-album/components/TripLayout/TopNavButtons.tsx@@ -1,16 +1,16 @@+import { FeedIcon } from "@/public-album/components/Collections/FeedIcon";+import { LazyNotification } from "@/public-album/components/lazy-ui";+import { useJoinAlbum } from "@/public-album/hooks/useJoinAlbum";+import { getEnteURL } from "@/public-album/utils/public-album";import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternateOutlined";import CheckIcon from "@mui/icons-material/Check";import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";import ShareIcon from "@mui/icons-material/Share";import { Box, Button, IconButton, styled } from "@mui/material";-import { FeedIcon } from "@/public-album/components/Collections/FeedIcon";-import { LazyNotification } from "@/public-album/components/lazy-ui";import type { PublicAlbumsCredentials } from "ente-base/http";import type { Collection } from "ente-media/collection";-import { useJoinAlbum } from "@/public-album/hooks/useJoinAlbum";import { t } from "i18next";import { useState } from "react";-import { getEnteURL } from "@/public-album/utils/public-album";interface TopNavButtonsProps {onAddPhotos?: () => void;diff --git a/web/apps/albums/src/public-album/components/TripLayout/TripMap.tsx b/web/apps/albums/src/public-album/components/TripLayout/TripMap.tsxindex aa6dcc6897..438d5c770a 100644--- a/web/apps/albums/src/public-album/components/TripLayout/TripMap.tsx+++ b/web/apps/albums/src/public-album/components/TripLayout/TripMap.tsx@@ -1,6 +1,6 @@import { Box, styled, useMediaQuery, useTheme } from "@mui/material";-import { useEffect, useState } from "react";import "leaflet/dist/leaflet.css";+import { useEffect, useState } from "react";import { MapEvents } from "./MapEvents";import { createIcon, getMapCenter } from "./mapHelpers";diff --git a/web/apps/albums/src/public-album/components/TripLayout/index.tsx b/web/apps/albums/src/public-album/components/TripLayout/index.tsxindex ff4b6d87f3..67f318b1b8 100644--- a/web/apps/albums/src/public-album/components/TripLayout/index.tsx+++ b/web/apps/albums/src/public-album/components/TripLayout/index.tsx@@ -1,22 +1,18 @@-import { Box, styled, useMediaQuery, useTheme } from "@mui/material";-import { ActiveDownloadStatusNotifications } from "@/public-album/components/ActiveDownloadStatusNotifications";-import { useModalVisibility } from "ente-base/components/utils/modal";-import type { PublicAlbumsCredentials } from "ente-base/http";import { useSaveGroupsActions } from "@/gallery/components/utils/save-groups";-import {- type FileViewerInitialSidebar,-} from "@/gallery/components/viewer/FileViewer";-import {- type PublicFeedItemClickInfo,-} from "@/gallery/components/viewer/PublicFeedSidebar";+import { type FileViewerInitialSidebar } from "@/gallery/components/viewer/FileViewer";+import { type PublicFeedItemClickInfo } from "@/gallery/components/viewer/PublicFeedSidebar";import {LazyFileViewer,LazyPublicFeedSidebar,scheduleFileViewerPreload,} from "@/gallery/components/viewer/lazy";+import { ActiveDownloadStatusNotifications } from "@/public-album/components/ActiveDownloadStatusNotifications";+import { useJoinAlbum } from "@/public-album/hooks/useJoinAlbum";+import { Box, styled, useMediaQuery, useTheme } from "@mui/material";+import { useModalVisibility } from "ente-base/components/utils/modal";+import type { PublicAlbumsCredentials } from "ente-base/http";import { type Collection } from "ente-media/collection";import { type EnteFile } from "ente-media/file";-import { useJoinAlbum } from "@/public-album/hooks/useJoinAlbum";import { useEffect, useRef, useState } from "react";// Import extracted components@@ -612,14 +608,14 @@ export const TripLayout: React.FC<TripLayoutProps> = ({collection &&credentials?.current &&collectionKey && (- <LazyPublicFeedSidebar- {...publicFeedVisibilityProps}- files={files}- credentials={credentials.current}- collectionKey={collectionKey}- onItemClick={handleFeedItemClick}- />- )}+ <LazyPublicFeedSidebar+ {...publicFeedVisibilityProps}+ files={files}+ credentials={credentials.current}+ collectionKey={collectionKey}+ onItemClick={handleFeedItemClick}+ />+ )}</TripLayoutContainer>);};diff --git a/web/apps/albums/src/public-album/components/Upload.tsx b/web/apps/albums/src/public-album/components/Upload.tsxindex 9079e773b5..32a7e5e8dd 100644--- a/web/apps/albums/src/public-album/components/Upload.tsx+++ b/web/apps/albums/src/public-album/components/Upload.tsx@@ -1,6 +1,29 @@// TODO: Audit this file// TODO: Too many null assertions in this file. The types need reworking./* eslint-disable react-hooks/exhaustive-deps */+import { UploaderNameInput } from "@/albums/components/UploaderNameInput";+import {+ savedPublicCollectionUploaderName,+ savePublicCollectionUploaderName,+} from "@/albums/services/public-albums-fdb";+import { useFileInput } from "@/gallery/components/utils/use-file-input";+import { uploadPathPrefix, type UploadPhase } from "@/gallery/services/upload";+import type { ParsedMetadataJSON } from "@/gallery/services/upload/metadata-json";+import {+ sessionExpiredErrorMessage,+ storageLimitExceededErrorMessage,+ subscriptionExpiredErrorMessage,+} from "@/gallery/services/upload/upload-service";+import { usePhotosAppContext } from "@/photos/types/context";+import type {+ InProgressUpload,+ SegregatedFinishedUploads,+ UploadCounter,+ UploadFileNames,+ UploadItemWithCollection,+} from "@/public-album/services/upload-manager";+import { uploadManager } from "@/public-album/services/upload-manager";+import { hasReliableCanvasReadback } from "@/public-album/utils/canvas-integrity";import ChevronRightIcon from "@mui/icons-material/ChevronRight";import ImageOutlinedIcon from "@mui/icons-material/ImageOutlined";import PermMediaOutlinedIcon from "@mui/icons-material/PermMediaOutlined";@@ -25,37 +48,11 @@ import { useBaseContext } from "ente-base/context";import { basename } from "ente-base/file-name";import type { PublicAlbumsCredentials } from "ente-base/http";import log from "ente-base/log";-import { useFileInput } from "@/gallery/components/utils/use-file-input";-import {- uploadPathPrefix,- type UploadPhase,-} from "@/gallery/services/upload";-import type { ParsedMetadataJSON } from "@/gallery/services/upload/metadata-json";-import {- sessionExpiredErrorMessage,- storageLimitExceededErrorMessage,- subscriptionExpiredErrorMessage,-} from "@/gallery/services/upload/upload-service";import { type Collection } from "ente-media/collection";import type { EnteFile } from "ente-media/file";-import { UploaderNameInput } from "@/albums/components/UploaderNameInput";-import {- savedPublicCollectionUploaderName,- savePublicCollectionUploaderName,-} from "@/albums/services/public-albums-fdb";-import { usePhotosAppContext } from "@/photos/types/context";import { firstNonEmpty } from "ente-utils/array";import { t } from "i18next";import React, { useCallback, useEffect, useRef, useState } from "react";-import type {- InProgressUpload,- SegregatedFinishedUploads,- UploadCounter,- UploadFileNames,- UploadItemWithCollection,-} from "@/public-album/services/upload-manager";-import { uploadManager } from "@/public-album/services/upload-manager";-import { hasReliableCanvasReadback } from "@/public-album/utils/canvas-integrity";import { CanvasReadbackBlockedDialog } from "./CanvasReadbackBlockedDialog";import { UploadProgress } from "./UploadProgress";diff --git a/web/apps/albums/src/public-album/components/UploadProgress.tsx b/web/apps/albums/src/public-album/components/UploadProgress.tsxindex ecd6bae1de..c19af3fddb 100644--- a/web/apps/albums/src/public-album/components/UploadProgress.tsx+++ b/web/apps/albums/src/public-album/components/UploadProgress.tsx@@ -1,5 +1,13 @@// TODO: Audit this file/* eslint-disable @typescript-eslint/no-unsafe-argument */+import { type UploadPhase } from "@/gallery/services/upload";+import type {+ FinishedUploadType,+ InProgressUpload,+ SegregatedFinishedUploads,+ UploadCounter,+ UploadFileNames,+} from "@/public-album/services/upload-manager";import CloseIcon from "@mui/icons-material/Close";import ExpandMoreIcon from "@mui/icons-material/ExpandMore";import UnfoldLessIcon from "@mui/icons-material/UnfoldLess";@@ -29,7 +37,6 @@ import { SpacedRow } from "ente-base/components/containers";import { FilledIconButton } from "ente-base/components/mui";import { useBaseContext } from "ente-base/context";import { formattedListJoin } from "ente-base/i18n";-import { type UploadPhase } from "@/gallery/services/upload";import { t } from "i18next";import memoize from "memoize-one";import React, {@@ -47,13 +54,6 @@ import {type ListChildComponentProps,type ListItemKeySelector,} from "react-window";-import type {- FinishedUploadType,- InProgressUpload,- SegregatedFinishedUploads,- UploadCounter,- UploadFileNames,-} from "@/public-album/services/upload-manager";interface UploadProgressProps {open: boolean;diff --git a/web/apps/albums/src/public-album/hooks/useJoinAlbum.ts b/web/apps/albums/src/public-album/hooks/useJoinAlbum.tsindex 0876a2ce89..3fb2900dd6 100644--- a/web/apps/albums/src/public-album/hooks/useJoinAlbum.ts+++ b/web/apps/albums/src/public-album/hooks/useJoinAlbum.ts@@ -1,7 +1,7 @@+import { joinPublicAlbumViaRedirect } from "@/public-album/services/join-public-album-redirect";import type { PublicAlbumsCredentials } from "ente-base/http";import type { Collection } from "ente-media/collection";import type { RefObject } from "react";-import { joinPublicAlbumViaRedirect } from "@/public-album/services/join-public-album-redirect";export interface UseJoinAlbumProps {/** Collection to join */diff --git a/web/apps/albums/src/public-album/services/upload-manager.ts b/web/apps/albums/src/public-album/services/upload-manager.tsindex 31d1eebb70..f187c25c16 100644--- a/web/apps/albums/src/public-album/services/upload-manager.ts+++ b/web/apps/albums/src/public-album/services/upload-manager.ts@@ -1,11 +1,6 @@// TODO: Audit this file// TODO: Too many null assertions in this file. The types need reworking.-import { createComlinkCryptoWorker } from "ente-base/crypto";-import { type CryptoWorker } from "ente-base/crypto/worker";-import { lowercaseExtension, nameAndExtension } from "ente-base/file-name";-import type { PublicAlbumsCredentials } from "ente-base/http";-import log from "ente-base/log";-import { ComlinkWorker } from "ente-base/worker/comlink-worker";+import { savedPublicCollectionFiles } from "@/albums/services/public-albums-fdb";import {shouldDisableCFUploadProxy,type ClusteredUploadItem,@@ -27,11 +22,16 @@ import UploadService, {type PotentialLivePhotoAsset,type UploadAsset,} from "@/gallery/services/upload/upload-service";+import { createComlinkCryptoWorker } from "ente-base/crypto";+import { type CryptoWorker } from "ente-base/crypto/worker";+import { lowercaseExtension, nameAndExtension } from "ente-base/file-name";+import type { PublicAlbumsCredentials } from "ente-base/http";+import log from "ente-base/log";+import { ComlinkWorker } from "ente-base/worker/comlink-worker";import type { Collection } from "ente-media/collection";import { type EnteFile } from "ente-media/file";import { FileType } from "ente-media/file-type";import { potentialFileTypeFromExtension } from "ente-media/live-photo";-import { savedPublicCollectionFiles } from "@/albums/services/public-albums-fdb";import { wait } from "ente-utils/promise";export type FileID = number;diff --git a/web/apps/albums/src/public-album/utils/photo-frame.ts b/web/apps/albums/src/public-album/utils/photo-frame.tsindex e89d279151..e8d9c4dcde 100644--- a/web/apps/albums/src/public-album/utils/photo-frame.ts+++ b/web/apps/albums/src/public-album/utils/photo-frame.ts@@ -1,5 +1,8 @@// TODO: Audit this file-import type { SelectedState, SetSelectedState } from "@/public-album/utils/file";+import type {+ SelectedState,+ SetSelectedState,+} from "@/public-album/utils/file";export const handleSelectCreator =(@@ -48,10 +51,7 @@ export const handleSelectCreatorMulti =}}- return {- ...newSelected,- count: newCount,- };+ return { ...newSelected, count: newCount };});};diff --git a/web/apps/albums/tsconfig.json b/web/apps/albums/tsconfig.jsonindex 1189b7eaeb..cc1ac8b35d 100644--- a/web/apps/albums/tsconfig.json+++ b/web/apps/albums/tsconfig.json@@ -1,31 +1,18 @@{- "extends": "ente-build-config/tsconfig-next.json",- "compilerOptions": {- "baseUrl": ".",- "paths": {- "@/*": [- "src/*"- ]+ "extends": "ente-build-config/tsconfig-next.json",+ "compilerOptions": {+ "baseUrl": ".",+ "paths": { "@/*": ["src/*"] },+ "plugins": [{ "name": "next" }]},- "plugins": [- {- "name": "next"- }- ]- },- "include": [- "../../packages/base/components/utils/mui-theme.d.ts",- "../../packages/base/global-electron.d.ts",- "next-env.d.ts",- "src/**/*.js",- "src/**/*.ts",- "src/**/*.tsx",- ".next/types/**/*.ts"- ],- "exclude": [- "node_modules",- "out",- ".next",- ".next-desktop"- ]+ "include": [+ "../../packages/base/components/utils/mui-theme.d.ts",+ "../../packages/base/global-electron.d.ts",+ "next-env.d.ts",+ "src/**/*.js",+ "src/**/*.ts",+ "src/**/*.tsx",+ ".next/types/**/*.ts"+ ],+ "exclude": ["node_modules", "out", ".next", ".next-desktop"]}diff --git a/web/apps/ensu/src/components/chat/ChatMessageList.tsx b/web/apps/ensu/src/components/chat/ChatMessageList.tsxindex d76af28912..0c60b7551f 100644--- a/web/apps/ensu/src/components/chat/ChatMessageList.tsx+++ b/web/apps/ensu/src/components/chat/ChatMessageList.tsx@@ -184,10 +184,10 @@ const MessageRow = memo(const switcher = branchSwitchers[message.messageUuid];const showSwitcher = !isSynthetic && !!switcher && switcher.total > 1;const timestamp = formatTime(message.createdAt);- const attachments = message.attachments ?? [];const assistantMessagePaddingX = "8px";const { displayText, copyText, imageAttachments } = useMemo(() => {+ const attachments = message.attachments ?? [];const imageAttachments = attachments.filter((attachment) => attachment.kind === "image",);@@ -205,8 +205,8 @@ const MessageRow = memo(return { displayText, copyText, imageAttachments };}, [- attachments,isSelf,+ message.attachments,message.text,parseDocumentBlocks,stripHiddenParts,diff --git a/web/apps/memories/src/components/PublicMemoryViewerShared.tsx b/web/apps/memories/src/components/PublicMemoryViewerShared.tsxindex 2a83582a21..5b0da10fa3 100644--- a/web/apps/memories/src/components/PublicMemoryViewerShared.tsx+++ b/web/apps/memories/src/components/PublicMemoryViewerShared.tsx@@ -4,11 +4,11 @@ import { downloadManager } from "ente-gallery/services/download";import type { EnteFile } from "ente-media/file";import { fileCreationPhotoDate } from "ente-media/file-metadata";import { FileType } from "ente-media/file-type";+import { useCallback, useEffect, useMemo, useRef, useState } from "react";import {type PublicMemoryShareFrame,type PublicMemoryShareMetadata,} from "../services/public-memory";-import { useCallback, useEffect, useMemo, useRef, useState } from "react";import {buildLaneCaptionModel,buildLaneTitle,diff --git a/web/apps/memories/src/services/public-memory-page.ts b/web/apps/memories/src/services/public-memory-page.tsindex 155724b1b5..4eab802f27 100644--- a/web/apps/memories/src/services/public-memory-page.ts+++ b/web/apps/memories/src/services/public-memory-page.ts@@ -2,6 +2,11 @@ import { isHTTPErrorWithStatus } from "ente-base/http";import log from "ente-base/log";import { memoriesAppOrigin } from "ente-base/origins";import type { EnteFile } from "ente-media/file";+import { alignLaneFilesWithMetadata } from "../utils/lane";+import {+ extractAccessTokenFromURL,+ extractMemoryShareKeyFromURL,+} from "../utils/public-memory-url";import {decryptMemoryShareMetadata,getPublicMemoryFiles,@@ -9,11 +14,6 @@ import {type PublicMemoryShareFrame,type PublicMemoryShareMetadata,} from "./public-memory";-import { alignLaneFilesWithMetadata } from "../utils/lane";-import {- extractAccessTokenFromURL,- extractMemoryShareKeyFromURL,-} from "../utils/public-memory-url";export type PublicMemoryViewerVariant = "share" | "lane";diff --git a/web/apps/memories/src/services/public-memory.ts b/web/apps/memories/src/services/public-memory.tsindex 3cc5efe9c9..b44eb8776e 100644--- a/web/apps/memories/src/services/public-memory.ts+++ b/web/apps/memories/src/services/public-memory.ts@@ -1,9 +1,7 @@import { decryptBoxBytes } from "ente-base/crypto";import { ensureOk } from "ente-base/http";import { apiURL } from "ente-base/origins";-import {- authenticatedPublicMemoryRequestHeaders,-} from "ente-base/public-memory";+import { authenticatedPublicMemoryRequestHeaders } from "ente-base/public-memory";import {decryptRemoteFile,RemoteEnteFile,diff --git a/web/apps/photos/src/components/Collections/AllPeople.tsx b/web/apps/photos/src/components/Collections/AllPeople.tsxindex 80edf1695c..52404fdc2e 100644--- a/web/apps/photos/src/components/Collections/AllPeople.tsx+++ b/web/apps/photos/src/components/Collections/AllPeople.tsx@@ -29,10 +29,8 @@ import {import { SingleInputDialog } from "ente-base/components/SingleInputDialog";import { useBaseContext } from "ente-base/context";import { SlideUpTransition } from "ente-new/photos/components/mui/SlideUpTransition";-import {- PeopleSortOptions,- type PeopleSortBy,-} from "ente-new/photos/components/PeopleSortOptions";+import type { PeopleSortBy } from "ente-new/photos/components/people-sort";+import { PeopleSortOptions } from "ente-new/photos/components/PeopleSortOptions";import {ItemCard,LargeTileButton,diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsxindex 054f7fe43a..c41d5471ad 100644--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx@@ -14,10 +14,6 @@ import {type SaveGroup,} from "ente-gallery/components/utils/save-groups";import type { Collection } from "ente-media/collection";-import {- sortPeople,- type PeopleSortBy,-} from "ente-new/photos/components/PeopleSortOptions";import {GalleryBarImpl,type GalleryBarImplProps,@@ -27,6 +23,10 @@ import {GalleryItemsSummary,} from "ente-new/photos/components/gallery/ListHeader";import { PeopleHeader } from "ente-new/photos/components/gallery/PeopleHeader";+import {+ sortPeople,+ type PeopleSortBy,+} from "ente-new/photos/components/people-sort";import {collectionsSortBy,haveOnlySystemCollections,diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsxindex cf152a1906..0c54597968 100644--- a/web/apps/photos/src/components/Upload.tsx+++ b/web/apps/photos/src/components/Upload.tsx@@ -590,7 +590,9 @@ export const Upload: React.FC<UploadProps> = ({collectionID: collection.id,}),);- await waitInQueueAndUploadFiles(uploadItemsWithCollection, [collection]);+ await waitInQueueAndUploadFiles(uploadItemsWithCollection, [+ collection,+ ]);uploadItemsAndPaths.current = [];};diff --git a/web/apps/photos/src/styles/photoswipe.css b/web/apps/photos/src/styles/photoswipe.cssindex fa58740528..ca3c651f24 100644--- a/web/apps/photos/src/styles/photoswipe.css+++ b/web/apps/photos/src/styles/photoswipe.css@@ -194,7 +194,6 @@.pswp-ente .pswp__button--close {margin-right: -2px;}-}@media (width < 350px) {@@ -209,7 +208,6 @@.pswp-ente .pswp__button--close {margin-right: -4px;}-}/* Caption styling */diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsxindex b14d32e898..caab495752 100644--- a/web/packages/gallery/components/viewer/FileViewer.tsx+++ b/web/packages/gallery/components/viewer/FileViewer.tsx@@ -790,7 +790,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({collectionID: collectionId,fileID: fileId,reactionType: "green_heart",- userID: user?.id ?? 0,+ userID: user.id,isDeleted: false,createdAt: Date.now() * 1000,updatedAt: Date.now() * 1000,@@ -903,7 +903,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({collectionID: activeCollectionID,fileID: fileId,reactionType: "green_heart",- userID: user?.id ?? 0,+ userID: user.id,isDeleted: false,createdAt: Date.now() * 1000,updatedAt: Date.now() * 1000,diff --git a/web/packages/new/photos/components/PeopleSortOptions.tsx b/web/packages/new/photos/components/PeopleSortOptions.tsxindex 166e734c93..fd3c30c5df 100644--- a/web/packages/new/photos/components/PeopleSortOptions.tsx+++ b/web/packages/new/photos/components/PeopleSortOptions.tsx@@ -11,16 +11,10 @@ import {type PaperProps,} from "@mui/material";import Menu, { type MenuProps } from "@mui/material/Menu";-import type { Person } from "ente-new/photos/services/ml/people";+import type { PeopleSortBy } from "ente-new/photos/components/people-sort";import { t } from "i18next";import React, { useRef, useState } from "react";-export type PeopleSortBy =- | "count-desc"- | "count-asc"- | "name-asc"- | "name-desc";-interface PeopleSortOptionsProps {activeSortBy: PeopleSortBy;onChangeSortBy: (by: PeopleSortBy) => void;@@ -224,57 +218,3 @@ const StyledMenuItem = styled(MenuItem)(({ theme }) => ({"& .MuiListItemText-root": { margin: 0 },"& .MuiListItemText-primary": { color: "inherit", fontSize: "inherit" },}));--export const sortPeople = (people: Person[], sortBy: PeopleSortBy): Person[] =>- [...people].sort(personComparator(sortBy));--const personComparator =- (sortBy: PeopleSortBy) =>- (a: Person, b: Person): number => {- if (a.isPinned !== b.isPinned) {- return a.isPinned ? -1 : 1;- }-- const sectionRankDiff = personSectionRank(a) - personSectionRank(b);-- if (sortBy.startsWith("name")) {- const aName = a.name?.trim();- const bName = b.name?.trim();- if (!!aName !== !!bName) {- return aName ? -1 : 1;- }- if (aName && bName) {- const cmp = aName.localeCompare(bName, undefined, {- sensitivity: "base",- });- if (cmp) {- return sortBy === "name-asc" ? cmp : -cmp;- }- }- return b.fileIDs.length - a.fileIDs.length;- }-- if (sectionRankDiff) {- return sectionRankDiff;- }-- const countDiff = a.fileIDs.length - b.fileIDs.length;- if (countDiff) {- return sortBy === "count-asc" ? countDiff : -countDiff;- }-- const aName = a.name?.trim();- const bName = b.name?.trim();- if (!!aName !== !!bName) {- return aName ? -1 : 1;- }- if (aName && bName) {- return aName.localeCompare(bName, undefined, {- sensitivity: "base",- });- }- return 0;- };--const personSectionRank = (person: Person) =>- person.type === "cgroup" ? 0 : 1;diff --git a/web/packages/new/photos/components/gallery/BarImpl.tsx b/web/packages/new/photos/components/gallery/BarImpl.tsxindex 604f92ed46..7baf18fb8f 100644--- a/web/packages/new/photos/components/gallery/BarImpl.tsx+++ b/web/packages/new/photos/components/gallery/BarImpl.tsx@@ -11,10 +11,8 @@ import { Ellipsized2LineTypography } from "ente-base/components/Typography";import { useIsSmallWidth } from "ente-base/components/utils/hooks";import { CollectionsSortOptions } from "ente-new/photos/components/CollectionsSortOptions";import { StarIcon } from "ente-new/photos/components/icons/StarIcon";-import {- PeopleSortOptions,- type PeopleSortBy,-} from "ente-new/photos/components/PeopleSortOptions";+import type { PeopleSortBy } from "ente-new/photos/components/people-sort";+import { PeopleSortOptions } from "ente-new/photos/components/PeopleSortOptions";import {BarItemTile,ItemCard,diff --git a/web/packages/new/photos/components/people-sort.ts b/web/packages/new/photos/components/people-sort.tsnew file mode 100644index 0000000000..c3050c5e4f--- /dev/null+++ b/web/packages/new/photos/components/people-sort.ts@@ -0,0 +1,61 @@+import type { Person } from "ente-new/photos/services/ml/people";++export type PeopleSortBy =+ | "count-desc"+ | "count-asc"+ | "name-asc"+ | "name-desc";++export const sortPeople = (people: Person[], sortBy: PeopleSortBy): Person[] =>+ [...people].sort(personComparator(sortBy));++const personComparator =+ (sortBy: PeopleSortBy) =>+ (a: Person, b: Person): number => {+ if (a.isPinned !== b.isPinned) {+ return a.isPinned ? -1 : 1;+ }++ const sectionRankDiff = personSectionRank(a) - personSectionRank(b);++ if (sortBy.startsWith("name")) {+ const aName = a.name?.trim();+ const bName = b.name?.trim();+ if (!!aName !== !!bName) {+ return aName ? -1 : 1;+ }+ if (aName && bName) {+ const cmp = aName.localeCompare(bName, undefined, {+ sensitivity: "base",+ });+ if (cmp) {+ return sortBy === "name-asc" ? cmp : -cmp;+ }+ }+ return b.fileIDs.length - a.fileIDs.length;+ }++ if (sectionRankDiff) {+ return sectionRankDiff;+ }++ const countDiff = a.fileIDs.length - b.fileIDs.length;+ if (countDiff) {+ return sortBy === "count-asc" ? countDiff : -countDiff;+ }++ const aName = a.name?.trim();+ const bName = b.name?.trim();+ if (!!aName !== !!bName) {+ return aName ? -1 : 1;+ }+ if (aName && bName) {+ return aName.localeCompare(bName, undefined, {+ sensitivity: "base",+ });+ }+ return 0;+ };++const personSectionRank = (person: Person) =>+ person.type === "cgroup" ? 0 : 1;diff --git a/web/packages/new/photos/components/sidebar/AppLockSettings.tsx b/web/packages/new/photos/components/sidebar/AppLockSettings.tsxindex d7799379b3..ebe3581b56 100644--- a/web/packages/new/photos/components/sidebar/AppLockSettings.tsx+++ b/web/packages/new/photos/components/sidebar/AppLockSettings.tsx@@ -164,7 +164,13 @@ export const AppLockSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({// Fallback when macOS device lock setup is unavailable/failed.setPinDialogOpen(true);})();- }, [state.enabled, showMiniDialog, isMacOS, handleSelectDeviceLock]);+ }, [+ state.enabled,+ state.supported,+ showMiniDialog,+ isMacOS,+ handleSelectDeviceLock,+ ]);const handleSelectPin = useCallback(() => {setPinDialogOpen(true);