Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move app context to new

Manav Rathif2dc01c57943
diff --git a/web/apps/auth/src/pages/auth.tsx b/web/apps/auth/src/pages/auth.tsx
index b080fd4ab8..5649685d02 100644
--- a/web/apps/auth/src/pages/auth.tsx
+++ b/web/apps/auth/src/pages/auth.tsx
@@ -2,6 +2,7 @@ import { stashRedirect } from "@/accounts/services/redirect";
import { EnteLogo } from "@/base/components/EnteLogo";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { NavbarBase } from "@/base/components/Navbar";
+import { AppContext } from "@/new/photos/types/context";
import { ensure } from "@/utils/ensure";
import {
HorizontalFlex,
@@ -17,7 +18,6 @@ import MoreHoriz from "@mui/icons-material/MoreHoriz";
import { Button, ButtonBase, Snackbar, TextField, styled } from "@mui/material";
import { t } from "i18next";
import { useRouter } from "next/router";
-import { AppContext } from "pages/_app";
import React, { useContext, useEffect, useState } from "react";
import { generateOTPs, type Code } from "services/code";
import { getAuthCodes } from "services/remote";
diff --git a/web/apps/auth/src/pages/change-email.tsx b/web/apps/auth/src/pages/change-email.tsx
index cef4716203..4961d86590 100644
--- a/web/apps/auth/src/pages/change-email.tsx
+++ b/web/apps/auth/src/pages/change-email.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/change-email";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/change-password.tsx b/web/apps/auth/src/pages/change-password.tsx
index 2232edc6bc..1c137d50ba 100644
--- a/web/apps/auth/src/pages/change-password.tsx
+++ b/web/apps/auth/src/pages/change-password.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/change-password";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/credentials.tsx b/web/apps/auth/src/pages/credentials.tsx
index fa3cc8fad6..a737676b33 100644
--- a/web/apps/auth/src/pages/credentials.tsx
+++ b/web/apps/auth/src/pages/credentials.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/credentials";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/generate.tsx b/web/apps/auth/src/pages/generate.tsx
index a82d0a46f3..244da239bb 100644
--- a/web/apps/auth/src/pages/generate.tsx
+++ b/web/apps/auth/src/pages/generate.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/generate";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/login.tsx b/web/apps/auth/src/pages/login.tsx
index a61718a309..ca1a027e86 100644
--- a/web/apps/auth/src/pages/login.tsx
+++ b/web/apps/auth/src/pages/login.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/login";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/passkeys/finish.tsx b/web/apps/auth/src/pages/passkeys/finish.tsx
index e75df9677b..12037f8083 100644
--- a/web/apps/auth/src/pages/passkeys/finish.tsx
+++ b/web/apps/auth/src/pages/passkeys/finish.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/passkeys/finish";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/passkeys/recover.tsx b/web/apps/auth/src/pages/passkeys/recover.tsx
index d7ac1c30df..6584f5bacc 100644
--- a/web/apps/auth/src/pages/passkeys/recover.tsx
+++ b/web/apps/auth/src/pages/passkeys/recover.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/two-factor/recover";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => (
<Page_ appContext={useAppContext()} twoFactorType="passkey" />
diff --git a/web/apps/auth/src/pages/recover.tsx b/web/apps/auth/src/pages/recover.tsx
index 3fb3866a8a..1bb15511cb 100644
--- a/web/apps/auth/src/pages/recover.tsx
+++ b/web/apps/auth/src/pages/recover.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/recover";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/signup.tsx b/web/apps/auth/src/pages/signup.tsx
index 37386b9b4e..99eae32ae0 100644
--- a/web/apps/auth/src/pages/signup.tsx
+++ b/web/apps/auth/src/pages/signup.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/signup";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/two-factor/recover.tsx b/web/apps/auth/src/pages/two-factor/recover.tsx
index 1c36e691ec..effd30bb5b 100644
--- a/web/apps/auth/src/pages/two-factor/recover.tsx
+++ b/web/apps/auth/src/pages/two-factor/recover.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/two-factor/recover";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} twoFactorType="totp" />;
diff --git a/web/apps/auth/src/pages/two-factor/setup.tsx b/web/apps/auth/src/pages/two-factor/setup.tsx
index 404fbb271a..0321f392ad 100644
--- a/web/apps/auth/src/pages/two-factor/setup.tsx
+++ b/web/apps/auth/src/pages/two-factor/setup.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/two-factor/setup";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/two-factor/verify.tsx b/web/apps/auth/src/pages/two-factor/verify.tsx
index b6fc679f8c..f6c9b6a494 100644
--- a/web/apps/auth/src/pages/two-factor/verify.tsx
+++ b/web/apps/auth/src/pages/two-factor/verify.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/two-factor/verify";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/auth/src/pages/verify.tsx b/web/apps/auth/src/pages/verify.tsx
index 64aeb883a9..c778bab6e8 100644
--- a/web/apps/auth/src/pages/verify.tsx
+++ b/web/apps/auth/src/pages/verify.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/verify";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/components/AuthenticateUserModal.tsx b/web/apps/photos/src/components/AuthenticateUserModal.tsx
index 71d8871a35..53d3d8f1d7 100644
--- a/web/apps/photos/src/components/AuthenticateUserModal.tsx
+++ b/web/apps/photos/src/components/AuthenticateUserModal.tsx
@@ -1,5 +1,6 @@
import { checkSessionValidity } from "@/accounts/services/session";
import log from "@/base/log";
+import { AppContext } from "@/new/photos/types/context";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
import VerifyMasterPasswordForm, {
@@ -8,7 +9,6 @@ import VerifyMasterPasswordForm, {
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
import type { KeyAttributes, User } from "@ente/shared/user/types";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { useCallback, useContext, useEffect, useState } from "react";
interface Iprops {
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
index 093fcc9273..02a17102a9 100644
--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
@@ -12,6 +12,7 @@ import type {
CollectionSummary,
CollectionSummaryType,
} from "@/new/photos/services/collection/ui";
+import { AppContext } from "@/new/photos/types/context";
import { HorizontalFlex } from "@ente/shared/components/Container";
import OverflowMenu, {
StyledMenu,
@@ -36,7 +37,6 @@ import { Box, IconButton, Stack, Tooltip } from "@mui/material";
import { SetCollectionNamerAttributes } from "components/Collections/CollectionNamer";
import { UnPinIcon } from "components/icons/UnPinIcon";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import React, { useCallback, useContext, useRef, useState } from "react";
import { Trans } from "react-i18next";
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageEmailShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageEmailShare.tsx
index 6ebcfce510..caf6e732a5 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageEmailShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageEmailShare.tsx
@@ -10,6 +10,7 @@ import {
type Collection,
type CollectionUser,
} from "@/media/collection";
+import { AppContext } from "@/new/photos/types/context";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import Add from "@mui/icons-material/Add";
import AdminPanelSettingsIcon from "@mui/icons-material/AdminPanelSettings";
@@ -19,7 +20,6 @@ import Photo from "@mui/icons-material/Photo";
import { DialogProps, Stack } from "@mui/material";
import Avatar from "components/pages/gallery/Avatar";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import { useContext, useRef, useState } from "react";
import { unshareCollection } from "services/collectionService";
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx
index f448af9102..bfad20b504 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx
@@ -3,6 +3,7 @@ import { MenuItemDivider, MenuItemGroup } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
import log from "@/base/log";
import type { Collection, CollectionUser } from "@/media/collection";
+import { AppContext } from "@/new/photos/types/context";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import BlockIcon from "@mui/icons-material/Block";
import DoneIcon from "@mui/icons-material/Done";
@@ -10,7 +11,6 @@ import ModeEditIcon from "@mui/icons-material/ModeEdit";
import PhotoIcon from "@mui/icons-material/Photo";
import { DialogProps, Stack, Typography } from "@mui/material";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import { useContext } from "react";
import { Trans } from "react-i18next";
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/downloadAccess.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/downloadAccess.tsx
index a1b759a491..9082e9e838 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/downloadAccess.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/downloadAccess.tsx
@@ -3,9 +3,9 @@ import type {
PublicURL,
UpdatePublicURL,
} from "@/media/collection";
+import { AppContext } from "@/new/photos/types/context";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { useContext } from "react";
import { Trans } from "react-i18next";
interface Iprops {
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/index.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/index.tsx
index 5c9855bdee..a808c7f429 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/index.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/index.tsx
@@ -3,9 +3,9 @@ import type {
PublicURL,
UpdatePublicURL,
} from "@/media/collection";
+import { AppContext } from "@/new/photos/types/context";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { useContext, useState } from "react";
import { PublicLinkSetPassword } from "./setPassword";
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index 6bcfc62e0e..d69e80ab90 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -13,6 +13,7 @@ import {
type CollectionsSortBy,
type CollectionSummaries,
} from "@/new/photos/services/collection/ui";
+import { AppContext } from "@/new/photos/types/context";
import { includes } from "@/utils/type-guards";
import {
getData,
@@ -23,7 +24,6 @@ import AllCollections from "components/Collections/AllCollections";
import { SetCollectionNamerAttributes } from "components/Collections/CollectionNamer";
import CollectionShare from "components/Collections/CollectionShare";
import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
-import { AppContext } from "pages/_app";
import React, {
useCallback,
useContext,
diff --git a/web/apps/photos/src/components/DeleteAccountModal.tsx b/web/apps/photos/src/components/DeleteAccountModal.tsx
index d279395759..3b3ec7b513 100644
--- a/web/apps/photos/src/components/DeleteAccountModal.tsx
+++ b/web/apps/photos/src/components/DeleteAccountModal.tsx
@@ -1,12 +1,12 @@
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import { LoadingButton } from "@/base/components/mui/LoadingButton";
import log from "@/base/log";
+import { AppContext } from "@/new/photos/types/context";
import { initiateEmail } from "@/new/photos/utils/web";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
import { Link, Stack, useMediaQuery } from "@mui/material";
import { Formik, type FormikHelpers } from "formik";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import { useContext, useRef, useState } from "react";
import { Trans } from "react-i18next";
diff --git a/web/apps/photos/src/components/ExportModal.tsx b/web/apps/photos/src/components/ExportModal.tsx
index 56ba64cd12..b8cf25b56b 100644
--- a/web/apps/photos/src/components/ExportModal.tsx
+++ b/web/apps/photos/src/components/ExportModal.tsx
@@ -1,5 +1,6 @@
import { EnteSwitch } from "@/base/components/EnteSwitch";
import log from "@/base/log";
+import { AppContext } from "@/new/photos/types/context";
import { EnteFile } from "@/new/photos/types/file";
import ChangeDirectoryOption from "@ente/shared/components/ChangeDirectoryOption";
import {
@@ -18,7 +19,6 @@ import {
} from "@mui/material";
import { t } from "i18next";
import isElectron from "is-electron";
-import { AppContext } from "pages/_app";
import { useContext, useEffect, useState } from "react";
import exportService, {
ExportStage,
diff --git a/web/apps/photos/src/components/FilesDownloadProgress.tsx b/web/apps/photos/src/components/FilesDownloadProgress.tsx
index bcbb4c2bf0..86e5e0508c 100644
--- a/web/apps/photos/src/components/FilesDownloadProgress.tsx
+++ b/web/apps/photos/src/components/FilesDownloadProgress.tsx
@@ -1,6 +1,6 @@
+import { AppContext } from "@/new/photos/types/context";
import Notification from "components/Notification";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import { useContext } from "react";
diff --git a/web/apps/photos/src/components/FullScreenDropZone.tsx b/web/apps/photos/src/components/FullScreenDropZone.tsx
index 8e6a564b71..9de95d8f5c 100644
--- a/web/apps/photos/src/components/FullScreenDropZone.tsx
+++ b/web/apps/photos/src/components/FullScreenDropZone.tsx
@@ -1,7 +1,7 @@
+import { AppContext } from "@/new/photos/types/context";
import CloseIcon from "@mui/icons-material/Close";
import { styled } from "@mui/material";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import React, { useContext, useEffect, useState } from "react";
const CloseButtonWrapper = styled("div")`
diff --git a/web/apps/photos/src/components/MemberSubscriptionManage.tsx b/web/apps/photos/src/components/MemberSubscriptionManage.tsx
index 86af6223a6..71235e468f 100644
--- a/web/apps/photos/src/components/MemberSubscriptionManage.tsx
+++ b/web/apps/photos/src/components/MemberSubscriptionManage.tsx
@@ -1,4 +1,5 @@
import { useIsMobileWidth } from "@/base/hooks";
+import { AppContext } from "@/new/photos/types/context";
import {
FlexWrapper,
VerticallyCentered,
@@ -6,7 +7,6 @@ import {
import DialogTitleWithCloseButton from "@ente/shared/components/DialogBox/TitleWithCloseButton";
import { Box, Button, Dialog, DialogContent, Typography } from "@mui/material";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { useContext } from "react";
import billingService from "services/billingService";
import { getFamilyPlanAdmin } from "utils/user/family";
diff --git a/web/apps/photos/src/components/Notification.tsx b/web/apps/photos/src/components/Notification.tsx
index bf059c04af..9d0c703eb2 100644
--- a/web/apps/photos/src/components/Notification.tsx
+++ b/web/apps/photos/src/components/Notification.tsx
@@ -1,5 +1,6 @@
import { EllipsizedTypography } from "@/base/components/Typography";
import { FilledIconButton } from "@/new/photos/components/mui";
+import { NotificationAttributes } from "@/new/photos/types/notification";
import CloseIcon from "@mui/icons-material/Close";
import InfoIcon from "@mui/icons-material/InfoOutlined";
import {
@@ -11,7 +12,6 @@ import {
Theme,
type ButtonProps,
} from "@mui/material";
-import { NotificationAttributes } from "types/Notification";
interface Iprops {
open: boolean;
diff --git a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx
index 97869c4467..83938ab273 100644
--- a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx
@@ -26,6 +26,7 @@ import {
isMLEnabled,
type AnnotatedFaceID,
} from "@/new/photos/services/ml";
+import { AppContext } from "@/new/photos/types/context";
import { EnteFile } from "@/new/photos/types/file";
import { formattedByteSize } from "@/new/photos/utils/units";
import CopyButton from "@ente/shared/components/CodeBlock/CopyButton";
@@ -50,7 +51,6 @@ import {
import { Chip } from "components/Chip";
import LinkButton from "components/pages/gallery/LinkButton";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import React, { useContext, useEffect, useMemo, useState } from "react";
import { changeFileName, updateExistingFilePubMetadata } from "utils/file";
diff --git a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
index a1c62ac86c..7be07c08e4 100644
--- a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
@@ -7,6 +7,7 @@ import {
import { nameAndExtension } from "@/base/file";
import log from "@/base/log";
import downloadManager from "@/new/photos/services/download";
+import { AppContext } from "@/new/photos/types/context";
import { EnteFile } from "@/new/photos/types/file";
import { ensure } from "@/utils/ensure";
import {
@@ -33,7 +34,6 @@ import {
Typography,
} from "@mui/material";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
import { createContext, useContext, useEffect, useRef, useState } from "react";
import { getLocalCollections } from "services/collectionService";
diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsx
index 4f613dd1d0..cfedb188eb 100644
--- a/web/apps/photos/src/components/PhotoViewer/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx
@@ -20,6 +20,7 @@ import { FileType } from "@/media/file-type";
import { isHEICExtension, needsJPEGConversion } from "@/media/formats";
import downloadManager from "@/new/photos/services/download";
import { extractRawExif, parseExif } from "@/new/photos/services/exif";
+import { AppContext } from "@/new/photos/types/context";
import type { LoadedLivePhotoSourceURL } from "@/new/photos/types/file";
import { fileLogID } from "@/new/photos/utils/file";
import { FlexWrapper } from "@ente/shared/components/Container";
@@ -41,7 +42,6 @@ import ZoomInOutlinedIcon from "@mui/icons-material/ZoomInOutlined";
import { Box, Button, styled } from "@mui/material";
import { t } from "i18next";
import isElectron from "is-electron";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import { trashFiles } from "services/fileService";
import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";
diff --git a/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx b/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx
index d407d78f01..2b3e3e6076 100644
--- a/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx
+++ b/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx
@@ -1,10 +1,10 @@
import { EnteDrawer } from "@/base/components/EnteDrawer";
import { MenuItemGroup, MenuSectionTitle } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
+import { AppContext } from "@/new/photos/types/context";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import { Box, DialogProps, Stack } from "@mui/material";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import React, { useContext } from "react";
import type { SettingsDrawerProps } from "./types";
diff --git a/web/apps/photos/src/components/Sidebar/MapSetting.tsx b/web/apps/photos/src/components/Sidebar/MapSetting.tsx
index 14817724bb..c7206eabe4 100644
--- a/web/apps/photos/src/components/Sidebar/MapSetting.tsx
+++ b/web/apps/photos/src/components/Sidebar/MapSetting.tsx
@@ -2,6 +2,7 @@ import { EnteDrawer } from "@/base/components/EnteDrawer";
import { MenuItemGroup } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
import log from "@/base/log";
+import { AppContext } from "@/new/photos/types/context";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import {
Box,
@@ -12,7 +13,6 @@ import {
Typography,
} from "@mui/material";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import React, { useContext, useEffect, useState } from "react";
import { Trans } from "react-i18next";
import { getMapEnabledStatus } from "services/userService";
diff --git a/web/apps/photos/src/components/Sidebar/Preferences.tsx b/web/apps/photos/src/components/Sidebar/Preferences.tsx
index 81cd1f9482..eeb7687732 100644
--- a/web/apps/photos/src/components/Sidebar/Preferences.tsx
+++ b/web/apps/photos/src/components/Sidebar/Preferences.tsx
@@ -9,13 +9,13 @@ import {
} from "@/base/i18n";
import { MLSettings } from "@/new/photos/components/MLSettings";
import { isMLSupported } from "@/new/photos/services/ml";
+import { AppContext } from "@/new/photos/types/context";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import ChevronRight from "@mui/icons-material/ChevronRight";
import ScienceIcon from "@mui/icons-material/Science";
import { Box, DialogProps, Stack } from "@mui/material";
import DropdownInput from "components/DropdownInput";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import React, { useContext, useState } from "react";
import { AdvancedSettings } from "./AdvancedSettings";
import { MapSettings } from "./MapSetting";
diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx
index 51fb9d3eee..ca4fad9fa7 100644
--- a/web/apps/photos/src/components/Sidebar/index.tsx
+++ b/web/apps/photos/src/components/Sidebar/index.tsx
@@ -7,6 +7,7 @@ import log from "@/base/log";
import { savedLogs } from "@/base/log-web";
import { customAPIHost } from "@/base/origins";
import type { CollectionSummaries } from "@/new/photos/services/collection/ui";
+import { AppContext } from "@/new/photos/types/context";
import { initiateEmail, openURL } from "@/new/photos/utils/web";
import { SpaceBetweenFlex } from "@ente/shared/components/Container";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
@@ -44,7 +45,6 @@ import LinkButton from "components/pages/gallery/LinkButton";
import { t } from "i18next";
import isElectron from "is-electron";
import { useRouter } from "next/router";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import React, {
MouseEventHandler,
diff --git a/web/apps/photos/src/components/TwoFactor/Modal/Manage.tsx b/web/apps/photos/src/components/TwoFactor/Modal/Manage.tsx
index dafbcb96f7..241164653f 100644
--- a/web/apps/photos/src/components/TwoFactor/Modal/Manage.tsx
+++ b/web/apps/photos/src/components/TwoFactor/Modal/Manage.tsx
@@ -2,11 +2,11 @@ import { t } from "i18next";
import { useContext } from "react";
import { disableTwoFactor } from "@/accounts/api/user";
+import { AppContext } from "@/new/photos/types/context";
import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages";
import { LS_KEYS, getData, setLSUser } from "@ente/shared/storage/localStorage";
import { Button, Grid } from "@mui/material";
import router from "next/router";
-import { AppContext } from "pages/_app";
interface Iprops {
closeDialog: () => void;
diff --git a/web/apps/photos/src/components/Upload/UploadProgress/index.tsx b/web/apps/photos/src/components/Upload/UploadProgress/index.tsx
index a2259c9c2a..4dcb6ec04e 100644
--- a/web/apps/photos/src/components/Upload/UploadProgress/index.tsx
+++ b/web/apps/photos/src/components/Upload/UploadProgress/index.tsx
@@ -1,6 +1,6 @@
import { UPLOAD_STAGES } from "@/new/photos/services/upload/types";
+import { AppContext } from "@/new/photos/types/context";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { useContext, useEffect, useState } from "react";
import type {
InProgressUpload,
diff --git a/web/apps/photos/src/components/Upload/Uploader.tsx b/web/apps/photos/src/components/Upload/Uploader.tsx
index 1beeeba4df..b7c30ff0b7 100644
--- a/web/apps/photos/src/components/Upload/Uploader.tsx
+++ b/web/apps/photos/src/components/Upload/Uploader.tsx
@@ -10,6 +10,8 @@ import type {
UploadItem,
} from "@/new/photos/services/upload/types";
import { UPLOAD_STAGES } from "@/new/photos/services/upload/types";
+import { AppContext } from "@/new/photos/types/context";
+import { NotificationAttributes } from "@/new/photos/types/notification";
import { firstNonEmpty } from "@/utils/array";
import { ensure } from "@/utils/ensure";
import { CustomError } from "@ente/shared/error";
@@ -17,7 +19,6 @@ import DiscFullIcon from "@mui/icons-material/DiscFull";
import UserNameInputDialog from "components/UserNameInputDialog";
import { t } from "i18next";
import isElectron from "is-electron";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import { useContext, useEffect, useRef, useState } from "react";
import billingService from "services/billingService";
@@ -37,7 +38,6 @@ import type {
import uploadManager from "services/upload/uploadManager";
import watcher from "services/watch";
import { SetCollections, SetFiles, SetLoading } from "types/gallery";
-import { NotificationAttributes } from "types/Notification";
import { getOrCreateAlbum } from "utils/collection";
import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery";
import {
diff --git a/web/apps/photos/src/components/WatchFolder.tsx b/web/apps/photos/src/components/WatchFolder.tsx
index 175d3116f0..6afdce67f9 100644
--- a/web/apps/photos/src/components/WatchFolder.tsx
+++ b/web/apps/photos/src/components/WatchFolder.tsx
@@ -3,6 +3,7 @@ import { ensureElectron } from "@/base/electron";
import { basename, dirname } from "@/base/file";
import type { CollectionMapping, FolderWatch } from "@/base/types/ipc";
import { CollectionMappingChoiceDialog } from "@/new/photos/components/CollectionMappingChoiceDialog";
+import { AppContext } from "@/new/photos/types/context";
import { ensure } from "@/utils/ensure";
import {
FlexWrapper,
@@ -30,7 +31,6 @@ import {
styled,
} from "@mui/material";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import React, { useContext, useEffect, useState } from "react";
import watcher from "services/watch";
diff --git a/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx
index a325db2d99..e8df62ae89 100644
--- a/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx
+++ b/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx
@@ -1,11 +1,11 @@
import { SelectionBar } from "@/base/components/Navbar";
+import { AppContext } from "@/new/photos/types/context";
import { FluidContainer } from "@ente/shared/components/Container";
import BackButton from "@mui/icons-material/ArrowBackOutlined";
import CloseIcon from "@mui/icons-material/Close";
import DeleteIcon from "@mui/icons-material/Delete";
import { Box, IconButton, Tooltip } from "@mui/material";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { useContext } from "react";
import { formatNumber } from "utils/number/format";
import { getTrashFilesMessage } from "utils/ui";
diff --git a/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx b/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx
index e4aab43f92..1f1fb032c8 100644
--- a/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx
+++ b/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx
@@ -1,4 +1,5 @@
import log from "@/base/log";
+import { AppContext } from "@/new/photos/types/context";
import { bytesInGB, formattedStorageByteSize } from "@/new/photos/utils/units";
import { openURL } from "@/new/photos/utils/web";
import {
@@ -26,7 +27,6 @@ import {
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import { useContext, useEffect, useMemo, useState } from "react";
import { Trans } from "react-i18next";
diff --git a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
index 4fbe1770da..e164f24f80 100644
--- a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
+++ b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
@@ -2,6 +2,7 @@ import { SelectionBar } from "@/base/components/Navbar";
import type { Collection } from "@/media/collection";
import type { CollectionSelectorAttributes } from "@/new/photos/components/CollectionSelector";
import type { GalleryBarMode } from "@/new/photos/components/gallery/BarImpl";
+import { AppContext } from "@/new/photos/types/context";
import { FluidContainer } from "@ente/shared/components/Container";
import ClockIcon from "@mui/icons-material/AccessTime";
import AddIcon from "@mui/icons-material/Add";
@@ -18,7 +19,6 @@ import VisibilityOffOutlined from "@mui/icons-material/VisibilityOffOutlined";
import VisibilityOutlined from "@mui/icons-material/VisibilityOutlined";
import { Box, IconButton, Stack, Tooltip } from "@mui/material";
import { t } from "i18next";
-import { AppContext } from "pages/_app";
import { useContext } from "react";
import {
ALL_SECTION,
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 83f1855a5f..b018b3cb66 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -1,4 +1,3 @@
-import type { AccountsContextT } from "@/accounts/types/context";
import { clientPackageName, staticAppTitle } from "@/base/app";
import { CustomHead } from "@/base/components/Head";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
@@ -13,13 +12,10 @@ import { AppUpdate } from "@/base/types/ipc";
import DownloadManager from "@/new/photos/services/download";
import { runMigrations } from "@/new/photos/services/migrations";
import { initML, isMLSupported } from "@/new/photos/services/ml";
-import { ensure } from "@/utils/ensure";
+import { AppContext } from "@/new/photos/types/context";
import { Overlay } from "@ente/shared/components/Container";
import DialogBox from "@ente/shared/components/DialogBox";
-import {
- DialogBoxAttributes,
- SetDialogBoxAttributes,
-} from "@ente/shared/components/DialogBox/types";
+import { DialogBoxAttributes } from "@ente/shared/components/DialogBox/types";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
import { MessageContainer } from "@ente/shared/components/MessageContainer";
@@ -47,14 +43,7 @@ import isElectron from "is-electron";
import type { AppProps } from "next/app";
import { useRouter } from "next/router";
import "photoswipe/dist/photoswipe.css";
-import {
- createContext,
- useCallback,
- useContext,
- useEffect,
- useRef,
- useState,
-} from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
import LoadingBar from "react-top-loading-bar";
import { resumeExportsIfNeeded } from "services/export";
import { photosLogout } from "services/logout";
@@ -63,44 +52,12 @@ import {
updateMapEnabledStatus,
} from "services/userService";
import "styles/global.css";
-import {
- NotificationAttributes,
- SetNotificationAttributes,
-} from "types/Notification";
+import { NotificationAttributes } from "types/Notification";
import {
getUpdateAvailableForDownloadMessage,
getUpdateReadyToInstallMessage,
} from "utils/ui";
-/**
- * Properties available via {@link AppContext} to the Photos app's React tree.
- */
-type AppContextT = AccountsContextT & {
- mapEnabled: boolean;
- updateMapEnabled: (enabled: boolean) => Promise<void>;
- startLoading: () => void;
- finishLoading: () => void;
- closeMessageDialog: () => void;
- setDialogMessage: SetDialogBoxAttributes;
- setNotificationAttributes: SetNotificationAttributes;
- watchFolderView: boolean;
- setWatchFolderView: (isOpen: boolean) => void;
- watchFolderFiles: FileList;
- setWatchFolderFiles: (files: FileList) => void;
- themeColor: THEME_COLOR;
- setThemeColor: (themeColor: THEME_COLOR) => void;
- somethingWentWrong: () => void;
- onGenericError: (error: unknown) => void;
- isCFProxyDisabled: boolean;
- setIsCFProxyDisabled: (disabled: boolean) => void;
-};
-
-/** The React {@link Context} available to all pages. */
-export const AppContext = createContext<AppContextT | undefined>(undefined);
-
-/** Utility hook to reduce amount of boilerplate in account related pages. */
-export const useAppContext = () => ensure(useContext(AppContext));
-
export default function App({ Component, pageProps }: AppProps) {
const router = useRouter();
const [isI18nReady, setIsI18nReady] = useState<boolean>(false);
diff --git a/web/apps/photos/src/pages/change-email.tsx b/web/apps/photos/src/pages/change-email.tsx
index cef4716203..4961d86590 100644
--- a/web/apps/photos/src/pages/change-email.tsx
+++ b/web/apps/photos/src/pages/change-email.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/change-email";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/change-password.tsx b/web/apps/photos/src/pages/change-password.tsx
index 2232edc6bc..1c137d50ba 100644
--- a/web/apps/photos/src/pages/change-password.tsx
+++ b/web/apps/photos/src/pages/change-password.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/change-password";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/credentials.tsx b/web/apps/photos/src/pages/credentials.tsx
index fa3cc8fad6..a737676b33 100644
--- a/web/apps/photos/src/pages/credentials.tsx
+++ b/web/apps/photos/src/pages/credentials.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/credentials";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/deduplicate.tsx b/web/apps/photos/src/pages/deduplicate.tsx
index c518ed9fa5..feab67f22a 100644
--- a/web/apps/photos/src/pages/deduplicate.tsx
+++ b/web/apps/photos/src/pages/deduplicate.tsx
@@ -1,6 +1,7 @@
import { stashRedirect } from "@/accounts/services/redirect";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { getLocalFiles } from "@/new/photos/services/files";
+import { AppContext } from "@/new/photos/types/context";
import { VerticallyCentered } from "@ente/shared/components/Container";
import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages";
import { ApiError } from "@ente/shared/error";
@@ -13,7 +14,6 @@ import DeduplicateOptions from "components/pages/dedupe/SelectedFileOptions";
import PhotoFrame from "components/PhotoFrame";
import { t } from "i18next";
import { default as Router, default as router } from "next/router";
-import { AppContext } from "pages/_app";
import { createContext, useContext, useEffect, useState } from "react";
import {
getAllLatestCollections,
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 3d5e7a879a..86bd54d7f4 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -35,6 +35,7 @@ import {
setSearchCollectionsAndFiles,
} from "@/new/photos/services/search";
import type { SearchOption } from "@/new/photos/services/search/types";
+import { AppContext } from "@/new/photos/types/context";
import { EnteFile } from "@/new/photos/types/file";
import { mergeMetadata } from "@/new/photos/utils/file";
import { ensure } from "@/utils/ensure";
@@ -93,7 +94,6 @@ import PlanSelector from "components/pages/gallery/PlanSelector";
import SelectedFileOptions from "components/pages/gallery/SelectedFileOptions";
import { t } from "i18next";
import { useRouter } from "next/router";
-import { AppContext } from "pages/_app";
import {
createContext,
useCallback,
diff --git a/web/apps/photos/src/pages/generate.tsx b/web/apps/photos/src/pages/generate.tsx
index a82d0a46f3..244da239bb 100644
--- a/web/apps/photos/src/pages/generate.tsx
+++ b/web/apps/photos/src/pages/generate.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/generate";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index 8a7623d55a..4f33e1a213 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -5,6 +5,7 @@ import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import log from "@/base/log";
import { albumsAppOrigin, customAPIHost } from "@/base/origins";
import { DevSettings } from "@/new/photos/components/DevSettings";
+import { useAppContext } from "@/new/photos/types/context";
import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages";
import { saveKeyInSessionStore } from "@ente/shared/crypto/helpers";
import localForage from "@ente/shared/storage/localForage";
@@ -24,7 +25,6 @@ import { CarouselProvider, DotGroup, Slide, Slider } from "pure-react-carousel";
import "pure-react-carousel/dist/react-carousel.es.css";
import { useCallback, useEffect, useState } from "react";
import { Trans } from "react-i18next";
-import { useAppContext } from "./_app";
export default function LandingPage() {
const { showNavBar, setDialogMessage } = useAppContext();
diff --git a/web/apps/photos/src/pages/login.tsx b/web/apps/photos/src/pages/login.tsx
index a61718a309..ca1a027e86 100644
--- a/web/apps/photos/src/pages/login.tsx
+++ b/web/apps/photos/src/pages/login.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/login";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/passkeys/finish.tsx b/web/apps/photos/src/pages/passkeys/finish.tsx
index e75df9677b..12037f8083 100644
--- a/web/apps/photos/src/pages/passkeys/finish.tsx
+++ b/web/apps/photos/src/pages/passkeys/finish.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/passkeys/finish";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/passkeys/recover.tsx b/web/apps/photos/src/pages/passkeys/recover.tsx
index d7ac1c30df..6584f5bacc 100644
--- a/web/apps/photos/src/pages/passkeys/recover.tsx
+++ b/web/apps/photos/src/pages/passkeys/recover.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/two-factor/recover";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => (
<Page_ appContext={useAppContext()} twoFactorType="passkey" />
diff --git a/web/apps/photos/src/pages/recover.tsx b/web/apps/photos/src/pages/recover.tsx
index 3fb3866a8a..1bb15511cb 100644
--- a/web/apps/photos/src/pages/recover.tsx
+++ b/web/apps/photos/src/pages/recover.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/recover";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 3005c47045..07515c9636 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -12,6 +12,7 @@ import {
import { SpaceBetweenFlex } from "@/new/photos/components/mui";
import downloadManager from "@/new/photos/services/download";
import { sortFiles } from "@/new/photos/services/files";
+import { AppContext } from "@/new/photos/types/context";
import { EnteFile } from "@/new/photos/types/file";
import { mergeMetadata } from "@/new/photos/utils/file";
import {
@@ -50,7 +51,6 @@ import Uploader from "components/Upload/Uploader";
import { UploadSelectorInputs } from "components/UploadSelectorInputs";
import { t } from "i18next";
import { useRouter } from "next/router";
-import { AppContext } from "pages/_app";
import { useContext, useEffect, useMemo, useRef, useState } from "react";
import { useDropzone } from "react-dropzone";
import {
diff --git a/web/apps/photos/src/pages/signup.tsx b/web/apps/photos/src/pages/signup.tsx
index 37386b9b4e..99eae32ae0 100644
--- a/web/apps/photos/src/pages/signup.tsx
+++ b/web/apps/photos/src/pages/signup.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/signup";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/two-factor/recover.tsx b/web/apps/photos/src/pages/two-factor/recover.tsx
index 1c36e691ec..effd30bb5b 100644
--- a/web/apps/photos/src/pages/two-factor/recover.tsx
+++ b/web/apps/photos/src/pages/two-factor/recover.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/two-factor/recover";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} twoFactorType="totp" />;
diff --git a/web/apps/photos/src/pages/two-factor/setup.tsx b/web/apps/photos/src/pages/two-factor/setup.tsx
index 404fbb271a..0321f392ad 100644
--- a/web/apps/photos/src/pages/two-factor/setup.tsx
+++ b/web/apps/photos/src/pages/two-factor/setup.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/two-factor/setup";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/two-factor/verify.tsx b/web/apps/photos/src/pages/two-factor/verify.tsx
index b6fc679f8c..f6c9b6a494 100644
--- a/web/apps/photos/src/pages/two-factor/verify.tsx
+++ b/web/apps/photos/src/pages/two-factor/verify.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/two-factor/verify";
-import { useAppContext } from "../_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/apps/photos/src/pages/verify.tsx b/web/apps/photos/src/pages/verify.tsx
index 64aeb883a9..c778bab6e8 100644
--- a/web/apps/photos/src/pages/verify.tsx
+++ b/web/apps/photos/src/pages/verify.tsx
@@ -1,5 +1,5 @@
import Page_ from "@/accounts/pages/verify";
-import { useAppContext } from "./_app";
+import { useAppContext } from "@/new/photos/types/context";
const Page = () => <Page_ appContext={useAppContext()} />;
diff --git a/web/packages/new/photos/types/context.ts b/web/packages/new/photos/types/context.ts
index e699a14fc9..f0a3e08feb 100644
--- a/web/packages/new/photos/types/context.ts
+++ b/web/packages/new/photos/types/context.ts
@@ -1,4 +1,10 @@
+import type { AccountsContextT } from "@/accounts/types/context";
+import { ensure } from "@/utils/ensure";
+import type { SetDialogBoxAttributes } from "@ente/shared/components/DialogBox/types";
import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
+import { THEME_COLOR } from "@ente/shared/themes/constants";
+import { createContext, useContext } from "react";
+import type { SetNotificationAttributes } from "./notification";
/**
* A subset of the AppContext type used by the photos app.
@@ -17,3 +23,46 @@ export interface NewAppContextPhotos {
somethingWentWrong: () => void;
onGenericError: (error: unknown) => void;
}
+
+/**
+ * The type of the React context available to all pages in the photos app.
+ */
+type AppContextT = AccountsContextT & {
+ /**
+ * Show the global activity indicator (a green bar at the top of the page).
+ */
+ startLoading: () => void;
+ /**
+ * Hide the global activity indicator.
+ */
+ finishLoading: () => void;
+ somethingWentWrong: () => void;
+ setDialogMessage: SetDialogBoxAttributes;
+ setNotificationAttributes: SetNotificationAttributes;
+ onGenericError: (error: unknown) => void;
+ closeMessageDialog: () => void;
+ mapEnabled: boolean;
+ updateMapEnabled: (enabled: boolean) => Promise<void>;
+ watchFolderView: boolean;
+ setWatchFolderView: (isOpen: boolean) => void;
+ watchFolderFiles: FileList;
+ setWatchFolderFiles: (files: FileList) => void;
+ themeColor: THEME_COLOR;
+ setThemeColor: (themeColor: THEME_COLOR) => void;
+ isCFProxyDisabled: boolean;
+ setIsCFProxyDisabled: (disabled: boolean) => void;
+};
+
+/**
+ * The React {@link Context} available to all nodes in the React tree.
+ */
+export const AppContext = createContext<AppContextT | undefined>(undefined);
+
+/**
+ * Utility hook to get the photos {@link AppContextT}, throwing an exception if
+ * it is not defined.
+ *
+ * This context is provided at the top level _app component for the photos app,
+ * and thus is available to all React components in the Photos app's React tree.
+ */
+export const useAppContext = (): AppContextT => ensure(useContext(AppContext));
diff --git a/web/packages/new/photos/types/notification.tsx b/web/packages/new/photos/types/notification.tsx
new file mode 100644
index 0000000000..43ea111911
--- /dev/null
+++ b/web/packages/new/photos/types/notification.tsx
@@ -0,0 +1,32 @@
+import type { ButtonProps } from "@mui/material/Button";
+import type { ReactNode } from "react";
+
+export type NotificationAttributes =
+ | MessageSubTextNotificationAttributes
+ | TitleCaptionNotificationAttributes;
+
+interface MessageSubTextNotificationAttributes {
+ startIcon?: ReactNode;
+ variant: ButtonProps["color"];
+ message?: JSX.Element | string;
+ subtext?: JSX.Element | string;
+ title?: never;
+ caption?: never;
+ onClick: () => void;
+ endIcon?: ReactNode;
+}
+
+interface TitleCaptionNotificationAttributes {
+ startIcon?: ReactNode;
+ variant: ButtonProps["color"];
+ title?: JSX.Element | string;
+ caption?: JSX.Element | string;
+ message?: never;
+ subtext?: never;
+ onClick: () => void;
+ endIcon?: ReactNode;
+}
+
+export type SetNotificationAttributes = React.Dispatch<
+ React.SetStateAction<NotificationAttributes>
+>;