diff --git a/src/components/admin/AbandonedCartDashboard.tsx b/src/components/admin/AbandonedCartDashboard.tsx index 8aeee58..c12707f 100644 --- a/src/components/admin/AbandonedCartDashboard.tsx +++ b/src/components/admin/AbandonedCartDashboard.tsx @@ -5,11 +5,11 @@ import { getAbandonedCarts, manuallyCloseAbandonedCart, resendAbandonedCartEmail type Props = { brandId: string }; -const STATUS_LABELS: Record = { - active: { en: "Active", color: "bg-blue-900/40 text-blue-400 border border-blue-800" }, - recovered: { en: "Recovered", color: "bg-emerald-900/40 text-emerald-400 border border-emerald-800" }, - expired: { en: "Expired", color: "bg-zinc-800 text-zinc-400 border border-zinc-700" }, - manually_closed: { en: "Manually Closed", color: "bg-amber-900/40 text-amber-400 border border-amber-800" }, +const STATUS_LABELS: Record = { + active: { en: "Active", color: "bg-blue-50 text-blue-700 border border-blue-200" }, + recovered: { en: "Recovered", color: "bg-green-50 text-green-700 border border-green-200" }, + expired: { en: "Expired", color: "bg-stone-100 text-stone-500 border border-stone-200" }, + manually_closed: { en: "Manually Closed", color: "bg-amber-50 text-amber-700 border border-amber-200" }, }; const STEP_LABELS: Record = { @@ -21,10 +21,10 @@ const STEP_LABELS: Record = { function CartItemRow({ item }: { item: { name: string; quantity: number; unit_price: number } }) { return ( - - {item.name} - {item.quantity} - ${Number(item.unit_price).toFixed(2)} + + {item.name} + {item.quantity} + ${Number(item.unit_price).toFixed(2)} ); } @@ -82,14 +82,14 @@ export default function AbandonedCartDashboard({ brandId }: Props) { {/* Stats row */}
{[ - { label: "Total", value: stats.total, color: "text-zinc-100" }, - { label: "Active", value: stats.active, color: "text-blue-400" }, - { label: "Recovered", value: stats.recovered, color: "text-emerald-400" }, - { label: "Expired", value: stats.expired, color: "text-zinc-400" }, + { label: "Total", value: stats.total, color: "text-[var(--admin-text-primary)]" }, + { label: "Active", value: stats.active, color: "text-blue-600" }, + { label: "Recovered", value: stats.recovered, color: "text-green-600" }, + { label: "Expired", value: stats.expired, color: "text-[var(--admin-text-muted)]" }, ].map(s => ( -
+

{s.value}

-

{s.label}

+

{s.label}

))}
@@ -97,13 +97,13 @@ export default function AbandonedCartDashboard({ brandId }: Props) { {/* Filter + refresh + pagination */}
{(["all", "active", "recovered"] as const).map(f => ( ))} @@ -111,12 +111,12 @@ export default function AbandonedCartDashboard({ brandId }: Props) { {totalPages > 1 && (
- {page + 1}/{totalPages} + {page + 1}/{totalPages}
@@ -125,14 +125,14 @@ export default function AbandonedCartDashboard({ brandId }: Props) { {/* Carts table */} {filteredCarts.length === 0 ? ( -
-

No abandoned carts{filter !== "all" ? ` (${filter})` : ""}

+
+

No abandoned carts{filter !== "all" ? ` (${filter})` : ""}

) : ( -
+
- + @@ -146,35 +146,35 @@ export default function AbandonedCartDashboard({ brandId }: Props) { {paginatedCarts.map(c => { const meta = STATUS_LABELS[c.status] ?? STATUS_LABELS.active; return ( - + - - + + - +
Contact Items Total
-

{c.contact_name ?? "—"}

-

{c.contact_email}

+

{c.contact_name ?? "—"}

+

{c.contact_email}

{c.cart_snapshot.item_count} items${Number(c.cart_snapshot.subtotal).toFixed(2)}{c.cart_snapshot.item_count} items${Number(c.cart_snapshot.subtotal).toFixed(2)} - {STEP_LABELS[c.sequence_step] ?? c.sequence_step} + {STEP_LABELS[c.sequence_step] ?? c.sequence_step} {meta.en} {new Date(c.created_at).toLocaleDateString()}{new Date(c.created_at).toLocaleDateString()}
+ className="text-xs text-[var(--admin-text-muted)] hover:text-[var(--admin-text-primary)] px-2 py-1 rounded-lg hover:bg-stone-100 transition-all">View {c.status === "active" && ( + className="text-xs text-amber-600 hover:text-amber-700 px-2 py-1 rounded-lg hover:bg-amber-50 transition-all">Close )} {c.status === "active" && ( )} @@ -190,34 +190,34 @@ export default function AbandonedCartDashboard({ brandId }: Props) { {/* Cart detail modal */} {cart && ( -
setSelectedCart(null)}> -
e.stopPropagation()}> -
+
-

Abandoned Cart

-

{cart.contact_email}

+

Abandoned Cart

+

{cart.contact_email}

- +
-
+
{STATUS_LABELS[cart.status]?.en ?? cart.status}
-

{cart.contact_name ?? "—"}

-

{cart.contact_email}

-

Step: {STEP_LABELS[cart.sequence_step] ?? cart.sequence_step}

+

{cart.contact_name ?? "—"}

+

{cart.contact_email}

+

Step: {STEP_LABELS[cart.sequence_step] ?? cart.sequence_step}

-

Cart Items

+

Cart Items

- + @@ -229,19 +229,19 @@ export default function AbandonedCartDashboard({ brandId }: Props) { ))} - - - + + +
Item Qty Price
Total${Number(cart.cart_snapshot.subtotal).toFixed(2)}
Total${Number(cart.cart_snapshot.subtotal).toFixed(2)}
{cart.last_email_sent_at && ( -

Last email sent: {new Date(cart.last_email_sent_at).toLocaleString()}

+

Last email sent: {new Date(cart.last_email_sent_at).toLocaleString()}

)} {cart.next_email_at && ( -

Next email: {new Date(cart.next_email_at).toLocaleString()}

+

Next email: {new Date(cart.next_email_at).toLocaleString()}

)}
@@ -249,4 +249,4 @@ export default function AbandonedCartDashboard({ brandId }: Props) { )}
); -} +} \ No newline at end of file diff --git a/src/components/admin/WelcomeSequenceDashboard.tsx b/src/components/admin/WelcomeSequenceDashboard.tsx index 0c99dd1..74df868 100644 --- a/src/components/admin/WelcomeSequenceDashboard.tsx +++ b/src/components/admin/WelcomeSequenceDashboard.tsx @@ -6,10 +6,10 @@ import { getWelcomeSequence, resendWelcomeEmail, type WelcomeSequenceEntry } fro type Props = { brandId: string }; const STATUS_LABELS: Record = { - active: { en: "Active", color: "bg-blue-900/40 text-blue-400 border border-blue-800" }, - completed: { en: "Completed", color: "bg-emerald-900/40 text-emerald-400 border border-emerald-800" }, - unsubscribed: { en: "Unsubscribed", color: "bg-red-900/40 text-red-400 border border-red-800" }, - bounced: { en: "Bounced", color: "bg-amber-900/40 text-amber-400 border border-amber-800" }, + active: { en: "Active", color: "bg-blue-50 text-blue-700 border border-blue-200" }, + completed: { en: "Completed", color: "bg-green-50 text-green-700 border border-green-200" }, + unsubscribed: { en: "Unsubscribed", color: "bg-red-50 text-red-700 border border-red-200" }, + bounced: { en: "Bounced", color: "bg-amber-50 text-amber-700 border border-amber-200" }, }; const STEP_LABELS: Record = { @@ -62,14 +62,14 @@ export default function WelcomeSequenceDashboard({ brandId }: Props) { {/* Stats */}
{[ - { label: "Total", value: stats.total, color: "text-zinc-100" }, - { label: "Active", value: stats.active, color: "text-blue-400" }, - { label: "Completed", value: stats.completed, color: "text-emerald-400" }, - { label: "Unsubscribed", value: stats.unsubscribed, color: "text-red-400" }, + { label: "Total", value: stats.total, color: "text-[var(--admin-text-primary)]" }, + { label: "Active", value: stats.active, color: "text-blue-600" }, + { label: "Completed", value: stats.completed, color: "text-green-600" }, + { label: "Unsubscribed", value: stats.unsubscribed, color: "text-red-600" }, ].map(s => ( -
+

{s.value}

-

{s.label}

+

{s.label}

))}
@@ -77,13 +77,13 @@ export default function WelcomeSequenceDashboard({ brandId }: Props) { {/* Filter + refresh + pagination */}
{(["all", "active", "completed"] as const).map(f => ( ))} @@ -91,12 +91,12 @@ export default function WelcomeSequenceDashboard({ brandId }: Props) { {totalPages > 1 && (
- {page + 1}/{totalPages} + {page + 1}/{totalPages}
@@ -105,14 +105,14 @@ export default function WelcomeSequenceDashboard({ brandId }: Props) { {/* Table */} {filtered.length === 0 ? ( -
-

No entries{filter !== "all" ? ` (${filter})` : ""}

+
+

No entries{filter !== "all" ? ` (${filter})` : ""}

) : ( -
+
- + @@ -124,22 +124,22 @@ export default function WelcomeSequenceDashboard({ brandId }: Props) { {paginatedEntries.map(e => { - const meta = STATUS_LABELS[e.status] ?? { en: e.status, color: "bg-zinc-800 text-zinc-400" }; + const meta = STATUS_LABELS[e.status] ?? { en: e.status, color: "bg-stone-100 text-stone-500 border border-stone-200" }; return ( - + - - - +
Contact Language Step
-

{e.contact_name ?? "—"}

-

{e.contact_email}

+

{e.contact_name ?? "—"}

+

{e.contact_email}

- {e.locale} + {e.locale} + {STEP_LABELS[e.sequence_step] ?? e.sequence_step} {e.next_email_at && e.status === "active" && ( - Next: {new Date(e.next_email_at).toLocaleString()} + Next: {new Date(e.next_email_at).toLocaleString()} )} @@ -147,14 +147,14 @@ export default function WelcomeSequenceDashboard({ brandId }: Props) { {meta.en} {new Date(e.created_at).toLocaleDateString()} + {new Date(e.created_at).toLocaleDateString()} {e.last_email_sent_at ? new Date(e.last_email_sent_at).toLocaleString() : "—"} {e.status !== "unsubscribed" && ( )} @@ -168,4 +168,4 @@ export default function WelcomeSequenceDashboard({ brandId }: Props) { )} ); -} +} \ No newline at end of file