From ed3bac8d49b4429b51953bb4ec552c66198a4648 Mon Sep 17 00:00:00 2001 From: SkyfallWasTaken Date: Sat, 22 Jun 2024 10:10:21 +0100 Subject: [PATCH] Add initial version of signed-out arcade shop --- components/arcade/prizes.js | 12 +- components/arcade/shop-component.js | 5 +- pages/api/arcade/shop.js | 289 +++++++++++++++++++++++++++- pages/arcade/shop.js | 89 +++++++++ 4 files changed, 376 insertions(+), 19 deletions(-) create mode 100644 pages/arcade/shop.js diff --git a/components/arcade/prizes.js b/components/arcade/prizes.js index fd6533b6..311c4c45 100644 --- a/components/arcade/prizes.js +++ b/components/arcade/prizes.js @@ -1,5 +1,5 @@ -import React, { useState, useRef, useEffect } from 'react' -import { Box, Button, Text, Flex, Grid, Card, Link, Close, Divider } from 'theme-ui' +import React from 'react' +import { Button, Text, Flex, Close, Divider } from 'theme-ui' import Balancer from 'react-wrap-balancer' import Quantity from './quantity' /** @jsxImportSource theme-ui */ @@ -14,11 +14,11 @@ const Prizes = ({ cost, polaroidRotation, ticketRotation, - link, + link = null, quantity, onQuantityChange, index, - hoursBalance, + hoursBalance = null, ...props }) => { const parsedFulfillmentDesc = fulfillmentDescription?.replace( @@ -96,11 +96,11 @@ const Prizes = ({ {// only show the quantity dropdown if you have enough hours to buy at least 2 of the item - hoursBalance / cost < 2 ? (null) : + (hoursBalance ? hoursBalance / cost < 2 : (null)) ? (null) : } { // only show the buy button if you have enough hours to buy at least 1 of the item - hoursBalance / cost < 1 ? (null) : + (hoursBalance ? hoursBalance / cost < 1 : (null)) ? (null) :