Skip to content

Commit 18f3a36

Browse files
authored
Merge pull request #11 from NextStepFinalProject/NXD-16
Nxd 16 - Implement UI To Quiz Generation, Usage And Grade
2 parents 0e20c8c + 2528807 commit 18f3a36

4 files changed

Lines changed: 558 additions & 9 deletions

File tree

nextstep-frontend/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Resume from './pages/Resume';
1414
import TopBar from './components/TopBar';
1515
import Layout from './components/Layout';
1616
import MainDashboard from './pages/MainDashboard';
17+
import Quiz from './pages/Quiz';
1718

1819
const App: React.FC = () => {
1920
return (
@@ -30,6 +31,7 @@ const App: React.FC = () => {
3031
<Route path="/chat" element={<RequireAuth><TopBar /><Layout className="chat"><Chat /></Layout></RequireAuth>} />
3132
<Route path="/resume" element={<RequireAuth><TopBar /><Layout className="resume"><Resume /></Layout></RequireAuth>} />
3233
<Route path="/main-dashboard" element={<RequireAuth><TopBar /><Layout className="main-dashboard"><MainDashboard /></Layout></RequireAuth>} />
34+
<Route path="/quiz" element={<RequireAuth><TopBar /><Layout className="quiz"><Quiz /></Layout></RequireAuth>} />
3335
<Route path="*" element={<Navigate to="/" />} />
3436
</Routes>
3537
</Router>

nextstep-frontend/src/components/LinkedInIntegration.tsx

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ const LinkedInIntegration: React.FC<LinkedInIntegrationProps> = ({
6868
setJobDetails(null);
6969
};
7070

71+
const handleGenerateQuiz = (job: Job) => {
72+
const subject = `${job.position} at ${job.company}`;
73+
const quizUrl = `/quiz?subject=${encodeURIComponent(subject)}`;
74+
window.open(quizUrl, '_blank');
75+
};
76+
7177
return (
7278
<Box sx={{ bgcolor: 'background.paper', p: 3, borderRadius: 2, boxShadow: 1, mt: 4 }}>
7379
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2 }}>
@@ -281,14 +287,22 @@ const LinkedInIntegration: React.FC<LinkedInIntegrationProps> = ({
281287
Close
282288
</Button>
283289
{selectedJob?.jobUrl && (
284-
<Button
285-
href={selectedJob.jobUrl}
286-
target="_blank"
287-
rel="noopener noreferrer"
288-
color="primary"
289-
>
290-
Open in LinkedIn
291-
</Button>
290+
<div>
291+
<Button
292+
onClick={() => handleGenerateQuiz(selectedJob)}
293+
color="primary"
294+
>
295+
Generate a quiz
296+
</Button>
297+
<Button
298+
href={selectedJob.jobUrl}
299+
target="_blank"
300+
rel="noopener noreferrer"
301+
color="primary"
302+
>
303+
Open in LinkedIn
304+
</Button>
305+
</div>
292306
)}
293307
</DialogActions>
294308
</Dialog>

nextstep-frontend/src/components/TopBar.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useRef } from 'react';
22
import { useNavigate } from 'react-router-dom';
33
import { AppBar, Toolbar, IconButton, Tooltip, Box } from '@mui/material';
4-
import { Home, Person, Message, Logout, DocumentScannerTwoTone, Feed } from '@mui/icons-material';
4+
import { Home, Person, Message, Logout, DocumentScannerTwoTone, Feed, Quiz } from '@mui/icons-material';
55
import {getUserAuth, removeUserAuth} from "../handlers/userAuth.ts";
66
import api from "../serverApi.ts";
77

@@ -32,6 +32,11 @@ const TopBar: React.FC = () => {
3232
<DocumentScannerTwoTone fontSize='large'/>
3333
</IconButton>
3434
</Tooltip>
35+
<Tooltip title="Quiz">
36+
<IconButton color="inherit" onClick={() => navigate('/quiz')} sx={{ mx: 1 }}>
37+
<Quiz fontSize='large'/>
38+
</IconButton>
39+
</Tooltip>
3540
<Tooltip title="Feed">
3641
<IconButton color="inherit" onClick={() => navigate('/feed')} sx={{ mx: 1 }}>
3742
<Feed fontSize='large'/>

0 commit comments

Comments
 (0)