From 15ef151fb800bcad99fd8f5deca0e35b5ad94dd2 Mon Sep 17 00:00:00 2001 From: lina elman Date: Sun, 25 May 2025 22:24:11 +0300 Subject: [PATCH 1/3] Added integration of jobs to quizzes --- .../src/components/LinkedInIntegration.tsx | 31 ++++++++++++++----- nextstep-frontend/src/pages/Quiz.tsx | 18 +++++++++-- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/nextstep-frontend/src/components/LinkedInIntegration.tsx b/nextstep-frontend/src/components/LinkedInIntegration.tsx index a5e0929..56f30d2 100644 --- a/nextstep-frontend/src/components/LinkedInIntegration.tsx +++ b/nextstep-frontend/src/components/LinkedInIntegration.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import { Box, Typography, Button, Grid, CircularProgress, IconButton, TextField, MenuItem, Select, FormControl, InputLabel, Dialog, DialogTitle, DialogContent, DialogActions, Chip, Stack } from '@mui/material'; import { ExpandLess, LinkedIn, Settings } from '@mui/icons-material'; +import { useNavigate } from 'react-router-dom'; interface Job { position: string; @@ -68,6 +69,12 @@ const LinkedInIntegration: React.FC = ({ setJobDetails(null); }; + const handleGenerateQuiz = (job: Job) => { + const subject = `${job.position} at ${job.company}`; + const quizUrl = `/quiz?subject=${encodeURIComponent(subject)}`; + window.open(quizUrl, '_blank'); + }; + return ( @@ -281,14 +288,22 @@ const LinkedInIntegration: React.FC = ({ Close {selectedJob?.jobUrl && ( - +
+ + +
)} diff --git a/nextstep-frontend/src/pages/Quiz.tsx b/nextstep-frontend/src/pages/Quiz.tsx index be0029b..c68af5e 100644 --- a/nextstep-frontend/src/pages/Quiz.tsx +++ b/nextstep-frontend/src/pages/Quiz.tsx @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import { useSearchParams } from 'react-router-dom'; import { Container, Box, @@ -102,7 +103,8 @@ interface QuizState { } const Quiz: React.FC = () => { - const [subject, setSubject] = useState(''); + const [searchParams] = useSearchParams(); + const [subject, setSubject] = useState(searchParams.get('subject') || ''); const [quiz, setQuiz] = useState(null); const [loading, setLoading] = useState(false); const [showAnswer, setShowAnswer] = useState<{ [key: number]: boolean }>({}); @@ -218,6 +220,11 @@ const Quiz: React.FC = () => { } }; + const handleEditSubject = (newSubject: string) => { + setSubject(newSubject); + setQuiz(null); // Reset the quiz to allow generating a new one with the updated subject + }; + return ( @@ -254,7 +261,14 @@ const Quiz: React.FC = () => { {quiz && ( - Quiz on: {quiz.subject} + Quiz on: + handleEditSubject(e.target.value)} + variant="outlined" + size="small" + sx={{ ml: 2, width: '50%' }} + /> {/* --- Enhanced Display of Quiz Metadata --- */} From 4ab2d59981a61d633ab18f3b27d9ebb3cde24437 Mon Sep 17 00:00:00 2001 From: lina elman Date: Sun, 25 May 2025 22:25:55 +0300 Subject: [PATCH 2/3] removed unnecessary --- nextstep-frontend/src/components/LinkedInIntegration.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/nextstep-frontend/src/components/LinkedInIntegration.tsx b/nextstep-frontend/src/components/LinkedInIntegration.tsx index 56f30d2..c13e7d5 100644 --- a/nextstep-frontend/src/components/LinkedInIntegration.tsx +++ b/nextstep-frontend/src/components/LinkedInIntegration.tsx @@ -1,7 +1,6 @@ import React, { useState } from 'react'; import { Box, Typography, Button, Grid, CircularProgress, IconButton, TextField, MenuItem, Select, FormControl, InputLabel, Dialog, DialogTitle, DialogContent, DialogActions, Chip, Stack } from '@mui/material'; import { ExpandLess, LinkedIn, Settings } from '@mui/icons-material'; -import { useNavigate } from 'react-router-dom'; interface Job { position: string; From 41d2330d286cda105ce92fc22b3af470445ff5dc Mon Sep 17 00:00:00 2001 From: lina elman Date: Sun, 25 May 2025 22:38:47 +0300 Subject: [PATCH 3/3] added icon --- nextstep-frontend/src/pages/Quiz.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/nextstep-frontend/src/pages/Quiz.tsx b/nextstep-frontend/src/pages/Quiz.tsx index c68af5e..6847b32 100644 --- a/nextstep-frontend/src/pages/Quiz.tsx +++ b/nextstep-frontend/src/pages/Quiz.tsx @@ -27,6 +27,7 @@ import { BusinessOutlined as BusinessOutlinedIcon, LocalOfferOutlined as LocalOfferOutlinedIcon, } from '@mui/icons-material'; +import SchoolIcon from '@mui/icons-material/School'; // Import graduation hat icon import api from '../serverApi'; import { config } from '../config'; @@ -227,8 +228,22 @@ const Quiz: React.FC = () => { return ( - - Quiz Generator & Grader + + Quiz Generator &{' '} + + + Grader + {/* Subject Input */}