diff --git a/frontend/public/eliza.png b/frontend/public/eliza.png new file mode 100755 index 0000000..df80e92 Binary files /dev/null and b/frontend/public/eliza.png differ diff --git a/frontend/src/Components/CopyBubble.tsx b/frontend/src/Components/CopyBubble.tsx index 4e71b5b..d3a2519 100644 --- a/frontend/src/Components/CopyBubble.tsx +++ b/frontend/src/Components/CopyBubble.tsx @@ -9,7 +9,6 @@ interface CopyBubbleProps extends IconButtonProps { content: string | undefined, sx?: SxProps; tooltip?: string; - onClick?: () => void; } const CopyBubble = ({ @@ -21,7 +20,7 @@ const CopyBubble = ({ } : CopyBubbleProps) => { const [copied, setCopied] = useState(false); - const handleCopy = () => { + const handleCopy = (e: any) => { if (content === undefined) { return; } @@ -32,14 +31,14 @@ const CopyBubble = ({ }); if (onClick) { - onClick(); + onClick(e); } }; return ( { handleCopy(e) }} sx={{ width: 24, height: 24, diff --git a/frontend/src/NewApp/BackstoryApp.tsx b/frontend/src/NewApp/BackstoryApp.tsx index a2ffe5b..90575f3 100644 --- a/frontend/src/NewApp/BackstoryApp.tsx +++ b/frontend/src/NewApp/BackstoryApp.tsx @@ -104,6 +104,8 @@ const BackstoryApp = () => { newSessionId = (await response.json()).id; } setSessionId(newSessionId); + setSnack(`${action} session ${newSessionId}`); + // Store in cookie if user opts in if (storeInCookie) { setCookie('session_id', newSessionId); @@ -116,7 +118,6 @@ const BackstoryApp = () => { // Clear all query parameters, preserve the current path navigate(location.pathname, { replace: true }); } - setSnack(`${action} session ${newSessionId}`); } catch (err) { setSnack("" + err); } @@ -132,9 +133,9 @@ const BackstoryApp = () => { // Render appropriate routes based on user type return ( - + - } /> + } /> {/* Static/shared routes */} { /> } /> - } /> diff --git a/frontend/src/NewApp/Components/BackstoryDynamicRoutes.tsx b/frontend/src/NewApp/Components/BackstoryDynamicRoutes.tsx deleted file mode 100644 index 53a676a..0000000 --- a/frontend/src/NewApp/Components/BackstoryDynamicRoutes.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import React, { Ref, Fragment, ReactNode } from "react"; -import { Route } from "react-router-dom"; -import { useUser } from "./UserContext"; -import { Box, Typography, Container, Paper } from '@mui/material'; - -import { BackstoryPageProps } from '../../Components/BackstoryTab'; -import { ConversationHandle } from '../Components/Conversation'; -import { UserType } from '../Components/UserContext'; - -import { ChatPage } from '../Pages/ChatPage'; -import { ResumeBuilderPage } from '../../Pages/ResumeBuilderPage'; -import { DocsPage } from '../Pages/DocsPage'; -import { CreateProfilePage } from '../Pages/CreateProfilePage'; -import { VectorVisualizerPage } from 'Pages/VectorVisualizerPage'; -import { HomePage } from '../Pages/HomePage'; -import { BetaPage } from '../Pages/BetaPage' - -const DashboardPage = () => Dashboard; -const ProfilePage = () => Profile; -const BackstoryPage = () => Backstory; -const ResumesPage = () => Resumes; -const QASetupPage = () => Q&A Setup; -const AnalyticsPage = () => Analytics; -const SettingsPage = () => Settings; -const SearchPage = () => Search; -const SavedPage = () => Saved; -const JobsPage = () => Jobs; -const CompanyPage = () => Company; - -interface BackstoryDynamicRoutesProps extends BackstoryPageProps { - chatRef: Ref -} -const getBackstoryDynamicRoutes = (props : BackstoryDynamicRoutesProps, user?: UserType | null) : ReactNode => { - const { sessionId, setSnack, submitQuery, chatRef } = props; - - const routes = [ - } />, - } />, - } />, - } />, - } />, - } />, - } />, - ]; - - if (user === undefined || user === null) { - return routes; - } - - if (user.type === "candidate") { - routes.splice(-1, 0, ...[ - } />, - } />, - } />, - } />, - ]); - } - - if (user.type === "employer") { - routes.splice(-1, 0, ...[ - } />, - } />, - } />, - } />, - ]); - } - - return routes; -}; - -export { getBackstoryDynamicRoutes }; diff --git a/frontend/src/NewApp/Components/BackstoryLayout.tsx b/frontend/src/NewApp/Components/BackstoryLayout.tsx index 8ba9637..60d3046 100644 --- a/frontend/src/NewApp/Components/BackstoryLayout.tsx +++ b/frontend/src/NewApp/Components/BackstoryLayout.tsx @@ -21,9 +21,10 @@ import { SxProps, Theme } from '@mui/material'; import {Header} from './Header'; import { Scrollable } from '../../Components/Scrollable'; import { Footer } from './Footer'; -import { Snack } from '../../Components/Snack'; -import { UserProvider, useUser, UserType } from './UserContext'; -import { getBackstoryDynamicRoutes } from './BackstoryDynamicRoutes'; +import { Snack, SetSnackType } from '../../Components/Snack'; +import { UserProvider, useUser, UserInfo } from './UserContext'; +import { getBackstoryDynamicRoutes } from './BackstoryRoutes'; +import { LoadingComponent } from "../Components/LoadingComponent"; type NavigationLinkType = { name: string; @@ -32,10 +33,8 @@ type NavigationLinkType = { label?: ReactElement; }; -const DefaultNavItems : NavigationLinkType[] = [ - { name: 'Chat', path: '/chat', icon: }, - { name: 'Resume Builder', path: '/resume-builder', icon: }, - { name: 'Knowledge Explorer', path: '/knowledge-explorer', icon: }, +const DefaultNavItems: NavigationLinkType[] = [ + { name: 'Find a Candidate', path: '/find-a-candidate', icon: }, { name: 'Docs', path: '/docs', icon: }, // { name: 'How It Works', path: '/how-it-works', icon: }, // { name: 'For Candidates', path: '/for-candidates', icon: }, @@ -44,37 +43,45 @@ const DefaultNavItems : NavigationLinkType[] = [ ]; const CandidateNavItems : NavigationLinkType[]= [ - { name: 'Dashboard', icon: , path: '/dashboard' }, - { name: 'Profile', icon: , path: '/profile' }, - { name: 'Backstory', icon: , path: '/backstory' }, + { name: 'Chat', path: '/chat', icon: }, + { name: 'Resume Builder', path: '/resume-builder', icon: }, + { name: 'Knowledge Explorer', path: '/knowledge-explorer', icon: }, + { name: 'Find a Candidate', path: '/find-a-candidate', icon: }, + // { name: 'Dashboard', icon: , path: '/dashboard' }, + // { name: 'Profile', icon: , path: '/profile' }, + // { name: 'Backstory', icon: , path: '/backstory' }, { name: 'Resumes', icon: , path: '/resumes' }, - { name: 'Q&A Setup', icon: , path: '/qa-setup' }, + // { name: 'Q&A Setup', icon: , path: '/qa-setup' }, { name: 'Analytics', icon: , path: '/analytics' }, { name: 'Settings', icon: , path: '/settings' }, ]; const EmployerNavItems: NavigationLinkType[] = [ - { name: 'Dashboard', icon: , path: '/dashboard' }, - { name: 'Search', icon: , path: '/search' }, - { name: 'Saved', icon: , path: '/saved' }, - { name: 'Jobs', icon: , path: '/jobs' }, - { name: 'Company', icon: , path: '/company' }, - { name: 'Analytics', icon: , path: '/analytics' }, - { name: 'Settings', icon: , path: '/settings' }, + { name: 'Chat', path: '/chat', icon: }, + { name: 'Resume Builder', path: '/resume-builder', icon: }, + { name: 'Knowledge Explorer', path: '/knowledge-explorer', icon: }, + { name: 'Find a Candidate', path: '/find-a-candidate', icon: }, + // { name: 'Dashboard', icon: , path: '/dashboard' }, + // { name: 'Search', icon: , path: '/search' }, + // { name: 'Saved', icon: , path: '/saved' }, + // { name: 'Jobs', icon: , path: '/jobs' }, + // { name: 'Company', icon: , path: '/company' }, + // { name: 'Analytics', icon: , path: '/analytics' }, + // { name: 'Settings', icon: , path: '/settings' }, ]; // Navigation links based on user type -const getNavigationLinks = (user: UserType | null) : NavigationLinkType[] => { - if (!user) { - return DefaultNavItems; - } +const getNavigationLinks = (user: UserInfo | null): NavigationLinkType[] => { + if (!user) { + return DefaultNavItems; + } - if (user.type === 'candidate') { - return CandidateNavItems; - } + if (user.type === 'candidate' && user.isAuthenticated) { + return CandidateNavItems; + } - // Employer navigation - return EmployerNavItems; + // Employer navigation + return EmployerNavItems; }; interface BackstoryPageContainerProps { @@ -101,8 +108,8 @@ const BackstoryPageContainer = (props : BackstoryPageContainerProps) => { } const BackstoryLayout: React.FC<{ - sessionId?: string; - setSnack: (msg: string) => void; + sessionId: string | undefined; + setSnack: SetSnackType; page: string; chatRef: React.Ref; snackRef: React.Ref; @@ -129,7 +136,7 @@ const BackstoryLayout: React.FC<{ return ( <> -
+
- - {dynamicRoutes !== undefined && {dynamicRoutes}} + {!sessionId && + + + + } + {sessionId && <> + + {dynamicRoutes !== undefined && {dynamicRoutes}} + + } {location.pathname === "/" &&