Skip to content

Commit

Permalink
Keep the change model only in the /dashboard/ pages
Browse files Browse the repository at this point in the history
Reapply c4b89cd, making sure that the change model button in the navbar only appears in /dashboard/ pages. #2 #4 #12 #23
  • Loading branch information
jared-yu-hcltech committed Sep 17, 2024
1 parent a2b7f80 commit b470162
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/src/layouts/rootLayout/RootLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, Outlet } from 'react-router-dom';
import { Link, Outlet, useLocation } from 'react-router-dom';
import './rootLayout.css';
import { SignedIn, UserButton, ClerkProvider } from "@clerk/clerk-react";
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
Expand All @@ -13,6 +13,9 @@ if (!PUBLISHABLE_KEY) {
const queryClient = new QueryClient();

const RootLayout = () => {
const location = useLocation();
const isDashboardRoute = location.pathname.startsWith("/dashboard");

return (
<ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/">
<QueryClientProvider client={queryClient}>
Expand All @@ -22,7 +25,7 @@ const RootLayout = () => {
<img src='/hcltechicon.png' alt='' />
<span>Gen AI Chatbot</span>
</Link>
<ModelMenu />
{isDashboardRoute && <ModelMenu />}
<div className="user">
<SignedIn>
<UserButton />
Expand Down

0 comments on commit b470162

Please sign in to comment.