diff --git a/frontend/src/components/layout/BackstoryLayout.tsx b/frontend/src/components/layout/BackstoryLayout.tsx index 8dad6f9..8a31a69 100644 --- a/frontend/src/components/layout/BackstoryLayout.tsx +++ b/frontend/src/components/layout/BackstoryLayout.tsx @@ -12,7 +12,7 @@ import { Snack, SetSnackType } from 'components/Snack'; import { User } from 'types/types'; import { LoadingComponent } from "components/LoadingComponent"; import { AuthProvider, useAuth, ProtectedRoute } from 'hooks/AuthContext'; -import { useAppState, useSelectedCandidate } from 'hooks/GlobalContext'; +import { useSelectedCandidate } from 'hooks/GlobalContext'; import { getMainNavigationItems, getAllRoutes, @@ -50,7 +50,7 @@ const BackstoryPageContainer = (props: BackstoryPageContainerProps) => { { interface BackstoryLayoutProps { page: string; chatRef: React.Ref; + snackRef: React.Ref; + submitQuery: any; } const BackstoryLayout: React.FC = (props: BackstoryLayoutProps) => { - const { page, chatRef } = props; - const { setSnack } = useAppState(); + const { page, chatRef, snackRef, submitQuery } = props; const navigate = useNavigate(); const location = useLocation(); const { guest, user } = useAuth(); + const { selectedCandidate } = useSelectedCandidate(); const [navigationItems, setNavigationItems] = useState([]); useEffect(() => { const userType = user?.userType || null; - setNavigationItems(getMainNavigationItems(userType, user?.isAdmin ? true : false)); + setNavigationItems(getMainNavigationItems(userType)); }, [user]); - useEffect(() => { - console.log({ guest, user }); - }, [guest, user]); - // Generate dynamic routes from navigation config const generateRoutes = () => { - if (!guest && !user) return null; + if (!guest) return null; const userType = user?.userType || null; - const isAdmin = user?.isAdmin ? true : false; - - // Get all routes from navigation config - const routes = getAllRoutes(userType, isAdmin); + const routes = getAllRoutes(userType); return routes.map((route, index) => { if (!route.path || !route.component) return null; @@ -129,10 +124,9 @@ const BackstoryLayout: React.FC = (props: BackstoryLayoutP height: "100%", maxHeight: "100%", minHeight: "100%", - flexDirection: "column" + flexDirection: "column" }}> -
= (props: BackstoryLayoutP }} > - {!guest && !user && ( + {!guest && ( = (props: BackstoryLayoutP /> )} - {(guest || user) && ( + {guest && ( <> @@ -185,6 +179,7 @@ const BackstoryLayout: React.FC = (props: BackstoryLayoutP {location.pathname === "/" &&