fix: user nav, quiz

This commit is contained in:
mehedi-hasan 2024-04-20 14:42:47 +06:00
parent 8a6a99a81b
commit 32e9451416
2 changed files with 12 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { createClient } from "@/utils/supabase/client";
import { LogOut, User2Icon } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
export function UserNav({
@ -45,7 +46,7 @@ export function UserNav({
<DropdownMenuGroup>
<DropdownMenuItem>
<Link href="/dashboard/profile">Profile</Link>
<DropdownMenuShortcut>P</DropdownMenuShortcut>
<DropdownMenuShortcut><User2Icon/></DropdownMenuShortcut>
</DropdownMenuItem>
{/* <DropdownMenuItem>
Billing
@ -68,7 +69,7 @@ export function UserNav({
}}
>
Log out
<DropdownMenuShortcut>Q</DropdownMenuShortcut>
<DropdownMenuShortcut><LogOut/></DropdownMenuShortcut>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>

View File

@ -1,6 +1,6 @@
"use client";
import React, { useEffect } from "react";
import React, { useEffect, useState } from "react";
// import { getQuestions, newAnswer } from "../features/questions/questionsSlice";
import { Loader } from "./loader";
import { ErrorMessage } from "./error-message";
@ -19,6 +19,8 @@ export const Question = ({ difficulty }: { difficulty: string }) => {
// (store) => store.questions,
// );
const [isStart, setIsStart] = useState(false);
const {
restartTimer,
// gameMode,
@ -75,7 +77,9 @@ export const Question = ({ difficulty }: { difficulty: string }) => {
<Button
variant={`${answer === option ? "default" : "secondary"}`}
key={index}
className={cn("justify-start text-lg py-6 disabled:pointer-events-auto disabled:cursor-not-allowed")}
className={cn(
"justify-start text-lg py-6 disabled:pointer-events-auto disabled:cursor-not-allowed",
)}
// className={cn(answer === option ? "answer" : "")}
// className={`${answer === option ? "answer" : ""}
// ${
@ -86,7 +90,7 @@ export const Question = ({ difficulty }: { difficulty: string }) => {
// : ""
// }
// `}
disabled={hasAnswered}
disabled={ !isStart}
onClick={() => newAnswer(option)}
>
{option}
@ -97,7 +101,8 @@ export const Question = ({ difficulty }: { difficulty: string }) => {
</div>
<div className="flex justify-between mt-6 items-center">
<div>{answer && <Next />}</div>
<Timer />
{isStart ? <Timer /> : <Button onClick={() => setIsStart(true)}>Start</Button>}
</div>
</>
)}