Skip to content

armgit / ente

Public Imported from GitHub
0

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

Prune

Manav Rathi2b72cd718e5d
diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx
index 770f228a7b..1cf59cbcd6 100644
--- a/web/apps/auth/src/pages/_app.tsx
+++ b/web/apps/auth/src/pages/_app.tsx
@@ -3,7 +3,6 @@ import { clientPackageName, staticAppTitle } from "@/base/app";
import { CustomHead } from "@/base/components/Head";
import { LoadingOverlay } from "@/base/components/loaders";
import { AttributedMiniDialog } from "@/base/components/MiniDialog";
-import { AppNavbar } from "@/base/components/Navbar";
import { useAttributedMiniDialog } from "@/base/components/utils/dialog";
import { useSetupI18n, useSetupLogs } from "@/base/components/utils/hooks-app";
import { THEME_COLOR, getTheme } from "@/base/components/utils/theme";
@@ -32,7 +31,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
const router = useRouter();
const [loading, setLoading] = useState(false);
- const [showNavbar, setShowNavBar] = useState(false);
const isI18nReady = useSetupI18n();
const { showMiniDialog, miniDialogProps } = useAttributedMiniDialog();
@@ -68,7 +66,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
const appContext = useMemo(
() => ({
logout,
- showNavBar: (show: boolean) => setShowNavBar(show),
showMiniDialog,
themeColor,
setThemeColor,
@@ -84,7 +81,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
<ThemeProvider theme={getTheme(themeColor, "auth")}>
<CssBaseline enableColorScheme />
- {showNavbar && <AppNavbar />}
<AttributedMiniDialog {...miniDialogProps} />
diff --git a/web/apps/auth/src/pages/auth.tsx b/web/apps/auth/src/pages/auth.tsx
index 1049f3cc92..3bc77e188b 100644
--- a/web/apps/auth/src/pages/auth.tsx
+++ b/web/apps/auth/src/pages/auth.tsx
@@ -1,7 +1,7 @@
import { sessionExpiredDialogAttributes } from "@/accounts/components/utils/dialog";
import { stashRedirect } from "@/accounts/services/redirect";
import { EnteLogo } from "@/base/components/EnteLogo";
-import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
+import { LoadingIndicator } from "@/base/components/loaders";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import { NavbarBase } from "@/base/components/Navbar";
import {
@@ -11,7 +11,6 @@ import {
import { isHTTP401Error } from "@/base/http";
import log from "@/base/log";
import { masterKeyFromSessionIfLoggedIn } from "@/base/session-store";
-import { VerticallyCentered } from "@ente/shared/components/Container";
import { AUTH_PAGES as PAGES } from "@ente/shared/constants/pages";
import LogoutOutlinedIcon from "@mui/icons-material/LogoutOutlined";
import {
@@ -31,7 +30,7 @@ import { getAuthCodes } from "services/remote";
import { useAppContext } from "types/context";
const Page: React.FC = () => {
- const { logout, showNavBar, showMiniDialog } = useAppContext();
+ const { logout, showMiniDialog } = useAppContext();
const router = useRouter();
const [codes, setCodes] = useState<Code[]>([]);
@@ -57,8 +56,7 @@ const Page: React.FC = () => {
setHasFetched(true);
};
void fetchCodes();
- showNavBar(false);
- }, [router, showNavBar, showMiniDialog, logout]);
+ }, [router, showMiniDialog, logout]);
const lcSearch = searchTerm.toLowerCase();
const filteredCodes = codes.filter(
@@ -68,11 +66,7 @@ const Page: React.FC = () => {
);
if (!hasFetched) {
- return (
- <VerticallyCentered>
- <ActivityIndicator />
- </VerticallyCentered>
- );
+ return <LoadingIndicator />;
}
return (
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 7ec9fb75f3..67f5fb4a4a 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -2,7 +2,6 @@ import { clientPackageName, isDesktop, staticAppTitle } from "@/base/app";
import { CustomHead } from "@/base/components/Head";
import { LoadingOverlay } from "@/base/components/loaders";
import { AttributedMiniDialog } from "@/base/components/MiniDialog";
-import { AppNavbar } from "@/base/components/Navbar";
import {
genericErrorDialogAttributes,
useAttributedMiniDialog,
@@ -53,7 +52,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
const router = useRouter();
const [loading, setLoading] = useState(false);
- const [showNavbar, setShowNavBar] = useState(false);
const [watchFolderView, setWatchFolderView] = useState(false);
const [watchFolderFiles, setWatchFolderFiles] = useState<FileList>(null);
const [notificationView, setNotificationView] = useState(false);
@@ -172,7 +170,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
const appContext = useMemo(
() => ({
- showNavBar: (show: boolean) => setShowNavBar(show),
showLoadingBar,
hideLoadingBar,
watchFolderView,
@@ -206,7 +203,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
<ThemeProvider theme={getTheme(themeColor, "photos")}>
<CssBaseline enableColorScheme />
- {showNavbar && <AppNavbar />}
<OfflineMessageContainer>
{isI18nReady && isOffline && t("offline_message")}
</OfflineMessageContainer>
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 854898c6da..2cfa437bb3 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1,7 +1,7 @@
import { sessionExpiredDialogAttributes } from "@/accounts/components/utils/dialog";
import { stashRedirect } from "@/accounts/services/redirect";
import type { MiniDialogAttributes } from "@/base/components/MiniDialog";
-import { NavbarBase } from "@/base/components/Navbar";
+import { AppNavbar, NavbarBase } from "@/base/components/Navbar";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { errorDialogAttributes } from "@/base/components/utils/dialog";
import { useIsSmallWidth } from "@/base/components/utils/hooks";
@@ -174,7 +174,15 @@ export const GalleryContext = createContext<GalleryContextType>(
* --------------------- |
* Photo List v
*/
-export default function Gallery() {
+const Page: React.FC = () => {
+ const {
+ showLoadingBar,
+ hideLoadingBar,
+ showMiniDialog,
+ onGenericError,
+ logout,
+ } = useAppContext();
+
const [state, dispatch] = useGalleryReducer();
const [isFirstLoad, setIsFirstLoad] = useState(false);
@@ -234,14 +242,6 @@ export default function Gallery() {
undefined,
);
- const {
- showLoadingBar,
- hideLoadingBar,
- showMiniDialog,
- onGenericError,
- logout,
- ...appContext
- } = useAppContext();
const [userIDToEmailMap, setUserIDToEmailMap] =
useState<Map<number, string>>(null);
const [emailList, setEmailList] = useState<string[]>(null);
@@ -338,7 +338,6 @@ export default function Gallery() {
};
useEffect(() => {
- appContext.showNavBar(true);
const key = getKey(SESSION_KEYS.ENCRYPTION_KEY);
const token = getToken();
if (!key || !token) {
@@ -891,6 +890,7 @@ export default function Gallery() {
getZipFileSelectorInputProps,
}}
/>
+ <AppNavbar />
{blockingLoad && (
<GalleryLoadingOverlay>
<ActivityIndicator />
@@ -1130,7 +1130,9 @@ export default function Gallery() {
</FullScreenDropZone>
</GalleryContext.Provider>
);
-}
+};
+
+export default Page;
/**
* Preload all three variants of a responsive image.
diff --git a/web/packages/base/components/Navbar.tsx b/web/packages/base/components/Navbar.tsx
index 88e57ccef3..6bae854a6b 100644
--- a/web/packages/base/components/Navbar.tsx
+++ b/web/packages/base/components/Navbar.tsx
@@ -24,6 +24,7 @@ export const NavbarBase = styled(FlexWrapper)`
}
`;
+// TODO: Prune
export const AppNavbar: React.FC = () => {
return (
<NavbarBase>