From 7afda432075cc130b34ee60e158b93fa713503d1 Mon Sep 17 00:00:00 2001 From: Ashar Fuadi Date: Sun, 25 Aug 2024 19:35:36 +0700 Subject: [PATCH] client: fix alignment of long score feedback --- .../Programming/SubmissionDetails.jsx | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/judgels-client/src/components/SubmissionDetails/Programming/SubmissionDetails.jsx b/judgels-client/src/components/SubmissionDetails/Programming/SubmissionDetails.jsx index e368efc20..e82d54ca8 100644 --- a/judgels-client/src/components/SubmissionDetails/Programming/SubmissionDetails.jsx +++ b/judgels-client/src/components/SubmissionDetails/Programming/SubmissionDetails.jsx @@ -92,11 +92,27 @@ export function SubmissionDetails({ }; const renderScore = score => { + let formattedScore = score; + if (score.startsWith('*')) { - return '✓' + score.substring(1); + formattedScore = '✓' + score.substring(1); } else if (score.startsWith('X')) { - return score.substring(1); + formattedScore = score.substring(1); } + + if (formattedScore.includes(' [')) { + const [points, feedback] = formattedScore.split(' [', 2); + return ( + <> + {points}{' '} + + {'['} + {feedback} + + + ); + } + return score; };