From c6e807d25d0393f0e91b2eb31f7fc4703c7c30d5 Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Sun, 24 May 2026 04:07:32 -0600 Subject: [PATCH] Fix shop card layout and spacing. Use compact self-contained item cards, wider shop shell, and responsive grid so buttons and labels stay inside each card. --- app/(app)/shop/page.tsx | 1 + components/shop/shop-content.tsx | 115 ++++++++++++++++--------------- 2 files changed, 62 insertions(+), 54 deletions(-) diff --git a/app/(app)/shop/page.tsx b/app/(app)/shop/page.tsx index 7754210..1ec6331 100644 --- a/app/(app)/shop/page.tsx +++ b/app/(app)/shop/page.tsx @@ -4,6 +4,7 @@ import { ShopContent } from "@/components/shop/shop-content"; export default function ShopPage() { return ( diff --git a/components/shop/shop-content.tsx b/components/shop/shop-content.tsx index fbd114b..ddbe3aa 100644 --- a/components/shop/shop-content.tsx +++ b/components/shop/shop-content.tsx @@ -5,13 +5,7 @@ import { useCallback, useEffect, useState } from "react"; import { TintedSpriteIcon } from "@/components/character/tinted-sprite-icon"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@/components/ui/card"; +import { Card, CardContent } from "@/components/ui/card"; import { useToast } from "@/components/ui/toast-provider"; import { HABIT_PET_DATA_UPDATED_EVENT } from "@/lib/app-events"; import { DEFAULT_GRAY_COLOR } from "@/lib/character/presets"; @@ -27,6 +21,7 @@ import { type ShopItemRecord, type ShopLayerId, } from "@/lib/shop-catalog"; +import { cn } from "@/lib/utils"; const SHOP_LAYER_ORDER: ShopLayerId[] = [ "head", @@ -55,50 +50,59 @@ function ShopItemCard({ }) { const room = item.type === "room" ? getRoomBackground(item.id) : null; + const actionLabel = (() => { + if (isPending) { + return owned ? "Updating..." : "Processing..."; + } + + if (owned) { + return equipped ? "Equipped" : "Equip"; + } + + if (!canAfford) { + return "Need more points"; + } + + return "Buy"; + })(); + return ( - - -
-
-
- {room ? ( -
- ) : ( - - )} -
-
- {item.name} - {item.id} -
+ + +
+
+ {room ? ( +
+ ) : ( + + )} +
+ +
+
+

{item.name}

+ + {item.price} pts + +
+

{item.id}

- {item.price} pts
- - - {!owned ? ( - - ) : ( - - )} + + ); @@ -198,13 +202,16 @@ export function ShopContent() { const roomItems = items.filter((item) => item.type === "room"); + const itemGridClassName = + "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3"; + return ( <> -
+
Your balance - + {coins === null ? "..." : `${coins} points`}
@@ -213,7 +220,7 @@ export function ShopContent() { {!error && coins !== null && items.length === 0 ? ( - +

Nothing in the shop right now. Keep completing habits and daily check-ins to earn points for when new styles arrive. @@ -222,13 +229,13 @@ export function ShopContent() { ) : null} -

+
{roomItems.length > 0 ? (

Room backgrounds

-
+
{roomItems.map((item) => ( {group.label} -
+
{group.items.map((item) => (