From 425f563b5932913362138e7d9da54f41f4cf1462 Mon Sep 17 00:00:00 2001 From: Vasilica Olariu Date: Tue, 2 Jun 2026 09:24:56 +0300 Subject: [PATCH 01/30] PM-5203 - allow manager to update ai score --- .../ChallengeDetailsContent.tsx | 11 + .../TabContentAiApproval.module.scss | 111 +++++++++ .../TabContentAiApproval.tsx | 211 ++++++++++++++++++ .../review/src/lib/models/AiReview.model.ts | 3 + .../src/lib/services/aiReview.service.ts | 23 +- 5 files changed, 358 insertions(+), 1 deletion(-) create mode 100644 src/apps/review/src/lib/components/ChallengeDetailsContent/TabContentAiApproval.module.scss create mode 100644 src/apps/review/src/lib/components/ChallengeDetailsContent/TabContentAiApproval.tsx diff --git a/src/apps/review/src/lib/components/ChallengeDetailsContent/ChallengeDetailsContent.tsx b/src/apps/review/src/lib/components/ChallengeDetailsContent/ChallengeDetailsContent.tsx index 3d1f95c08..33773f8a9 100644 --- a/src/apps/review/src/lib/components/ChallengeDetailsContent/ChallengeDetailsContent.tsx +++ b/src/apps/review/src/lib/components/ChallengeDetailsContent/ChallengeDetailsContent.tsx @@ -35,6 +35,7 @@ import { } from '../../utils/reviewPhaseGuards' import TabContentApproval from './TabContentApproval' +import TabContentAiApproval from './TabContentAiApproval' import TabContentCheckpoint from './TabContentCheckpoint' import TabContentIterativeReview from './TabContentIterativeReview' import TabContentRegistration from './TabContentRegistration' @@ -497,6 +498,16 @@ export const ChallengeDetailsContent: FC = (props: Props) => { } if (selectedTabNormalized === 'approval') { + if (aiReviewConfig?.mode === 'AI_ONLY') { + return ( + + ) + } + return ( void +} + +const SubmissionApprovalRow: FC = ({ + submission, + decision, + aiReviewers, + isPrivilegedRole, + isApprovalPhaseOpen, + onSaved, +}) => { + const [managerComment, setManagerComment] = useState(decision?.managerComment ?? '') + const [isSaving, setIsSaving] = useState(false) + const canEdit = isPrivilegedRole && isApprovalPhaseOpen + + const handleSave = useCallback(async () => { + if (!decision?.id) return + setIsSaving(true) + try { + const updated = await patchAiReviewDecision(decision.id, { + managerComment: managerComment.trim() || null, + }) + onSaved(updated) + toast.success('Manager comment saved.') + } catch (err) { + toast.error('Failed to save manager comment.') + } finally { + setIsSaving(false) + } + }, [decision?.id, managerComment, onSaved]) + + const submittedDate = submission.created + ? moment(submission.created).format(TABLE_DATE_FORMAT) + : '-' + + return ( +
+
+ + {submission.id} + + {submittedDate} + {decision && ( + + AI Score:{' '} + {decision.totalScore != null + ? decision.totalScore.toFixed(2) + : '-'} + {decision.status === 'HUMAN_OVERRIDE' && ( + (Override) + )} + + )} +
+ + + + {decision && canEdit && ( +
+ +