Skip to content

armgit / ente

Public Imported from GitHub
0

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

LO

Manav Rathife9cccd3ab67
diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx
index 400d3616c3..65ead78130 100644
--- a/web/apps/accounts/src/pages/_app.tsx
+++ b/web/apps/accounts/src/pages/_app.tsx
@@ -1,8 +1,7 @@
import { staticAppTitle } from "@/base/app";
import { CustomHead } from "@/base/components/Head";
+import { LoadingOverlay } from "@/base/components/LoadingOverlay";
import { AttributedMiniDialog } from "@/base/components/MiniDialog";
-import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
-import { Overlay } from "@/base/components/mui/Container";
import { AppNavbar } from "@/base/components/Navbar";
import { useAttributedMiniDialog } from "@/base/components/utils/dialog";
import { getTheme, THEME_COLOR } from "@/base/components/utils/theme";
@@ -50,19 +49,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
<AttributedMiniDialog {...miniDialogProps} />
<AppContext.Provider value={appContext}>
- {!isI18nReady && (
- <Overlay
- sx={(theme) => ({
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- zIndex: 2000,
- backgroundColor: theme.colors.background.base,
- })}
- >
- <ActivityIndicator />
- </Overlay>
- )}
+ {!isI18nReady && <LoadingOverlay />}
{showNavbar && <AppNavbar />}
{isI18nReady && <Component {...pageProps} />}
</AppContext.Provider>
diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx
index f719ad301d..70cc79bfcf 100644
--- a/web/apps/auth/src/pages/_app.tsx
+++ b/web/apps/auth/src/pages/_app.tsx
@@ -1,9 +1,8 @@
import { accountLogout } from "@/accounts/services/logout";
import { clientPackageName, staticAppTitle } from "@/base/app";
import { CustomHead } from "@/base/components/Head";
+import { LoadingOverlay } from "@/base/components/LoadingOverlay";
import { AttributedMiniDialog } from "@/base/components/MiniDialog";
-import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
-import { Overlay } from "@/base/components/mui/Container";
import { AppNavbar } from "@/base/components/Navbar";
import { useAttributedMiniDialog } from "@/base/components/utils/dialog";
import { THEME_COLOR, getTheme } from "@/base/components/utils/theme";
@@ -94,22 +93,8 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
<AttributedMiniDialog {...miniDialogProps} />
<AppContext.Provider value={appContext}>
- {(loading || !isI18nReady) && (
- <Overlay
- sx={(theme) => ({
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- zIndex: 2000,
- backgroundColor: theme.colors.background.base,
- })}
- >
- <ActivityIndicator />
- </Overlay>
- )}
- {isI18nReady && (
- <Component setLoading={setLoading} {...pageProps} />
- )}
+ {(loading || !isI18nReady) && <LoadingOverlay />}
+ {isI18nReady && <Component {...pageProps} />}
</AppContext.Provider>
</ThemeProvider>
</>
diff --git a/web/apps/photos/src/components/LoadingOverlay.tsx b/web/apps/photos/src/components/GalleryLoadingOverlay.tsx
similarity index 85%
rename from web/apps/photos/src/components/LoadingOverlay.tsx
rename to web/apps/photos/src/components/GalleryLoadingOverlay.tsx
index 90869c91ae..5a6b3a3427 100644
--- a/web/apps/photos/src/components/LoadingOverlay.tsx
+++ b/web/apps/photos/src/components/GalleryLoadingOverlay.tsx
@@ -1,5 +1,5 @@
import { styled } from "@mui/material";
-export const LoadingOverlay = styled("div")`
+export const GalleryLoadingOverlay = styled("div")`
left: 0;
top: 0;
outline: none;
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 4df9e18abd..c08fd8b0dc 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -1,8 +1,7 @@
import { clientPackageName, isDesktop, staticAppTitle } from "@/base/app";
import { CustomHead } from "@/base/components/Head";
+import { LoadingOverlay } from "@/base/components/LoadingOverlay";
import { AttributedMiniDialog } from "@/base/components/MiniDialog";
-import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
-import { Overlay } from "@/base/components/mui/Container";
import { AppNavbar } from "@/base/components/Navbar";
import {
genericErrorDialogAttributes,
@@ -152,7 +151,7 @@ export default function App({ Component, pageProps }: AppProps) {
});
router.events.on("routeChangeComplete", () => {
- log.debug(() => `Route change took ${Date.now() - t}} ms`);
+ log.debug(() => `Route change took ${Date.now() - t} ms`);
setLoading(false);
});
}, []);
@@ -229,22 +228,8 @@ export default function App({ Component, pageProps }: AppProps) {
/>
<AppContext.Provider value={appContext}>
- {(loading || !isI18nReady) && (
- <Overlay
- sx={(theme) => ({
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- zIndex: 2000,
- backgroundColor: theme.colors.background.base,
- })}
- >
- <ActivityIndicator />
- </Overlay>
- )}
- {isI18nReady && (
- <Component setLoading={setLoading} {...pageProps} />
- )}
+ {(loading || !isI18nReady) && <LoadingOverlay />}
+ {isI18nReady && <Component {...pageProps} />}
</AppContext.Provider>
</ThemeProvider>
</>
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index cd274d7d81..854898c6da 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -97,7 +97,7 @@ import {
import { FixCreationTime } from "components/FixCreationTime";
import FullScreenDropZone from "components/FullScreenDropZone";
import GalleryEmptyState from "components/GalleryEmptyState";
-import { LoadingOverlay } from "components/LoadingOverlay";
+import { GalleryLoadingOverlay } from "components/GalleryLoadingOverlay";
import PhotoFrame from "components/PhotoFrame";
import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
import Sidebar from "components/Sidebar";
@@ -892,9 +892,9 @@ export default function Gallery() {
}}
/>
{blockingLoad && (
- <LoadingOverlay>
+ <GalleryLoadingOverlay>
<ActivityIndicator />
- </LoadingOverlay>
+ </GalleryLoadingOverlay>
)}
{isFirstLoad && (
<CenteredFlex>
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 42db4149e6..c7c081550b 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -52,7 +52,7 @@ import {
FilesDownloadProgressAttributes,
} from "components/FilesDownloadProgress";
import FullScreenDropZone from "components/FullScreenDropZone";
-import { LoadingOverlay } from "components/LoadingOverlay";
+import { GalleryLoadingOverlay } from "components/GalleryLoadingOverlay";
import PhotoFrame from "components/PhotoFrame";
import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
import Uploader from "components/Upload/Uploader";
@@ -520,9 +520,9 @@ export default function PublicCollectionGallery() {
selectable={downloadEnabled}
/>
{blockingLoad && (
- <LoadingOverlay>
+ <GalleryLoadingOverlay>
<ActivityIndicator />
- </LoadingOverlay>
+ </GalleryLoadingOverlay>
)}
<Uploader
syncWithRemote={syncWithRemote}
diff --git a/web/packages/base/components/LoadingOverlay.tsx b/web/packages/base/components/LoadingOverlay.tsx
new file mode 100644
index 0000000000..35d7d3c6ec
--- /dev/null
+++ b/web/packages/base/components/LoadingOverlay.tsx
@@ -0,0 +1,23 @@
+import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
+import { Overlay } from "@/base/components/mui/Container";
+import React from "react";
+
+/**
+ * An opaque overlay that covers the entire viewport and shows an activity
+ * indicator in its center.
+ *
+ * Useful as a top level "blocking" overscreen while the app is being loaded.
+ */
+export const LoadingOverlay: React.FC = () => (
+ <Overlay
+ sx={(theme) => ({
+ display: "flex",
+ justifyContent: "center",
+ alignItems: "center",
+ zIndex: 2000,
+ backgroundColor: theme.colors.background.base,
+ })}
+ >
+ <ActivityIndicator />
+ </Overlay>
+);