diff --git a/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx b/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx index d0498b3..0b2c302 100644 --- a/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx +++ b/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx @@ -1,10 +1,6 @@ import { createLazyFileRoute } from "@tanstack/react-router"; import { - Flex, - Stack, - Text, Loader, - ActionIcon, } from "@mantine/core"; import { Card, @@ -569,9 +565,9 @@ export default function AssessmentPage() { if (isError) { return ( - +

Error: {error?.message || "Terjadi kesalahan saat memuat pertanyaan."} - +

); } @@ -579,9 +575,9 @@ export default function AssessmentPage() { return ( - +

Error: Data Asesmen tidak ditemukan. Harap akses halaman melalui link yang valid. - +

); @@ -615,23 +611,23 @@ export default function AssessmentPage() { return (
- - +
+
{/* LEFT-SIDE */} {/* Aspek dan Sub-Aspek */} - + {/* Sidebar for Mobile */} {isMobile && ( setIsLeftSidebarOpen(open)}> - +
{/* Aspek */} {aspectsQuery.data?.data @@ -666,7 +662,7 @@ export default function AssessmentPage() { .map((subAspect) => (
setSelectedSubAspectId(subAspect.id)} >
{subAspect.name}
@@ -677,75 +673,75 @@ export default function AssessmentPage() {
))}
- +
)} {/* Sidebar for Desktop (Always Visible) */} -
- - -
- {/* Aspek */} - {aspectsQuery.data?.data - .filter((aspect) => - aspect.subAspects.some((subAspect) => - data?.data.some((question) => question.subAspectId === subAspect.id) - ) +
+ +
+
+ {/* Aspek */} + {aspectsQuery.data?.data + .filter((aspect) => + aspect.subAspects.some((subAspect) => + data?.data.some((question) => question.subAspectId === subAspect.id) ) - .map((aspect) => ( -
-
toggleAspect(aspect.id)} - > -
{aspect.name}
-
- {openAspects[aspect.id] ? ( - - ) : ( - - )} -
+ ) + .map((aspect) => ( +
+
toggleAspect(aspect.id)} + > +
{aspect.name}
+
+ {openAspects[aspect.id] ? ( + + ) : ( + + )}
- - {/* Sub-Aspek */} - {openAspects[aspect.id] && ( -
- {aspect.subAspects - .filter((subAspect) => - data?.data.some((question) => question.subAspectId === subAspect.id) - ) - .map((subAspect) => ( -
setSelectedSubAspectId(subAspect.id)} - > -
{subAspect.name}
-
- ))} -
- )}
- ))} -
- + + {/* Sub-Aspek */} + {openAspects[aspect.id] && ( +
+ {aspect.subAspects + .filter((subAspect) => + data?.data.some((question) => question.subAspectId === subAspect.id) + ) + .map((subAspect) => ( +
setSelectedSubAspectId(subAspect.id)} + > +
{subAspect.name}
+
+ ))} +
+ )} +
+ ))} +
+
{/* MIDDLE */} {/* Pertanyaan */}
- - +
+ + {filteredQuestions.length === 0 ? ( - + + ) : ( filteredQuestions.map((question: any, index: number) => { const questionId = question.questionId; @@ -757,99 +753,97 @@ export default function AssessmentPage() { ref={(el) => (questionRefs.current[questionId] = el)} className="space-y-4" > - -
- {/* Question Number */} - {startIndex + index + 1}. +
+ {/* Question Number */} + - {/* Question Text */} - {question.questionText} + {/* Question Text */} + - {/* Action Icon/Flag */} - handleToggleFlag(questionId)} - title="Tandai" - className={`m-2 rounded-md border-1 flex items-center justify-center h-7 w-7 ${flaggedQuestions[questionId] ? "border-white bg-red-500" : "border-gray-100 bg-white"}`} - > - - -
- - {/* Radio Button Options */} - {question.options?.length > 0 ? ( -
- handleAnswerChange(question.questionId, value)} - className="flex flex-col gap-2" - > - {question.options.map((option: any) => ( -
handleAnswerChange(question.questionId, option.optionId)} - > - - -
- ))} -
-
- ) : ( - Tidak ada opsi untuk pertanyaan ini. - )} - - {/* Textarea for additional information */} -
-