Temporarily enable dark theme

This commit is contained in:
Pierre HUBERT 2023-07-08 12:51:03 +02:00
parent ea5dd34302
commit 3a0f9c6e48

View File

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