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

View File

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