From ed3bac8d49b4429b51953bb4ec552c66198a4648 Mon Sep 17 00:00:00 2001 From: SkyfallWasTaken Date: Sat, 22 Jun 2024 10:10:21 +0100 Subject: [PATCH 1/6] 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) : - } - + + + + + You can order up to {quantity} of these + + + + {link && ( + { + // only show the quantity dropdown if you have enough hours to buy at least 2 of the item + (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 ? hoursBalance / cost < 1 : null) ? null : ( + + ) + } - )} + )} + + - Date: Sat, 22 Jun 2024 10:55:03 +0100 Subject: [PATCH 3/6] Use Airtable for shop again --- pages/api/arcade/shop.js | 309 +++------------------------------------ pages/arcade/shop.js | 7 +- 2 files changed, 23 insertions(+), 293 deletions(-) diff --git a/pages/api/arcade/shop.js b/pages/api/arcade/shop.js index 22863d16..18df4d0e 100644 --- a/pages/api/arcade/shop.js +++ b/pages/api/arcade/shop.js @@ -1,297 +1,28 @@ import AirtablePlus from "airtable-plus" export const shopParts = async () => { -return [ - { - "Name": "Pile of stickers", - "Small Name": null, - "Full Name": "Pile of stickers ", - "Description": "Dealer's choice! We'll send you 3 random stickers. You can have whatever you want, as long as it's random!", - "Fulfillment Description": "Available anywhere\n", - "Cost Hours": 1, - "id": "rec7rzTHzjLa1ZysL", - "Image URL": "https://cloud-c1gqq7ttf-hack-club-bot.vercel.app/0sticker_pile_2.png", - "Max Order Quantity": 10 - }, - { - "Name": "Sticker", - "Small Name": "of your choice", - "Full Name": "Sticker of your choice", - "Description": null, - "Fulfillment Description": "Available anywhere\n", - "Cost Hours": 2, - "id": "recvsJVFthUTnozTO", - "Image URL": "https://cloud-50x4zfjwx-hack-club-bot.vercel.app/0enjoy_1.png", - "Max Order Quantity": 10 - }, - { - "Name": "OpenAI credits", - "Small Name": null, - "Full Name": "OpenAI credits ", - "Description": null, - "Fulfillment Description": "Available anywhere\n", - "Cost Hours": 4, - "id": "recJN0RO9obEGqP6e", - "Image URL": "https://cloud-nozsvexvx-hack-club-bot.vercel.app/0universal_paperclips_title_screen.png", - "Max Order Quantity": 1 - }, - { - "Name": "Domain", - "Small Name": "for 1 year", - "Full Name": "Domain for 1 year", - "Description": null, - "Fulfillment Description": "Available anywhere\n", - "Cost Hours": 4, - "id": "reca4tNvbZ6JLTcUH", - "Image URL": "https://cloud-5ttcbislu-hack-club-bot.vercel.app/2screenshot_2024-06-16_at_19.34.55.png", - "Max Order Quantity": 10 - }, - { - "Name": "Notebook", - "Small Name": "from GitHub", - "Full Name": "Notebook from GitHub", - "Description": "A Denik Layflat from the [GitHub Shop](https://www.thegithubshop.com/1455318-00-denik-layflat-notebook)", - "Fulfillment Description": "Ships to any country, but you may need to pay customs fees. Order shipped through \n", - "Cost Hours": 5, - "id": "recPP2L3kPwDYmu0B", - "Image URL": "https://cloud-2wpezbt6a-hack-club-bot.vercel.app/0notebook.png", - "Max Order Quantity": 1 - }, - { - "Name": "Logic Analyzer", - "Small Name": null, - "Full Name": "Logic Analyzer ", - "Description": null, - "Fulfillment Description": "Available in US, IN, EU, CA, SG & AU. Fulfilled by Amazon.\n", - "Cost Hours": 5, - "id": "recYa7NF3Amqcvf0i", - "Image URL": "https://cloud-re8ou8f0i-hack-club-bot.vercel.app/0image.png", - "Max Order Quantity": 5 - }, - { - "Name": "Breadboard", - "Small Name": "+ jumper wires", - "Full Name": "Breadboard + jumper wires", - "Description": null, - "Fulfillment Description": "Available in US, IN, EU, CA, SG & AU. Fulfilled by Amazon.\n", - "Cost Hours": 6, - "id": "rec3kwLZQjCB84lpT", - "Image URL": "https://cloud-ogt9k4r4u-hack-club-bot.vercel.app/0breadboard.png", - "Max Order Quantity": 10 - }, - { - "Name": "Multimeter", - "Small Name": null, - "Full Name": "Multimeter ", - "Description": null, - "Fulfillment Description": "Available in US, IN, EU, CA, SG & AU. Fulfilled by Amazon.\n", - "Cost Hours": 7, - "id": "recDJkGhWEU60NmBV", - "Image URL": "https://cloud-fyxfbdwdl-hack-club-bot.vercel.app/0multimeter.png", - "Max Order Quantity": 5 - }, - { - "Name": "Arcade Ticket Counter", - "Small Name": "(Timer)", - "Full Name": "Arcade Ticket Counter (Timer)", - "Description": "(formerly the Hack Hour Clock)\n", - "Fulfillment Description": "Fulfilled by USPS. Customs fees may apply if outside the US.\n", - "Cost Hours": 7, - "id": "recFlQknheFuFs4e9", - "Image URL": "https://cloud-for73aw9b-hack-club-bot.vercel.app/019719_3.png", - "Max Order Quantity": 1 - }, - { - "Name": "Soldering iron", - "Small Name": "+ solder", - "Full Name": "Soldering iron + solder", - "Description": null, - "Fulfillment Description": "Available in US, IN, EU, CA, SG & AU. Fulfilled by Amazon.\n", - "Cost Hours": 8, - "id": "rec5ssvcMqrSKneac", - "Image URL": "https://cloud-amz50nt0a-hack-club-bot.vercel.app/0soldering_iron.png", - "Max Order Quantity": 5 - }, - { - "Name": "Pinecil", - "Small Name": null, - "Full Name": "Pinecil ", - "Description": null, - "Fulfillment Description": "Fulfilled by USPS. Customs fees may apply if outside the US.\n", - "Cost Hours": 14, - "id": "recSXzyxP636j4dee", - "Image URL": "https://cloud-3lhacr9fo-hack-club-bot.vercel.app/061ix8eet_dl._ac_sx679_.png", - "Max Order Quantity": 1 - }, - { - "Name": "YubiKey", - "Small Name": null, - "Full Name": "YubiKey ", - "Description": null, - "Fulfillment Description": "Fulfilled by USPS. Customs fees may apply if outside the US.\n", - "Cost Hours": 15, - "id": "rec1pCxBpw737NP3I", - "Image URL": "https://cloud-elfpck7gj-hack-club-bot.vercel.app/0screenshot_2024-06-14_at_07.42.35.png", - "Max Order Quantity": 5 - }, - { - "Name": "GitHub Keycaps", - "Small Name": "x8", - "Full Name": "GitHub Keycaps x8", - "Description": null, - "Fulfillment Description": "Fulfilled by USPS. Customs fees may apply if outside the US.\n", - "Cost Hours": 15, - "id": "recCEtkEWr6u8mCfd", - "Image URL": "https://cloud-q3hnx73my-hack-club-bot.vercel.app/01542509_z_copy.png", - "Max Order Quantity": 1 - }, - { - "Name": "Octocat", - "Small Name": "Plushie", - "Full Name": "Octocat Plushie", - "Description": null, - "Fulfillment Description": "Fulfilled by USPS. Customs fees may apply if outside the US.\n", - "Cost Hours": 15, - "id": "reczeivgpqIj7ajA2", - "Image URL": "https://cloud-n716uf1pe-hack-club-bot.vercel.app/0gh_0008_z_dd7b_copy.png", - "Max Order Quantity": 1 - }, - { - "Name": "Wacom", - "Small Name": "Intuos S", - "Full Name": "Wacom Intuos S", - "Description": null, - "Fulfillment Description": "Available in US, IN, EU, CA, SG & AU. Fulfilled by Amazon.\n", - "Cost Hours": 25, - "id": "recoatqwqCXrsiAoz", - "Image URL": "https://cloud-bj39a8875-hack-club-bot.vercel.app/061pz9ub2wul._ac_sx679_.png", - "Max Order Quantity": 1 - }, - { - "Name": "Invertocat Backback", - "Small Name": "MIIR", - "Full Name": "Invertocat Backback MIIR", - "Description": null, - "Fulfillment Description": "Fulfilled by USPS. Customs fees may apply if outside the US.\n", - "Cost Hours": 50, - "id": "rec5i2AZtzHAG5znC", - "Image URL": "https://cloud-2wpezbt6a-hack-club-bot.vercel.app/1miir.png", - "Max Order Quantity": 1 - }, - { - "Name": "Flipper", - "Small Name": "Zero", - "Full Name": "Flipper Zero", - "Description": null, - "Fulfillment Description": "Available in US & EU. Fulfilled by [Flipper Zero](https://shop.flipperzero.one/policies/shipping-policy).\n", - "Cost Hours": 70, - "id": "recDmVbngx6NdN6pA", - "Image URL": "https://cloud-p2gdpsmd3-hack-club-bot.vercel.app/0top.png", - "Max Order Quantity": 1 - }, - { - "Name": "Mechanical Keyboard", - "Small Name": "MX", - "Full Name": "Mechanical Keyboard MX", - "Description": null, - "Fulfillment Description": "Fulfilled by USPS. Customs fees may apply if outside the US.\n", - "Cost Hours": 75, - "id": "recrybqL6E6d4tzoe", - "Image URL": "https://cloud-gt96uxjmh-hack-club-bot.vercel.app/061__ok6aqtl._ac_uf894_1000_ql80_.png", - "Max Order Quantity": 1 - }, - { - "Name": "Framework", - "Small Name": "factory seconds", - "Full Name": "Framework factory seconds", - "Description": null, - "Fulfillment Description": "Available in [specific countries](https://knowledgebase.frame.work/what-countries-and-regions-do-you-ship-to-r1899ikiO). Ships via USPS– customs fees may apply.\n", - "Cost Hours": 120, - "id": "reciRscdVv46bC7cf", - "Image URL": "https://cloud-elfpck7gj-hack-club-bot.vercel.app/1screenshot_2024-06-14_at_07.39.22.png", - "Max Order Quantity": 1 - }, - { - "Name": "Prusa", - "Small Name": "MINI+", - "Full Name": "Prusa MINI+", - "Description": null, - "Fulfillment Description": "Available in US & EU. Customs fees outside the EU [may apply](https://help.prusa3d.com/article/vat-value-added-tax-customs-fees_1505#orders-outside-eu).\n", - "Cost Hours": 130, - "id": "recCeMp5iK7tRpqc3", - "Image URL": "https://cloud-cqnd9gu78-hack-club-bot.vercel.app/1prusa.png", - "Max Order Quantity": 1 - }, - { - "Name": "Bambu Lab", - "Small Name": "A1 mini", - "Full Name": "Bambu Lab A1 mini", - "Description": null, - "Fulfillment Description": "Available in US, CA, & EU. Shipping provided by Bambu Lab.\n", - "Cost Hours": 135, - "id": "rec58YSzn7V5x1GPR", - "Image URL": "https://cloud-n8ijhwk64-hack-club-bot.vercel.app/0a1_mini.png", - "Max Order Quantity": 1 - }, - { - "Name": "Framework", - "Small Name": "13 inch", - "Full Name": "Framework 13 inch", - "Description": null, - "Fulfillment Description": "Available in [specific countries](https://knowledgebase.frame.work/what-countries-and-regions-do-you-ship-to-r1899ikiO). Ships via USPS– customs fees may apply.\n", - "Cost Hours": 175, - "id": "recj3qt349e2KXW6X", - "Image URL": "https://cloud-g0bjmr0sz-hack-club-bot.vercel.app/013in.png", - "Max Order Quantity": 1 - }, - { - "Name": "Quest 3", - "Small Name": null, - "Full Name": "Quest 3 ", - "Description": null, - "Fulfillment Description": "Available in [specific countries](https://www.meta.com/help/orders-and-returns/articles/quest-supported-countries/). Fulfilled by Meta.\n", - "Cost Hours": 200, - "id": "recuol7Uk5Z2sjViv", - "Image URL": "https://cloud-7x2qyu0b9-hack-club-bot.vercel.app/0screenshot_2024-06-14_at_08.46.20.png", - "Max Order Quantity": 1 - }, - { - "Name": "Framework", - "Small Name": "16 inch", - "Full Name": "Framework 16 inch", - "Description": null, - "Fulfillment Description": "Available in [specific countries](https://knowledgebase.frame.work/what-countries-and-regions-do-you-ship-to-r1899ikiO). Ships via USPS– customs fees may apply.\n", - "Cost Hours": 400, - "id": "rec9cXQSlAJVnfJkv", - "Image URL": "https://cloud-cqnd9gu78-hack-club-bot.vercel.app/0framework.png", - "Max Order Quantity": 1 - }, - { - "Name": "MacBook", - "Small Name": "Air M2", - "Full Name": "MacBook Air M2", - "Description": null, - "Fulfillment Description": "Available in any country Apple ships to (e.g. US or IN).\n", - "Cost Hours": 400, - "id": "recFT8SlSOxFrG9ha", - "Image URL": "https://cloud-9zwbzfbtw-hack-club-bot.vercel.app/00image_from_ios-removebg-preview.png", - "Max Order Quantity": 1 - } -]} + const airtable = new AirtablePlus({ + apiKey: process.env.AIRTABLE_API_KEY, + baseID: "app4kCWulfB02bV8Q", + tableName: "Shop Items" + }) + + const records = await airtable.read() + return records.map(record => ({ id: record.id, ...record.fields })) +} -// FIXME: does not connect to Airtable (for local development) export default async function handler(req, res) { - const data = await shopParts() + const data = await shopParts() - const filteredData = data.map(record => { - return { - name: record['Name'], - smallName: record['Small Name'], - description: record['Description'], - hours: record['Cost Hours'], - imageURL: record['Image URL'], - } - }) + const filteredData = data.filter(record => record["Enabled"]).map(record => { + return { + name: record['Name'], + smallName: record['Small Name'], + description: record['Description'], + hours: record['Cost Hours'], + imageURL: record['Image URL'], + } + }) - res.json(filteredData) + res.json(filteredData) } \ No newline at end of file diff --git a/pages/arcade/shop.js b/pages/arcade/shop.js index c81c6735..200e4500 100644 --- a/pages/arcade/shop.js +++ b/pages/arcade/shop.js @@ -25,7 +25,7 @@ body { ` export default function Shop({ availableItems, userAirtableID = null, hoursBalance = 0 }) { - + return ( <> { - // FIXME: should be filtered by item['Enabled'] in production - const availableItems = items.map(item => ({ + const availableItems = items.filter((item) => item['Enabled']).map(item => ({ 'Name': item['Name'] || null, 'Small Name': item['Small Name'] || null, 'Full Name': item['Full Name'] || null, @@ -84,6 +83,6 @@ export async function getStaticProps() { props.availableItems = availableItems }), ]) - + return { props, revalidate: 10 } } From 7c38e6d56c2246789189f978f33ccbc350b6c0f5 Mon Sep 17 00:00:00 2001 From: SkyfallWasTaken Date: Sat, 22 Jun 2024 11:15:41 +0100 Subject: [PATCH 4/6] Placate ESLint --- components/arcade/prizes.js | 6 +++--- package.json | 3 ++- pages/api/arcade/hack-hour/inventory.js | 6 +++--- pages/arcade/index.js | 11 ++++++----- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/components/arcade/prizes.js b/components/arcade/prizes.js index 3da73a24..acb9767e 100644 --- a/components/arcade/prizes.js +++ b/components/arcade/prizes.js @@ -65,7 +65,7 @@ const Prizes = ({ alt={text} /> - {stock && stock != null && stock > 0 && stock <= 100 && ( + {stock && stock !== null && stock > 0 && stock <= 100 && ( - {cost} {link ? '🎟️' : cost == 1 ? 'ticket' : 'tickets'} + {cost} {link ? '🎟️' : cost === 1 ? 'ticket' : 'tickets'} - {cost} {cost == 1 ? 'ticket' : 'tickets'} + {cost} {cost === 1 ? 'ticket' : 'tickets'} diff --git a/package.json b/package.json index 3f2f4269..7a8f26d9 100644 --- a/package.json +++ b/package.json @@ -95,5 +95,6 @@ "eslint": "8.57.0", "eslint-config-next": "14.1.0", "prettier": "^3.2.5" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/pages/api/arcade/hack-hour/inventory.js b/pages/api/arcade/hack-hour/inventory.js index 143f9833..86039539 100644 --- a/pages/api/arcade/hack-hour/inventory.js +++ b/pages/api/arcade/hack-hour/inventory.js @@ -35,10 +35,10 @@ export default async function handler(req, res) { smallName: record.fields['Name Small Text'], hours: record.fields['Hours'], imageURL: record.fields['Image URL'], - formURL: record.fields['Order Form URL'], + formURL: record.fields['Order Form URL'], description: record.fields['Description'], flavorText: record?.fields['Flavor text']?.map(recordID => { - const flavorRecord = data.flavor.find(f => f.id == recordID) + const flavorRecord = data.flavor.find(f => f.id === recordID) const result = { message: flavorRecord.fields["Message"], character: flavorRecord.fields["Character"], @@ -66,5 +66,5 @@ export default async function handler(req, res) { }) }) - res.status(200).json({inventory: inventoryResults, selfClicks}) + res.status(200).json({ inventory: inventoryResults, selfClicks }) } diff --git a/pages/arcade/index.js b/pages/arcade/index.js index 4ba154fa..cb485b94 100644 --- a/pages/arcade/index.js +++ b/pages/arcade/index.js @@ -257,10 +257,10 @@ const Powerups = ({ variant="headline" className="gaegu" > - {cost} {cost == 1 ? 'ticket' : 'tickets'} + {cost} {cost === 1 ? 'ticket' : 'tickets'} {extraTags?.map((tag, i) => { - if (tag == 'Limited Supply') { + if (tag === 'Limited Supply') { return ( - {cost} {cost == 1 ? 'ticket' : 'tickets'} + {cost} {cost === 1 ? 'ticket' : 'tickets'} @@ -407,7 +407,7 @@ const Intro = ({ title, num, text, img, third, ...props }) => { className="gaegu" sx={{ display: 'block', - width: third == 'true' ? ['100%', '100%', '100%', '70%'] : '100%' + width: third === 'true' ? ['100%', '100%', '100%', '70%'] : '100%' }} > {title} @@ -954,7 +954,7 @@ const Arcade = ({ paddingBottom: '20vh' }} > - {slack == 'slack' ? ( + {slack === 'slack' ? ( Orpheus with a Flipper Zero, a MacBook Air, and other prizes Date: Sun, 23 Jun 2024 16:29:40 +0100 Subject: [PATCH 5/6] Revert "Placate ESLint" This reverts commit 7c38e6d56c2246789189f978f33ccbc350b6c0f5. --- components/arcade/prizes.js | 6 +++--- package.json | 3 +-- pages/api/arcade/hack-hour/inventory.js | 6 +++--- pages/arcade/index.js | 11 +++++------ 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/components/arcade/prizes.js b/components/arcade/prizes.js index acb9767e..3da73a24 100644 --- a/components/arcade/prizes.js +++ b/components/arcade/prizes.js @@ -65,7 +65,7 @@ const Prizes = ({ alt={text} /> - {stock && stock !== null && stock > 0 && stock <= 100 && ( + {stock && stock != null && stock > 0 && stock <= 100 && ( - {cost} {link ? '🎟️' : cost === 1 ? 'ticket' : 'tickets'} + {cost} {link ? '🎟️' : cost == 1 ? 'ticket' : 'tickets'} - {cost} {cost === 1 ? 'ticket' : 'tickets'} + {cost} {cost == 1 ? 'ticket' : 'tickets'} diff --git a/package.json b/package.json index 7a8f26d9..3f2f4269 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,5 @@ "eslint": "8.57.0", "eslint-config-next": "14.1.0", "prettier": "^3.2.5" - }, - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" + } } diff --git a/pages/api/arcade/hack-hour/inventory.js b/pages/api/arcade/hack-hour/inventory.js index 86039539..143f9833 100644 --- a/pages/api/arcade/hack-hour/inventory.js +++ b/pages/api/arcade/hack-hour/inventory.js @@ -35,10 +35,10 @@ export default async function handler(req, res) { smallName: record.fields['Name Small Text'], hours: record.fields['Hours'], imageURL: record.fields['Image URL'], - formURL: record.fields['Order Form URL'], + formURL: record.fields['Order Form URL'], description: record.fields['Description'], flavorText: record?.fields['Flavor text']?.map(recordID => { - const flavorRecord = data.flavor.find(f => f.id === recordID) + const flavorRecord = data.flavor.find(f => f.id == recordID) const result = { message: flavorRecord.fields["Message"], character: flavorRecord.fields["Character"], @@ -66,5 +66,5 @@ export default async function handler(req, res) { }) }) - res.status(200).json({ inventory: inventoryResults, selfClicks }) + res.status(200).json({inventory: inventoryResults, selfClicks}) } diff --git a/pages/arcade/index.js b/pages/arcade/index.js index cb485b94..4ba154fa 100644 --- a/pages/arcade/index.js +++ b/pages/arcade/index.js @@ -257,10 +257,10 @@ const Powerups = ({ variant="headline" className="gaegu" > - {cost} {cost === 1 ? 'ticket' : 'tickets'} + {cost} {cost == 1 ? 'ticket' : 'tickets'} {extraTags?.map((tag, i) => { - if (tag === 'Limited Supply') { + if (tag == 'Limited Supply') { return ( - {cost} {cost === 1 ? 'ticket' : 'tickets'} + {cost} {cost == 1 ? 'ticket' : 'tickets'} @@ -407,7 +407,7 @@ const Intro = ({ title, num, text, img, third, ...props }) => { className="gaegu" sx={{ display: 'block', - width: third === 'true' ? ['100%', '100%', '100%', '70%'] : '100%' + width: third == 'true' ? ['100%', '100%', '100%', '70%'] : '100%' }} > {title} @@ -954,7 +954,7 @@ const Arcade = ({ paddingBottom: '20vh' }} > - {slack === 'slack' ? ( + {slack == 'slack' ? ( Orpheus with a Flipper Zero, a MacBook Air, and other prizes Date: Sun, 23 Jun 2024 16:34:13 +0100 Subject: [PATCH 6/6] Undo formatting in shop.js --- pages/api/arcade/shop.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pages/api/arcade/shop.js b/pages/api/arcade/shop.js index 18df4d0e..ea5b6224 100644 --- a/pages/api/arcade/shop.js +++ b/pages/api/arcade/shop.js @@ -1,28 +1,28 @@ import AirtablePlus from "airtable-plus" export const shopParts = async () => { - const airtable = new AirtablePlus({ - apiKey: process.env.AIRTABLE_API_KEY, - baseID: "app4kCWulfB02bV8Q", - tableName: "Shop Items" - }) + const airtable = new AirtablePlus({ + apiKey: process.env.AIRTABLE_API_KEY, + baseID: "app4kCWulfB02bV8Q", + tableName: "Shop Items" + }) - const records = await airtable.read() - return records.map(record => ({ id: record.id, ...record.fields })) + const records = await airtable.read() + return records.map(record => ({id: record.id, ...record.fields})) } export default async function handler(req, res) { - const data = await shopParts() + const data = await shopParts() - const filteredData = data.filter(record => record["Enabled"]).map(record => { - return { - name: record['Name'], - smallName: record['Small Name'], - description: record['Description'], - hours: record['Cost Hours'], - imageURL: record['Image URL'], - } - }) + const filteredData = data.filter(record => record["Enabled"]).map(record => { + return { + name: record['Name'], + smallName: record['Small Name'], + description: record['Description'], + hours: record['Cost Hours'], + imageURL: record['Image URL'], + } + }) - res.json(filteredData) + res.json(filteredData) } \ No newline at end of file