Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use theme color

Manav Rathib7841e2aeee9
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 924434d7cd..aef83d26c7 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -12,6 +12,7 @@ import log from "@/base/log";
import { logStartupBanner } from "@/base/log-web";
import { AppUpdate } from "@/base/types/ipc";
import { Notification } from "@/new/photos/components/Notification";
+import { ThemedLoadingBar } from "@/new/photos/components/ThemedLoadingBar";
import {
updateAvailableForDownloadDialogAttributes,
updateReadyToInstallDialogAttributes,
@@ -39,7 +40,6 @@ import type { AppProps } from "next/app";
import { useRouter } from "next/router";
import "photoswipe/dist/photoswipe.css";
import { useCallback, useEffect, useMemo, useState } from "react";
-import LoadingBar from "react-top-loading-bar";
import { resumeExportsIfNeeded } from "services/export";
import { photosLogout } from "services/logout";
@@ -183,7 +183,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
<ThemeProvider theme={photosTheme}>
<CssBaseline enableColorScheme />
- <LoadingBar color="#51cd7c" ref={loadingBarRef} />
+ <ThemedLoadingBar ref={loadingBarRef} />
<AttributedMiniDialog
sx={{ zIndex: photosDialogZIndex }}
diff --git a/web/packages/new/photos/components/ThemedLoadingBar.tsx b/web/packages/new/photos/components/ThemedLoadingBar.tsx
new file mode 100644
index 0000000000..96ad8afbdb
--- /dev/null
+++ b/web/packages/new/photos/components/ThemedLoadingBar.tsx
@@ -0,0 +1,16 @@
+import { useTheme } from "@mui/material";
+import React from "react";
+import LoadingBar, { type LoadingBarRef } from "react-top-loading-bar";
+
+interface ThemedLoadingBarProps {
+ ref: React.Ref<LoadingBarRef>;
+}
+/**
+ * A wrapper over the {@link LoadingBar} library component that sets it to use
+ * the main accent color from the theme.
+ */
+export const ThemedLoadingBar: React.FC<ThemedLoadingBarProps> = ({ ref }) => {
+ const theme = useTheme();
+
+ return <LoadingBar color={theme.vars.palette.accent.main} ref={ref} />;
+};