got new theme system to work without re-rendering

This commit is contained in:
Carter 2025-04-14 16:25:33 -06:00
parent a452cf9444
commit 3454d16f36
12 changed files with 100 additions and 361 deletions

View file

@ -10,7 +10,6 @@ import {
import { usePrevious } from "hooks";
import BindaptIcon from "products/Bindapt/BindaptIcon";
import BinsIcon from "products/Bindapt/BinsIcon";
import VentilationIcon from "products/ventilation/VentilationIcon";
import { useGlobalState } from "providers";
import { useCallback, useEffect, useState } from "react";
import { useNavigate, useLocation } from "react-router-dom";

View file

@ -1,22 +1,12 @@
import React, { PropsWithChildren } from "react";
import Router from "./Router";
interface Props extends PropsWithChildren {
toggleTheme: () => void;
// teams: Team[];
// setTeams: React.Dispatch<React.SetStateAction<Team[]>>;
}
export default function NavigationContainer(props: Props) {
// const { toggleTheme, teams, setTeams } = props;
const { toggleTheme } = props;
export default function NavigationContainer() {
return (
<React.Fragment>
{/* <NotificationBanner /> */}
<Router
toggleTheme={toggleTheme}
/>
<Router />
</React.Fragment>
);
}

View file

@ -37,19 +37,13 @@ const BinCableEstimator = lazy(() => import("pages/BinCableEstimator"));
const APIDocs = lazy(() => import("pages/APIDocs"));
const Fields = lazy(()=> import("pages/Fields"));
const Marketplace = lazy(() => import("userFeatures/UserFeatures"))
interface Props {
toggleTheme: () => void;
}
export const appendToUrl = (appendage: number | string) => {
const basePath = location.pathname.replace(/\/$/, "");
return(`${basePath}/${appendage}`);
};
export default function Router(props: Props) {
export default function Router() {
const { toggleTheme } = props;
const { isAuthenticated, loginWithRedirect, isLoading } = useAuth0();
const whiteLabel = getWhitelabel();
const [{ user }] = useGlobalState();
@ -290,11 +284,7 @@ export default function Router(props: Props) {
return (
<Suspense fallback={<LoadingScreen />}>
<BrowserRouter>
<Header
toggleTheme={toggleTheme}
// teams={teams}
// setTeams={setTeams}
/>
<Header />
<Routes>
{/* Redirects */}