mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 13:02:50 +00:00
feat: update document review progress tooltip with detailed counts and formatting
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -949,7 +949,9 @@ export const am: Translations = {
|
||||
needsFlags: "ማስተካከያ ለመጠየቅ ቢያንስ አንድ ነገር ምልክት ያድርጉ",
|
||||
needsCapital: "መጀመሪያ የተረጋገጠውን ካፒታል ይመዝግቡ",
|
||||
needsInspection: "የምርመራ ውጤት ያስፈልጋል",
|
||||
needsDocumentReviews: "መጀመሪያ ሁሉንም ሰነዶች ተቀበል",
|
||||
needsDocumentReviews:
|
||||
"መጀመሪያ ሁሉንም ሰነዶች ይቀበሉ — ከ{{total}} {{accepted}} ተቀብለዋል። የሰነዶች ትር ከፍተው ቀሪዎቹን ይቀበሉ።",
|
||||
needsDocumentsUploaded: "እስካሁን የሚገመገም ሰነድ አልተጫነም",
|
||||
},
|
||||
reasons: {
|
||||
incompleteDocuments: "ያልተሟሉ ሰነዶች",
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user