wip Ungloblicate

This commit is contained in:
Manav Rathi
2025-01-10 08:13:38 +05:30
parent c9b0b1ceea
commit b921ca7493
3 changed files with 5 additions and 14 deletions

View File

@@ -2,7 +2,6 @@ import { staticAppTitle } from "@/base/app";
import { CustomHead } from "@/base/components/Head";
import { LoadingOverlay } from "@/base/components/LoadingOverlay";
import { AttributedMiniDialog } from "@/base/components/MiniDialog";
import { AppNavbar } from "@/base/components/Navbar";
import { useAttributedMiniDialog } from "@/base/components/utils/dialog";
import { useSetupI18n } from "@/base/components/utils/hooks-i18n";
import { getTheme, THEME_COLOR } from "@/base/components/utils/theme";
@@ -13,14 +12,12 @@ import { CssBaseline } from "@mui/material";
import { ThemeProvider } from "@mui/material/styles";
import { t } from "i18next";
import type { AppProps } from "next/app";
import React, { useEffect, useMemo, useState } from "react";
import React, { useEffect, useMemo } from "react";
import { AppContext } from "../types/context";
import "styles/global.css";
const App: React.FC<AppProps> = ({ Component, pageProps }) => {
const [showNavbar, setShowNavbar] = useState(false);
const isI18nReady = useSetupI18n();
const { showMiniDialog, miniDialogProps } = useAttributedMiniDialog();
@@ -32,7 +29,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
const appContext = useMemo(
() => ({
showNavBar: setShowNavbar,
showMiniDialog,
}),
[showMiniDialog],
@@ -50,7 +46,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
<AppContext.Provider value={appContext}>
{!isI18nReady && <LoadingOverlay />}
{showNavbar && <AppNavbar />}
{isI18nReady && <Component {...pageProps} />}
</AppContext.Provider>
</ThemeProvider>

View File

@@ -1,6 +1,7 @@
import { FormPaper } from "@/base/components/FormPaper";
import { MenuItemDivider, MenuItemGroup } from "@/base/components/Menu";
import { SidebarDrawer } from "@/base/components/mui/SidebarDrawer";
import { AppNavbar } from "@/base/components/Navbar";
import { SingleInputDialog } from "@/base/components/SingleInputDialog";
import { Titlebar } from "@/base/components/Titlebar";
import { errorDialogAttributes } from "@/base/components/utils/dialog";
@@ -28,7 +29,7 @@ import {
import { useAppContext } from "../../types/context";
const Page: React.FC = () => {
const { showNavBar, showMiniDialog } = useAppContext();
const { showMiniDialog } = useAppContext();
const [token, setToken] = useState<string | undefined>();
const [passkeys, setPasskeys] = useState<Passkey[]>([]);
@@ -42,8 +43,6 @@ const Page: React.FC = () => {
}, [showMiniDialog]);
useEffect(() => {
showNavBar(true);
const urlParams = new URLSearchParams(window.location.search);
const token = urlParams.get("token");
@@ -53,7 +52,7 @@ const Page: React.FC = () => {
log.error("Missing accounts token");
showPasskeyFetchFailedErrorDialog();
}
}, [showNavBar, showPasskeyFetchFailedErrorDialog]);
}, [showPasskeyFetchFailedErrorDialog]);
const refreshPasskeys = useCallback(async () => {
try {
@@ -116,6 +115,7 @@ const Page: React.FC = () => {
return (
<>
<AppNavbar />
<CenteredFlex>
<Box sx={{ maxWidth: "20rem" }}>
<Box sx={{ marginBottom: "1rem" }}>

View File

@@ -9,10 +9,6 @@ export interface AccountsContextT {
* Perform the (possibly app specific) logout sequence.
*/
logout: () => void;
/**
* Show or hide the app's navigation bar.
*/
showNavBar: (show: boolean) => void;
/**
* Show a "mini dialog" with the given attributes.
*