diff --git a/backend/core/views/quiz_views.py b/backend/core/views/quiz_views.py index 4bf97c2f..01c00466 100644 --- a/backend/core/views/quiz_views.py +++ b/backend/core/views/quiz_views.py @@ -1,3 +1,4 @@ + from ..models import Quiz from rest_framework import viewsets from rest_framework import permissions @@ -61,12 +62,8 @@ def perform_create(self, serializer): ] ) def list(self, request, *args, **kwargs): - return super().list(request, *args, **kwargs) - def get_queryset(self): # Overrided to make it customized :p, need more testing. - queryset = super().get_queryset() user = self.request.user - sort_by = self.request.query_params.get('sort_by', 'newest') - + queryset = self.get_queryset() if user.is_authenticated: blocked_users = Block.objects.filter(blocker=user).values_list('blocking__id', flat=True) # Fetch ing blocked users taken_quizzes = user.taken_quizzes.values_list('quiz__id', flat=True) # Fetching quizzes taken by the user @@ -75,6 +72,14 @@ def get_queryset(self): # Overrided to make it customized :p, need more testi proficiency = self.request.query_params.get('filter_proficiency', None) # if proficiency and proficiency.lower() == "true": queryset = queryset.filter(difficulty=user.proficiency) + self.queryset = queryset + + + return super().list(request, *args, **kwargs) + def get_queryset(self): # Overrided to make it customized :p, need more testing. + queryset = super().get_queryset() + sort_by = self.request.query_params.get('sort_by', 'newest') + linked_data_id = self.request.query_params.get('linked_data_id') if linked_data_id: linked_data_ids = get_ids(linked_data_id) @@ -95,4 +100,4 @@ def get_queryset(self): # Overrided to make it customized :p, need more testi def get_permissions(self): if self.action == 'list': # If listing, allow anyone return [permissions.AllowAny()] - return super().get_permissions() \ No newline at end of file + return super().get_permissions() diff --git a/client/src/components/button.tsx b/client/src/components/button.tsx index bf2b290b..3dd0015f 100644 --- a/client/src/components/button.tsx +++ b/client/src/components/button.tsx @@ -151,6 +151,7 @@ export const buttonClass = cva( position: { fixed: ["fixed"], relative: ["relative"], + absolute: ["absolute"], }, }, defaultVariants: { diff --git a/client/src/components/forum-card.tsx b/client/src/components/forum-card.tsx index 65c1f407..4df6e0fd 100644 --- a/client/src/components/forum-card.tsx +++ b/client/src/components/forum-card.tsx @@ -86,8 +86,10 @@ export const ForumQuestionCard = ({ question, onTagClick }: ForumCardProps) => { > - - +
Are you sure? @@ -99,22 +101,22 @@ export const ForumQuestionCard = ({ question, onTagClick }: ForumCardProps) => {
setIsOpen(false)} className={buttonClass({ - intent: "destructive", - className: - "ring-offset-red-900", + intent: "ghost", })} > - Yes, delete + No, cancel setIsOpen(false)} + type="submit" className={buttonClass({ - intent: "ghost", + intent: "destructive", + className: + "ring-offset-red-900", })} > - No, cancel + Yes, delete
diff --git a/client/src/components/input.tsx b/client/src/components/input.tsx index 1385f1cb..ba544875 100644 --- a/client/src/components/input.tsx +++ b/client/src/components/input.tsx @@ -16,7 +16,7 @@ export const inputClass = cva( ); export const labelClass = cva( - "text-sm font-medium tracking-tight text-slate-900 transition-colors duration-100", + "group text-sm font-medium tracking-tight text-slate-900 transition-colors duration-100", { variants: { wrapper: { @@ -44,6 +44,7 @@ export const optionClass = cva( "focus-visible:ring-slate-300", "focus-visible:ring-3", "focus-visible:outline-none", + "group-hover:bg-red-100", ], { variants: { diff --git a/client/src/components/navbar.tsx b/client/src/components/navbar.tsx index f039fac6..c47fb019 100644 --- a/client/src/components/navbar.tsx +++ b/client/src/components/navbar.tsx @@ -150,7 +150,19 @@ export const Navbar = ({ user }: NavbarProps) => { className="fixed top-0 z-50 w-full border-b border-slate-200 bg-[rgba(255,255,255,.8)] py-3 backdrop-blur-sm" >
-
+
+ + Skip to Main Content +
{
@@ -126,6 +126,7 @@ export const QuizCard = ({ quiz, onTagClick, quiz_key }: QuizCardProps) => {
@@ -158,6 +159,8 @@ export const QuizCard = ({ quiz, onTagClick, quiz_key }: QuizCardProps) => { )} { })} aria-hidden="true" /> - + {quiz.is_taken ? "Re-attempt" : "Take Quiz"} diff --git a/client/src/components/radio-option.tsx b/client/src/components/radio-option.tsx index 8f319e9e..edf29aac 100644 --- a/client/src/components/radio-option.tsx +++ b/client/src/components/radio-option.tsx @@ -1,12 +1,12 @@ import { cva } from "cva"; export const radioOptionClass = cva( - "rounded-full px-4 py-1.5 text-center font-medium transition-all", + "rounded-full px-4 py-1.5 text-center font-medium ring-0 ring-transparent ring-offset-2 transition-all duration-200 group-focus-within:relative group-focus-within:ring-3", { variants: { selected: { - true: "bg-slate-700 text-white", - false: "bg-slate-100 text-slate-900 hover:bg-slate-200", + true: "bg-slate-700 text-white group-focus-within:ring-slate-300 group-hover:bg-slate-800", + false: "bg-slate-100 text-slate-900 hover:bg-slate-200 group-focus-within:ring-slate-500", }, }, }, diff --git a/client/src/components/voiceover.tsx b/client/src/components/voiceover.tsx index b47e9fcd..b32821fc 100644 --- a/client/src/components/voiceover.tsx +++ b/client/src/components/voiceover.tsx @@ -10,7 +10,7 @@ export type VoiceoverProps = { export const Voiceover = ({ text, - label = "Play voiceover", + label = "Listen pronunciation", }: VoiceoverProps) => { const { speak } = useSpeech(); return ( diff --git a/client/src/routes/Forum/Forum.tsx b/client/src/routes/Forum/Forum.tsx index 7925ec45..020d49b2 100644 --- a/client/src/routes/Forum/Forum.tsx +++ b/client/src/routes/Forum/Forum.tsx @@ -70,7 +70,7 @@ export const Forum = () => { description="Where the magic happens - jump into the conversation" /> -
- {hintOpen && ( - - )} ); }} diff --git a/client/src/routes/Quiz/QuizChoice.tsx b/client/src/routes/Quiz/QuizChoice.tsx index a5910305..8d954b40 100644 --- a/client/src/routes/Quiz/QuizChoice.tsx +++ b/client/src/routes/Quiz/QuizChoice.tsx @@ -14,6 +14,8 @@ const choiceClass = cva( "text-lg", "transition-colors", "duration-200", + "focus-within:ring-4", + "ring-slate-300", ], { variants: { @@ -101,8 +103,8 @@ const ChoiceLabel = ({ return (