Skip to content

armgit / ente

Public Imported from GitHub
0

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

Prune

Manav Rathi92a9698df515
diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx
index 103a92c2f1..d7203ba239 100644
--- a/web/apps/accounts/src/pages/_app.tsx
+++ b/web/apps/accounts/src/pages/_app.tsx
@@ -13,7 +13,6 @@ import { ThemeProvider } from "@mui/material/styles";
import { t } from "i18next";
import type { AppProps } from "next/app";
import React, { useCallback, useMemo } from "react";
-import { AppContext } from "../types/context";
const App: React.FC<AppProps> = ({ Component, pageProps }) => {
useSetupLogs({ disableDiskLogs: true });
@@ -33,7 +32,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
() => ({ logout, showMiniDialog }),
[logout, showMiniDialog],
);
- const appContext = useMemo(() => ({ showMiniDialog }), [showMiniDialog]);
const title = isI18nReady ? t("title_accounts") : staticAppTitle;
@@ -44,10 +42,8 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
<AttributedMiniDialog {...miniDialogProps} />
<BaseContext value={baseContext}>
- <AppContext.Provider value={appContext}>
- {!isI18nReady && <LoadingIndicator />}
- {isI18nReady && <Component {...pageProps} />}
- </AppContext.Provider>
+ {!isI18nReady && <LoadingIndicator />}
+ {isI18nReady && <Component {...pageProps} />}
</BaseContext>
</ThemeProvider>
);
diff --git a/web/apps/accounts/src/types/context.ts b/web/apps/accounts/src/types/context.ts
deleted file mode 100644
index d18bda6e9f..0000000000
--- a/web/apps/accounts/src/types/context.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { BaseContextT } from "@/base/context";
-import { createContext, useContext } from "react";
-
-/**
- * The type of the context for pages in the accounts app.
- */
-type AppContextT = Omit<BaseContextT, "logout">;
-
-/**
- * The React {@link Context} available to all nodes in the React tree.
- */
-export const AppContext = createContext<AppContextT | undefined>(undefined);
-
-/**
- * Utility hook to get the {@link AppContextT} expected to be available to all
- * React components in the Accounts app's React tree.
- */
-export const useAppContext = (): AppContextT => useContext(AppContext)!;
diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx
index 55af8d5d7c..fb135bde64 100644
--- a/web/apps/auth/src/pages/_app.tsx
+++ b/web/apps/auth/src/pages/_app.tsx
@@ -24,7 +24,6 @@ import { ThemeProvider } from "@mui/material/styles";
import { t } from "i18next";
import type { AppProps } from "next/app";
import React, { useCallback, useEffect, useMemo } from "react";
-import { AppContext } from "types/context";
const App: React.FC<AppProps> = ({ Component, pageProps }) => {
useSetupLogs();
@@ -48,14 +47,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
[logout, showMiniDialog],
);
- const appContext = useMemo(
- () => ({
- logout,
- showMiniDialog,
- }),
- [logout, showMiniDialog],
- );
-
const title = isI18nReady ? t("title_auth") : staticAppTitle;
return (
@@ -65,16 +56,14 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
<AttributedMiniDialog {...miniDialogProps} />
<BaseContext value={baseContext}>
- <AppContext.Provider value={appContext}>
- {!isI18nReady ? (
- <LoadingIndicator />
- ) : (
- <>
- {isChangingRoute && <TranslucentLoadingOverlay />}
- <Component {...pageProps} />
- </>
- )}
- </AppContext.Provider>
+ {!isI18nReady ? (
+ <LoadingIndicator />
+ ) : (
+ <>
+ {isChangingRoute && <TranslucentLoadingOverlay />}
+ <Component {...pageProps} />
+ </>
+ )}
</BaseContext>
</ThemeProvider>
);
diff --git a/web/apps/auth/src/types/context.ts b/web/apps/auth/src/types/context.ts
deleted file mode 100644
index d1a6eedfc2..0000000000
--- a/web/apps/auth/src/types/context.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import type { BaseContextT } from "@/base/context";
-import { createContext, useContext } from "react";
-
-/**
- * Properties available via {@link AppContext} to the Auth app's React tree.
- */
-type AppContextT = BaseContextT;
-
-/** 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 = () => useContext(AppContext)!;