From 1dc82d943a2bb892b8a1276c240140551b07299b Mon Sep 17 00:00:00 2001 From: estifanos Date: Tue, 18 Aug 2026 07:46:51 +0000 Subject: [PATCH] feat: update document review progress tooltip with detailed counts and formatting --- .../license-review/components/DecisionBar.tsx | 16 +++++++- .../pages/LicenseReviewPage/index.tsx | 39 ++++++++++++++----- apps/backoffice/src/app/i18n/locales/am.ts | 4 +- apps/backoffice/src/app/i18n/locales/en.ts | 4 +- 4 files changed, 50 insertions(+), 13 deletions(-) diff --git a/apps/backoffice/src/app/features/license-review/components/DecisionBar.tsx b/apps/backoffice/src/app/features/license-review/components/DecisionBar.tsx index 2658e78a8..e224fc028 100644 --- a/apps/backoffice/src/app/features/license-review/components/DecisionBar.tsx +++ b/apps/backoffice/src/app/features/license-review/components/DecisionBar.tsx @@ -218,7 +218,13 @@ function ActionButton({ action, busy, size, onAction }: ActionButtonProps) { if (action.enabled) return button; return ( - + {button} ); @@ -245,7 +251,13 @@ function MenuAction({ ); if (action.enabled) return item; return ( - +
{item}
); diff --git a/apps/backoffice/src/app/features/license-review/pages/LicenseReviewPage/index.tsx b/apps/backoffice/src/app/features/license-review/pages/LicenseReviewPage/index.tsx index 7ad62f792..cb8bbfa12 100644 --- a/apps/backoffice/src/app/features/license-review/pages/LicenseReviewPage/index.tsx +++ b/apps/backoffice/src/app/features/license-review/pages/LicenseReviewPage/index.tsx @@ -214,17 +214,21 @@ export function LicenseReviewPage() { const pendingInspection = inspections.find((i) => i.status === 'SCHEDULED'); // Approving means every uploaded document was accepted — one unjudged or - // rejected file is enough to keep the decision buttons dead. - const allDocumentsAccepted = useMemo(() => { + // rejected file is enough to keep the decision buttons dead. The counts feed + // the hover explanation, so the officer sees how much is left rather than + // just that the button is dead. + const documentProgress = useMemo(() => { const attachments = data?.attachments ?? []; - if (attachments.length === 0) return false; const accepted = new Set( documentReviews .filter((review) => review.decision === 'ACCEPTED') .map((review) => review.documentKey), ); - return attachments.every((a) => accepted.has(a.documentKey)); + const acceptedCount = attachments.filter((a) => accepted.has(a.documentKey)).length; + return { acceptedCount, total: attachments.length }; }, [data?.attachments, documentReviews]); + const allDocumentsAccepted = + documentProgress.total > 0 && documentProgress.acceptedCount === documentProgress.total; const flagged = Object.entries(flags); /** @@ -272,13 +276,30 @@ export function LicenseReviewPage() { needsFlags: t('review.disabled.needsFlags', 'Flag at least one item to request a correction'), needsCapital: t('review.disabled.needsCapital', 'Record the verified capital first'), needsInspection: t('review.disabled.needsInspection', 'Requires an inspection result'), - needsDocumentReviews: t( - 'review.disabled.needsDocumentReviews', - 'Accept every document first', - ), + needsDocumentReviews: + documentProgress.total === 0 + ? t( + 'review.disabled.needsDocumentsUploaded', + 'No documents uploaded to review yet', + ) + : t('review.disabled.needsDocumentReviews', { + accepted: documentProgress.acceptedCount, + total: documentProgress.total, + defaultValue: + 'Accept all documents first — {{accepted}} of {{total}} accepted. Open the Documents tab and accept the rest.', + }), }, }); - }, [data, currentUserId, can, flagged.length, pendingInspection, allDocumentsAccepted, t]); + }, [ + data, + currentUserId, + can, + flagged.length, + pendingInspection, + allDocumentsAccepted, + documentProgress, + t, + ]); if (isLoading) { // Skeleton mirrors the real three-zone layout so nothing jumps on load. diff --git a/apps/backoffice/src/app/i18n/locales/am.ts b/apps/backoffice/src/app/i18n/locales/am.ts index 8303efad3..1c2b6a983 100644 --- a/apps/backoffice/src/app/i18n/locales/am.ts +++ b/apps/backoffice/src/app/i18n/locales/am.ts @@ -949,7 +949,9 @@ export const am: Translations = { needsFlags: "ማስተካከያ ለመጠየቅ ቢያንስ አንድ ነገር ምልክት ያድርጉ", needsCapital: "መጀመሪያ የተረጋገጠውን ካፒታል ይመዝግቡ", needsInspection: "የምርመራ ውጤት ያስፈልጋል", - needsDocumentReviews: "መጀመሪያ ሁሉንም ሰነዶች ተቀበል", + needsDocumentReviews: + "መጀመሪያ ሁሉንም ሰነዶች ይቀበሉ — ከ{{total}} {{accepted}} ተቀብለዋል። የሰነዶች ትር ከፍተው ቀሪዎቹን ይቀበሉ።", + needsDocumentsUploaded: "እስካሁን የሚገመገም ሰነድ አልተጫነም", }, reasons: { incompleteDocuments: "ያልተሟሉ ሰነዶች", diff --git a/apps/backoffice/src/app/i18n/locales/en.ts b/apps/backoffice/src/app/i18n/locales/en.ts index e93785a67..dbf47267b 100644 --- a/apps/backoffice/src/app/i18n/locales/en.ts +++ b/apps/backoffice/src/app/i18n/locales/en.ts @@ -950,7 +950,9 @@ export const en = { needsFlags: 'Flag at least one item to request a correction', needsCapital: 'Record the verified capital first', needsInspection: 'Requires an inspection result', - needsDocumentReviews: 'Accept every document first', + needsDocumentReviews: + 'Accept all documents first — {{accepted}} of {{total}} accepted. Open the Documents tab and accept the rest.', + needsDocumentsUploaded: 'No documents uploaded to review yet', }, reasons: { incompleteDocuments: 'Incomplete documents',