feat: update document review progress tooltip with detailed counts and formatting

This commit is contained in:
estifanos
2026-08-18 07:46:51 +00:00
parent 3d508acc41
commit 1dc82d943a
4 changed files with 50 additions and 13 deletions

View File

@@ -218,7 +218,13 @@ function ActionButton({ action, busy, size, onAction }: ActionButtonProps) {
if (action.enabled) return button;
return (
<Tooltip label={action.disabledReason} withArrow position="top">
<Tooltip
label={action.disabledReason}
withArrow
position="top"
multiline
w={280}
>
<span style={{ display: 'inline-flex', cursor: 'not-allowed' }}>{button}</span>
</Tooltip>
);
@@ -245,7 +251,13 @@ function MenuAction({
);
if (action.enabled) return item;
return (
<Tooltip label={action.disabledReason} withArrow position="left">
<Tooltip
label={action.disabledReason}
withArrow
position="left"
multiline
w={280}
>
<div>{item}</div>
</Tooltip>
);

View File

@@ -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.

View File

@@ -949,7 +949,9 @@ export const am: Translations = {
needsFlags: "ማስተካከያ ለመጠየቅ ቢያንስ አንድ ነገር ምልክት ያድርጉ",
needsCapital: "መጀመሪያ የተረጋገጠውን ካፒታል ይመዝግቡ",
needsInspection: "የምርመራ ውጤት ያስፈልጋል",
needsDocumentReviews: "መጀመሪያ ሁሉንም ሰነዶች ተቀበል",
needsDocumentReviews:
"መጀመሪያ ሁሉንም ሰነዶች ይቀበሉ — ከ{{total}} {{accepted}} ተቀብለዋል። የሰነዶች ትር ከፍተው ቀሪዎቹን ይቀበሉ።",
needsDocumentsUploaded: "እስካሁን የሚገመገም ሰነድ አልተጫነም",
},
reasons: {
incompleteDocuments: "ያልተሟሉ ሰነዶች",

View File

@@ -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',