From 4033f4e21911d5c69164893756848fbc3e75edd5 Mon Sep 17 00:00:00 2001 From: abiyasa05 Date: Tue, 29 Oct 2024 11:57:04 +0700 Subject: [PATCH] update: add color for aspect and sub aspect score, add boder on action icon flag --- .../assessment/index.lazy.tsx | 81 ++++++++++++------- 1 file changed, 53 insertions(+), 28 deletions(-) diff --git a/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx b/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx index addda4c..041cebb 100644 --- a/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx +++ b/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx @@ -662,21 +662,12 @@ export default function AssessmentPage() { ? "Pilih jawaban terlebih dahulu" : "Tandai" } - color={flaggedQuestions[questionId] ? "red" : "white"} - style={{ - margin: "2px 10px", - borderRadius: "4px", - backgroundColor: flaggedQuestions[questionId] ? "red" : "white", - }} + 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"}`} disabled={!answers[question.questionId]} > @@ -852,14 +843,31 @@ export default function AssessmentPage() { {/* Skor Aspek */}
{filteredAspects.length > 0 ? ( - filteredAspects.map((aspect) => ( -
- {aspect.aspectName} - - {parseFloat(aspect.averageScore).toFixed(2)} - -
- )) + filteredAspects.map((aspect) => { + const aspectScore = parseFloat(aspect.averageScore).toFixed(2); + const aspectScoreValue = parseFloat(aspectScore); + + return ( +
+ {aspect.aspectName} + = 4.01 + ? "text-green-700" + : aspectScoreValue >= 3.01 + ? "text-green-400" + : aspectScoreValue >= 2.01 + ? "text-yellow-400" + : aspectScoreValue >= 1.01 + ? "text-orange-500" + : "text-red-500" + }`} + > + {aspectScore} + +
+ ); + }) ) : ( Data aspek ini kosong )} @@ -873,14 +881,31 @@ export default function AssessmentPage() { {/* Skor Sub-Aspek */}
{filteredSubAspects.length > 0 ? ( - filteredSubAspects.map((subAspect) => ( -
{/* Change key to 'id' */} - {subAspect.subAspectName} {/* Change to 'name' */} - - {parseFloat(subAspect.averageScore).toFixed(2)} - -
- )) + filteredSubAspects.map((subAspect) => { + const subAspectScore = parseFloat(subAspect.averageScore).toFixed(2); + const subAspectScoreValue = parseFloat(subAspectScore); + + return ( +
+ {subAspect.subAspectName} + = 4.01 + ? "text-green-700" + : subAspectScoreValue >= 3.01 + ? "text-green-400" + : subAspectScoreValue >= 2.01 + ? "text-yellow-400" + : subAspectScoreValue >= 1.01 + ? "text-orange-500" + : "text-red-500" + }`} + > + {subAspectScore} + +
+ ); + }) ) : ( Data sub-aspek ini kosong )}