feat(inbox): show extracted fakturadatum on inbox cards (#1542)

* feat(inbox): show extracted fakturadatum on inbox cards

Users with many invoices from the same supplier could not tell the
cards apart: the list only showed supplier name, arrival time, and
amount. Append the extracted invoice date (formatDate, tabular-nums)
after the arrival time on each card when extraction found one.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor(inbox): deduplicate the card timestamp span

The timeAgo + fakturadatum span was rendered verbatim in both branches
of the second-line conditional. Compute it once per row instead
(PR Agent review note on #1542).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Mattsson
2026-08-12 23:48:52 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent 45d7f1be4e
commit aff29b2b05
@@ -158,6 +158,10 @@ function pickSupplierName(item: InboxItem): string | null {
return item.extracted_data?.supplier?.name ?? null
}
function pickInvoiceDate(item: InboxItem): string | null {
return item.extracted_data?.invoice?.invoiceDate ?? null
}
// True when extraction produced at least one usable field. Distinguishes a
// deterministically-parsed underlag (fields present: render the editable
// list) from an item whose extracted_data is null/empty (AI never ran, or ran
@@ -1926,6 +1930,7 @@ function InboxRow({
const t = useTranslations('inbox_workspace')
const amount = pickAmount(item)
const supplierName = pickSupplierName(item)
const invoiceDate = pickInvoiceDate(item)
const isPlaceholder = !!item.isPlaceholder
const status = deriveInboxStatus(item)
const isErrored = status === 'error'
@@ -1937,6 +1942,15 @@ function InboxRow({
const hasUnansweredQuestion =
!isBooked && item.channel_context?.pending_question?.status === 'moved_to_app'
const receivedMeta = (
<span className="truncate">
{timeAgo(item.email_received_at ?? item.created_at)}
{invoiceDate && (
<> · <span className="tabular-nums">{formatDate(invoiceDate)}</span></>
)}
</span>
)
return (
<li
className={cn(
@@ -2016,10 +2030,10 @@ function InboxRow({
{t('wa_question_badge')}
</Badge>
)}
<span className="truncate">{timeAgo(item.email_received_at ?? item.created_at)}</span>
{receivedMeta}
</span>
) : (
<span className="truncate">{timeAgo(item.email_received_at ?? item.created_at)}</span>
receivedMeta
)}
{!isPlaceholder && amount != null && (
<span className="tabular-nums shrink-0">