-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
89 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { useTaskUserAnswers } from "@/queries/tasks"; | ||
import { useParams } from "react-router-dom"; | ||
import cn from "classnames"; | ||
|
||
export default function StudentTaskAnswersPage() { | ||
const { id } = useParams(); | ||
|
||
const { userAnswers, isUserAnswersLoading } = useTaskUserAnswers(+id!); | ||
|
||
return ( | ||
<div className="flex flex-col gap-4 w-full"> | ||
<h1 className="font-bold">Результаты студента</h1> | ||
|
||
{!isUserAnswersLoading && userAnswers && ( | ||
<div className="grid gap-4"> | ||
{!userAnswers.length && ( | ||
<div className="bg-bgSecondary p-4 rounded-xl"> | ||
Результаты не найдены. | ||
</div> | ||
)} | ||
{userAnswers.map((answer) => ( | ||
<div | ||
className="flex flex-col p-6 rounded-xl bg-bgSecondary gap-2" | ||
key={answer.id} | ||
> | ||
<h1 className="text-xs font-light">{answer.task.topic.title}</h1> | ||
<div | ||
dangerouslySetInnerHTML={{ __html: answer.task.text }} | ||
className="bg-background rounded-xl px-4 py-1" | ||
></div> | ||
|
||
<div | ||
className={cn( | ||
"flex gap-3", | ||
answer.answer ? "flex-row items-center" : "flex-col" | ||
)} | ||
> | ||
<h2 className="text-sm font-light">Ответ студента: </h2> | ||
|
||
{answer.answer ? ( | ||
<div | ||
className={cn( | ||
"px-4 py-1 rounded-xl text-background", | ||
answer.answer.isCorrectAnswer | ||
? "bg-green-600" | ||
: "bg-red-600" | ||
)} | ||
> | ||
<div className="text-sm">{answer.answer.text}</div> | ||
</div> | ||
) : ( | ||
<div className="p-4 bg-background rounded-xl"> | ||
<div | ||
dangerouslySetInnerHTML={{ __html: answer.text }} | ||
></div> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const columns = [{ key: "id", label: "ID" }]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters