Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show correct answer for Multiple Choice after question #201

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import React, { useState, useEffect } from "react";
import { Button, CheckIcon } from "@mantine/core";
import { Button, CheckIcon, CloseIcon } from "@mantine/core";
import { downloadImage, submitAnswer, uploadScreenshot } from "@/app/util/api";
import { useDisclosure } from "@mantine/hooks";
import ImageModal from "./modal";
Expand All @@ -10,6 +10,7 @@ import useUserTokenData from "@/app/util/useUserTokenData";
import { useScreenshot } from "use-react-screenshot";
import { useAnswer, useMetaData } from "@/app/util/store";
import { notifications } from "@mantine/notifications";
import { IconX } from "@tabler/icons-react";

export default React.forwardRef(MulitpleChoice);

Expand Down Expand Up @@ -140,7 +141,7 @@ function MulitpleChoice({ question, connectionId }, ref) {
pick === choices.qDetailDesc
? "bg-dark_green text-white"
: "bg-white text-dark_green"
} flex justify-center items-center text-xl font-bold px-4 py-4 rounded-md shadow-lg ${
} flex justify-center items-center space-x-3 text-xl font-bold px-4 py-4 rounded-md shadow-lg ${
isSubmitted ? "cursor-not-allowed" : "cursor-pointer"
}`}
key={index}
Expand All @@ -150,7 +151,17 @@ function MulitpleChoice({ question, connectionId }, ref) {
handlePick(choices.qDetailDesc);
}}
>
{choices.qDetailDesc}
<span>{choices.qDetailDesc}</span>
{answer && pick == answer && pick == choices.qDetailDesc ? (
<CheckIcon width={20} height={20} color="#90EE90" />
) : (
answer &&
pick == choices.qDetailDesc && (
<span className="w-[20px] h-[20px]">
<IconX width={24} height={24} color="red" stroke={2} />
</span>
)
)}
</div>
))}
</div>
Expand Down
Loading