From 46a462a0f48da4b7c78e3e21f0e83ef89743daa2 Mon Sep 17 00:00:00 2001 From: Yashas Date: Thu, 29 Oct 2026 11:56:58 +0530 Subject: [PATCH] Inbox: show who the enquiry came from and when it was received Co-Authored-By: Claude Fable 5.1 --- src/api/types.ts | 2 ++ src/screens/Enquiry.tsx | 1 + src/screens/Inbox.tsx | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/api/types.ts b/src/api/types.ts index b4dcc39..c82e4b5 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -17,6 +17,8 @@ export interface ActivityResult { success?: boolean; message?: string; instance_ export interface Enquiry { instance_id: number; current_state_name: string; + created_at: string | null; + updated_at: string | null; enquiry_ref: string | null; channel: string | null; customer_contact: string | null; diff --git a/src/screens/Enquiry.tsx b/src/screens/Enquiry.tsx index dd39324..037e673 100644 --- a/src/screens/Enquiry.tsx +++ b/src/screens/Enquiry.tsx @@ -112,6 +112,7 @@ export function EnquiryPage() { {e.customer_contact && (e.channel === 'email' || e.customer_contact.includes('@') ? {e.customer_contact} · email : +{e.customer_contact.replace(/^\+/, '')} · WhatsApp)} + {e.created_at && Received {timeAgo(e.created_at)}} {e.ai_summary &&

{e.ai_summary}

} {e.assigned_trader &&

Trader on this enquiry: {e.assigned_trader}

} diff --git a/src/screens/Inbox.tsx b/src/screens/Inbox.tsx index ecd86fb..82d0b78 100644 --- a/src/screens/Inbox.tsx +++ b/src/screens/Inbox.tsx @@ -4,7 +4,7 @@ import { Mail, MessageCircle, Search } from 'lucide-react'; import { useQuery, useZino } from '../api/provider'; import { RV_ENQUIRIES, STATES } from '../api/config'; import type { Enquiry } from '../api/types'; -import { Badge, Empty, ErrorNote, StateBadge, qtyText } from '../components/ui'; +import { Badge, Empty, ErrorNote, StateBadge, qtyText, timeAgo } from '../components/ui'; /** Which enquiries are waiting on THIS user. */ function needsMe(e: Enquiry, has: (...r: string[]) => boolean): boolean { @@ -67,10 +67,10 @@ export function Inbox() { {error && {error}}
- +
- + @@ -79,6 +79,8 @@ export function Inbox() { {shown.map((r) => ( nav(`/enquiries/${r.instance_id}`)} className="cursor-pointer border-b border-line last:border-0 hover:bg-surface-2"> + +
ReferenceVesselPortReferenceFromReceivedVesselPort ETA / LaycanProductQuantity BuyerTouch pointsStatus
{(r.customer_contact ?? '').includes('@') ? : }{r.enquiry_ref ?? `#${r.instance_id}`}{r.customer_contact ?? '-'}
{(r.customer_contact ?? '').includes('@') ? 'Email' : 'WhatsApp'}
{timeAgo(r.created_at) || '-'}{r.updated_at && r.updated_at !== r.created_at &&
updated {timeAgo(r.updated_at)}
}
{r.vessel_name ?? -}{r.imo_number &&
IMO {r.imo_number}
}
{r.port ?? '-'} {r.eta_laycan ?? '-'}