Temporarily enable dark theme
This commit is contained in:
parent
ea5dd34302
commit
3a0f9c6e48
@ -1,7 +1,10 @@
|
||||
import { ThemeProvider, createTheme } from "@mui/material/styles";
|
||||
import React from "react";
|
||||
import { Route, Routes } from "react-router-dom";
|
||||
import "./App.css";
|
||||
import { AuthApi } from "./api/AuthApi";
|
||||
import { DeleteAccountRoute } from "./routes/DeleteAccountRoute";
|
||||
import { FamiliesListRoute } from "./routes/FamiliesListRoute";
|
||||
import { NotFoundRoute } from "./routes/NotFound";
|
||||
import { ProfileRoute } from "./routes/ProfileRoute";
|
||||
import { LoginRoute } from "./routes/auth/LoginRoute";
|
||||
@ -9,12 +12,10 @@ import { NewAccountRoute } from "./routes/auth/NewAccountRoute";
|
||||
import { OIDCCbRoute } from "./routes/auth/OIDCCbRoute";
|
||||
import { PasswordForgottenRoute } from "./routes/auth/PasswordForgottenRoute";
|
||||
import { ResetPasswordRoute } from "./routes/auth/ResetPasswordRoute";
|
||||
import { BaseAuthenticatedPage } from "./widgets/BaseAuthenticatedPage";
|
||||
import { BaseLoginPage } from "./widgets/BaseLoginpage";
|
||||
import { DeleteAccountRoute } from "./routes/DeleteAccountRoute";
|
||||
import { FamiliesListRoute } from "./routes/FamiliesListRoute";
|
||||
import { BaseFamilyRoute } from "./widgets/BaseFamilyRoute";
|
||||
import { FamilyHomeRoute } from "./routes/family/FamilyHomeRoute";
|
||||
import { BaseAuthenticatedPage } from "./widgets/BaseAuthenticatedPage";
|
||||
import { BaseFamilyRoute } from "./widgets/BaseFamilyRoute";
|
||||
import { BaseLoginPage } from "./widgets/BaseLoginpage";
|
||||
|
||||
interface AuthContext {
|
||||
signedIn: boolean;
|
||||
@ -23,6 +24,12 @@ interface AuthContext {
|
||||
|
||||
const AuthContextK = React.createContext<AuthContext | null>(null);
|
||||
|
||||
const darkTheme = createTheme({
|
||||
palette: {
|
||||
mode: "dark", // TODO : switch back to light
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Core app
|
||||
*/
|
||||
@ -35,35 +42,37 @@ export function App(): React.ReactElement {
|
||||
};
|
||||
|
||||
return (
|
||||
<AuthContextK.Provider value={context}>
|
||||
<Routes>
|
||||
<Route path="delete_account" element={<DeleteAccountRoute />} />
|
||||
<ThemeProvider theme={darkTheme}>
|
||||
<AuthContextK.Provider value={context}>
|
||||
<Routes>
|
||||
<Route path="delete_account" element={<DeleteAccountRoute />} />
|
||||
|
||||
{signedIn ? (
|
||||
<Route path="*" element={<BaseAuthenticatedPage />}>
|
||||
<Route path="" element={<FamiliesListRoute />} />
|
||||
<Route path="profile" element={<ProfileRoute />} />
|
||||
<Route path="family/:familyId/*" element={<BaseFamilyRoute />}>
|
||||
<Route path="" element={<FamilyHomeRoute />} />
|
||||
{signedIn ? (
|
||||
<Route path="*" element={<BaseAuthenticatedPage />}>
|
||||
<Route path="" element={<FamiliesListRoute />} />
|
||||
<Route path="profile" element={<ProfileRoute />} />
|
||||
<Route path="family/:familyId/*" element={<BaseFamilyRoute />}>
|
||||
<Route path="" element={<FamilyHomeRoute />} />
|
||||
<Route path="*" element={<NotFoundRoute />} />
|
||||
</Route>
|
||||
<Route path="*" element={<NotFoundRoute />} />
|
||||
</Route>
|
||||
<Route path="*" element={<NotFoundRoute />} />
|
||||
</Route>
|
||||
) : (
|
||||
<Route path="*" element={<BaseLoginPage />}>
|
||||
<Route path="" element={<LoginRoute />} />
|
||||
<Route path="oidc_cb" element={<OIDCCbRoute />} />
|
||||
<Route path="new-account" element={<NewAccountRoute />} />
|
||||
<Route
|
||||
path="password_forgotten"
|
||||
element={<PasswordForgottenRoute />}
|
||||
/>
|
||||
<Route path="reset_password" element={<ResetPasswordRoute />} />
|
||||
<Route path="*" element={<NotFoundRoute />} />
|
||||
</Route>
|
||||
)}
|
||||
</Routes>
|
||||
</AuthContextK.Provider>
|
||||
) : (
|
||||
<Route path="*" element={<BaseLoginPage />}>
|
||||
<Route path="" element={<LoginRoute />} />
|
||||
<Route path="oidc_cb" element={<OIDCCbRoute />} />
|
||||
<Route path="new-account" element={<NewAccountRoute />} />
|
||||
<Route
|
||||
path="password_forgotten"
|
||||
element={<PasswordForgottenRoute />}
|
||||
/>
|
||||
<Route path="reset_password" element={<ResetPasswordRoute />} />
|
||||
<Route path="*" element={<NotFoundRoute />} />
|
||||
</Route>
|
||||
)}
|
||||
</Routes>
|
||||
</AuthContextK.Provider>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user