diff --git a/src/components/TestSeriesCoderpadHome.jsx b/src/components/TestSeriesCoderpadHome.jsx index f31e52b..1c19748 100644 --- a/src/components/TestSeriesCoderpadHome.jsx +++ b/src/components/TestSeriesCoderpadHome.jsx @@ -5,7 +5,7 @@ import axios from 'axios' import queryString from 'query-string' import { useNavigate } from 'react-router-dom' import { useUser, SignInButton, UserButton } from '@clerk/clerk-react' -import { Video, FileText, ChevronDown, X, ArrowLeft, Search, Filter, Moon, Sun, Bookmark, BookmarkCheck, Loader2, ChevronLeft, ChevronRight } from 'lucide-react' +import { Video, FileText, ChevronDown, X, ArrowLeft, Search, Filter, Moon, Sun, Bookmark, BookmarkCheck, Loader2, ChevronLeft, ChevronRight, Star } from 'lucide-react' import ReactPlayer from 'react-player/youtube' import { Button } from "./ui/button" import { Input } from "./ui/input" @@ -35,7 +35,6 @@ import { export default function QuizApp() { const { isLoaded, isSignedIn, user } = useUser() - const navigateTo = useNavigate() const [quizzes, setQuizzes] = useState([]) const [isDarkMode, setIsDarkMode] = useState(false) @@ -43,7 +42,7 @@ export default function QuizApp() { const [selectedCompanies, setSelectedCompanies] = useState([]) const [selectedSubtopics, setSelectedSubtopics] = useState([]) const [expandedQuestions, setExpandedQuestions] = useState({}) - const [difficulties] = useState(['Easy', 'Medium', 'Hard']) + const [difficulties] = useState(['Easy', 'Medium', 'Advamce']) const [companies] = useState(['Amazon', 'Google', 'Microsoft', 'Facebook', 'Apple']) const [subtopics, setSubtopics] = useState([]) const [searchTerm, setSearchTerm] = useState('') @@ -82,8 +81,6 @@ export default function QuizApp() { useEffect(() => { if (isLoaded && isSignedIn) { setUserID(user.id) - // console.log('user id -> '+user.id) - // console.log( 'userinfo -> '+ user.emailAddress+' '+user.fullName+' '+user.id ) } }, [isLoaded, isSignedIn, user]) @@ -217,29 +214,28 @@ export default function QuizApp() { } } } -const normalizeDifficulty = (difficulty) => { - if (!difficulty) { - // Handle null, undefined, or other falsy values - return 'easy'; // Default value - } - const normalized = difficulty.toLowerCase(); - if (normalized === 'advance' || normalized === 'advanced') { - return 'hard'; - } + const normalizeDifficulty = (difficulty) => { + if (!difficulty) { + return 'easy' + } - return normalized; -}; + const normalized = difficulty.toLowerCase() + if (normalized === 'advance' || normalized === 'advanced') { + return 'advance' + } + + return normalized + } - const getDifficultyStyle = (difficulty) => { const normalizedDifficulty = normalizeDifficulty(difficulty) switch (normalizedDifficulty) { case 'easy': - return 'bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-300' + return 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300' case 'medium': return 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300' - case 'hard': + case 'advance': case 'advance': return 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300' default: @@ -335,8 +331,7 @@ const normalizeDifficulty = (difficulty) => { route = '/pyQuiz' } - window.open(`${route}?questionID=${quizID}&userID=${userID}`, '_blank'); - + navigateTo(`${route}?questionID=${quizID}&userID=${userID}`) } const toggleQuestionExpansion = (quizId) => { @@ -348,359 +343,352 @@ const normalizeDifficulty = (difficulty) => { return question.substring(0, maxLength) + '...' } - const FilterContent = () => ( - <> - - - Search - - - updateFilters('search', e.target.value)} - className="mb-4" - /> -
- updateFilters('bookmarked', checked)} - /> -