From 82b5aa8e23c39b52eca943ab6fc499c59dbc3774 Mon Sep 17 00:00:00 2001 From: Max Wofford Date: Sat, 15 Jun 2024 17:29:01 -0400 Subject: [PATCH] Include current user balance on shop --- .../arcade/{shop.js => shop-component.js} | 7 ++++-- pages/api/arcade/[userAirtableID]/index.js | 25 +++++++++++++++++++ pages/arcade/[userAirtableID]/shop.js | 25 +++++++++++++++---- 3 files changed, 50 insertions(+), 7 deletions(-) rename components/arcade/{shop.js => shop-component.js} (74%) create mode 100644 pages/api/arcade/[userAirtableID]/index.js diff --git a/components/arcade/shop.js b/components/arcade/shop-component.js similarity index 74% rename from components/arcade/shop.js rename to components/arcade/shop-component.js index ec923523..53f4ec79 100644 --- a/components/arcade/shop.js +++ b/components/arcade/shop-component.js @@ -1,4 +1,4 @@ -export default function ShopComponent({ availableItems, userAirtableID = null }) { +export default function ShopComponent({ availableItems, userAirtableID = null, hoursBalance = null }) { function buyLink(itemID, quantity = 1) { return `https://forms.hackclub.com/arcade-order?user_id=${userAirtableID}&item_id=${itemID}&quantity=${quantity}` } @@ -9,8 +9,11 @@ export default function ShopComponent({ availableItems, userAirtableID = null }) <>

Shop

for {userAirtableID} + {hoursBalance !== null && ( + You currently have {hoursBalance} 🎟️ tickets! + )}