From ea12c2ec0b128a859a7442f4967137c1ea4a8c3d Mon Sep 17 00:00:00 2001 From: seaznCode Date: Fri, 20 Feb 2026 21:50:34 +0100 Subject: [PATCH] feat: add coffee image display in subscription items and optimize status rendering --- src/app/profile/subscriptions/page.tsx | 48 ++++++++++++++++++++------ 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/src/app/profile/subscriptions/page.tsx b/src/app/profile/subscriptions/page.tsx index fd83240..62dca15 100644 --- a/src/app/profile/subscriptions/page.tsx +++ b/src/app/profile/subscriptions/page.tsx @@ -91,6 +91,16 @@ export default function ProfileSubscriptionsPage() { }) }, [subscriptions]) + const coffeeImageById = React.useMemo(() => { + const map: Record = {} + coffees.forEach((coffee) => { + if (coffee.image) { + map[String(coffee.id)] = coffee.image + } + }) + return map + }, [coffees]) + if (!hasHydrated || !isAuthReady || !user) { return (
@@ -271,9 +281,11 @@ export default function ProfileSubscriptionsPage() { }`} >
-

- {subscription.name || `Subscription #${subscription.id}`} -

+
+

+ {subscription.name || `Subscription #${subscription.id}`} +

+
@@ -397,13 +409,29 @@ export default function ProfileSubscriptionsPage() {
) : (
- {includedItems.map((item, index) => ( -
-

{item.coffeeName || `Coffee #${item.coffeeId || index + 1}`}

-

Coffee ID: {item.coffeeId || '—'}

-

Packs included: {Number(item.quantity) || 0}

-
- ))} + {includedItems.map((item, index) => { + const imageUrl = item.coffeeId ? coffeeImageById[String(item.coffeeId)] : '' + return ( +
+
+
+

{item.coffeeName || `Coffee #${item.coffeeId || index + 1}`}

+

Coffee ID: {item.coffeeId || '—'}

+

Packs included: {Number(item.quantity) || 0}

+
+ {imageUrl ? ( + {item.coffeeName + ) : ( +
+ )} +
+
+ ) + })}
)}