From 5c6cafffb6746df79b8830da624fc5c5e5b3dcf3 Mon Sep 17 00:00:00 2001 From: Ashar Fuadi Date: Sun, 25 Aug 2024 19:41:28 +0700 Subject: [PATCH] client: fix alignment of long score feedback (#656) --- .../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; };