From 1fbc5317d3462361be337ee77a53c0503b5e58c4 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 9 Jun 2025 11:14:59 -0700 Subject: [PATCH] Locked job creation behind access restriction --- frontend/src/components/JobCreator.tsx | 2 ++ frontend/src/components/JobMatchAnalysis.tsx | 3 +- .../src/components/ui/LoginRestricted.css | 30 +++++++++++++++++++ .../src/components/ui/LoginRestricted.tsx | 22 ++++++++++++++ frontend/src/pages/JobAnalysisPage.tsx | 9 ++++-- frontend/src/pages/LoginRequired.tsx | 24 --------------- frontend/src/pages/candidate/Dashboard.tsx | 4 +-- 7 files changed, 64 insertions(+), 30 deletions(-) create mode 100644 frontend/src/components/ui/LoginRestricted.css create mode 100644 frontend/src/components/ui/LoginRestricted.tsx delete mode 100644 frontend/src/pages/LoginRequired.tsx diff --git a/frontend/src/components/JobCreator.tsx b/frontend/src/components/JobCreator.tsx index 8bf8d17..82ccadd 100644 --- a/frontend/src/components/JobCreator.tsx +++ b/frontend/src/components/JobCreator.tsx @@ -545,6 +545,8 @@ const JobCreator = (props: JobCreator) => { sx={{ background: "white", p: 0, + width: "100%", + display: "flex", flexDirection: "column" }}> {selectedJob === null && renderJobCreation()} diff --git a/frontend/src/components/JobMatchAnalysis.tsx b/frontend/src/components/JobMatchAnalysis.tsx index e8b7cb9..8564006 100644 --- a/frontend/src/components/JobMatchAnalysis.tsx +++ b/frontend/src/components/JobMatchAnalysis.tsx @@ -128,8 +128,7 @@ const JobMatchAnalysis: React.FC = (props: JobAnalysisProps) = const skillMatchHandlers = { onStatus: (status: Types.ChatMessageStatus) => { - console.log('status:', status.content); - setMatchStatus(status.content); + setMatchStatus(status.content.toLowerCase()); }, }; diff --git a/frontend/src/components/ui/LoginRestricted.css b/frontend/src/components/ui/LoginRestricted.css new file mode 100644 index 0000000..a6d68e9 --- /dev/null +++ b/frontend/src/components/ui/LoginRestricted.css @@ -0,0 +1,30 @@ +.LoginRestricted { + display: flex; + position: relative; + flex: 1; + pointer-events: none; + z-index: 1101; + cursor: pointer; + font-family: 'Roboto'; + line-height: 40px; + overflow: hidden; + padding: 8px; +} + +.LoginRestricted-label { + display: flex; + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + font-size: 28px; + text-align: center; + font-weight: bold; + color: #d8d8d8; + background: rgba(0, 0, 0, 0.5); + z-index: 11; + pointer-events: none; +} diff --git a/frontend/src/components/ui/LoginRestricted.tsx b/frontend/src/components/ui/LoginRestricted.tsx new file mode 100644 index 0000000..ac7da17 --- /dev/null +++ b/frontend/src/components/ui/LoginRestricted.tsx @@ -0,0 +1,22 @@ +import Box from '@mui/material/Box'; +import './LoginRestricted.css'; + +interface LoginRestrictedProps { + children?: React.ReactNode +} + +const LoginRestricted = (props: LoginRestrictedProps) => { + const { children } = props; + return ( + + + You must login to access this feature + + {children} + + ); +}; + +export { + LoginRestricted +}; \ No newline at end of file diff --git a/frontend/src/pages/JobAnalysisPage.tsx b/frontend/src/pages/JobAnalysisPage.tsx index d9f5bb8..ec87eb7 100644 --- a/frontend/src/pages/JobAnalysisPage.tsx +++ b/frontend/src/pages/JobAnalysisPage.tsx @@ -34,6 +34,7 @@ import { Scrollable } from 'components/Scrollable'; import { CandidatePicker } from 'components/ui/CandidatePicker'; import { JobPicker } from 'components/ui/JobPicker'; import { JobCreator } from 'components/JobCreator'; +import { LoginRestricted } from 'components/ui/LoginRestricted'; function WorkAddIcon() { return ( @@ -63,7 +64,7 @@ function WorkAddIcon() { // Main component const JobAnalysisPage: React.FC = (props: BackstoryPageProps) => { const theme = useTheme(); - const { user, apiClient } = useAuth(); + const { user, guest } = useAuth(); const navigate = useNavigate(); const { selectedCandidate, setSelectedCandidate } = useSelectedCandidate() const { selectedJob, setSelectedJob } = useSelectedJob(); @@ -185,10 +186,14 @@ const JobAnalysisPage: React.FC = (props: BackstoryPageProps {jobTab === 'load' && } - {jobTab === 'create' && + {jobTab === 'create' && user && } + {jobTab === 'create' && guest && + } ); } diff --git a/frontend/src/pages/LoginRequired.tsx b/frontend/src/pages/LoginRequired.tsx deleted file mode 100644 index e475015..0000000 --- a/frontend/src/pages/LoginRequired.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import Box from '@mui/material/Box'; -import { BackstoryPageProps } from '../components/BackstoryTab'; -import { Message } from '../components/Message'; -import { ChatMessage } from 'types/types'; - -const LoginRequired = (props: BackstoryPageProps) => { - const preamble: ChatMessage = { - role: 'assistant', - type: 'text', - status: 'done', - sessionId: '', - content: 'You must be logged to view this feature.', - timestamp: new Date(), - metadata: null as any - } - - return - - -}; - -export { - LoginRequired -}; \ No newline at end of file diff --git a/frontend/src/pages/candidate/Dashboard.tsx b/frontend/src/pages/candidate/Dashboard.tsx index 9a693f9..9337ada 100644 --- a/frontend/src/pages/candidate/Dashboard.tsx +++ b/frontend/src/pages/candidate/Dashboard.tsx @@ -17,7 +17,7 @@ import { TipsAndUpdates as TipsIcon, } from '@mui/icons-material'; import { useAuth } from 'hooks/AuthContext'; -import { LoginRequired } from 'pages/LoginRequired'; +import { LoginRequired } from 'components/ui/LoginRequired'; import { BackstoryElementProps } from 'components/BackstoryTab'; import { useNavigate } from 'react-router-dom'; import { ComingSoon } from 'components/ui/ComingSoon'; @@ -33,7 +33,7 @@ const CandidateDashboard = (props: CandidateDashboardProps) => { const profileCompletion = 75; if (!user) { - return ; + return ; } if (user?.userType !== 'candidate') {