From 3f01d2e3763c9f8433420e8f91ff7af0378a44bc Mon Sep 17 00:00:00 2001
From: Naga Chaitanya Varma <69190057+Chay2203@users.noreply.github.com>
Date: Mon, 8 Apr 2024 11:19:50 +0000
Subject: [PATCH 1/7] changed the text in slack section
---
components/index/cards/slack.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/components/index/cards/slack.js b/components/index/cards/slack.js
index 3615bdf1..1fa6fa75 100644
--- a/components/index/cards/slack.js
+++ b/components/index/cards/slack.js
@@ -91,10 +91,10 @@ export default function Slack({ data, slackKey, events }) {
variant="subtitle"
sx={{ fontSize: [1, '16px', '24px'] }}
>
- Coding doesn’t have to be a solitary activity. At Hack Club, we
- make things together and in our Slack, you’ll find awesome people to
- hangout with too. Code together, find your programming community, or
- just hang out.
+ Coding doesn’t have to be a solitary activity. At Hack Club,
+ we make remarkable things together, and in our Slack you’ll find
+ awesome people to hang out with too. Code together, find your programming
+ community, dream up something wild, or just #lounge.
Occasionally we invite someone we really want to speak to (like Sal
From 6cd08ad7bc0a074df4ece359acdc57ddfc1f8b4e Mon Sep 17 00:00:00 2001
From: GitHub Action
Date: Mon, 15 Apr 2024 03:02:57 +0000
Subject: [PATCH 2/7] build: update Browserslist db
---
yarn.lock | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/yarn.lock b/yarn.lock
index 86add474..2118ffc2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3222,9 +3222,9 @@ camelize@^1.0.0:
integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==
caniuse-lite@^1.0.30001202, caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001228, caniuse-lite@^1.0.30001282, caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001517, caniuse-lite@^1.0.30001541:
- version "1.0.30001603"
- resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001603.tgz"
- integrity sha512-iL2iSS0eDILMb9n5yKQoTBim9jMZ0Yrk8g0N9K7UzYyWnfIKzXBZD5ngpM37ZcL/cv0Mli8XtVMRYMQAfFpi5Q==
+ version "1.0.30001610"
+ resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001610.tgz"
+ integrity sha512-QFutAY4NgaelojVMjY63o6XlZyORPaLfyMnsl3HgnWdJUcX6K0oaJymHjH8PT5Gk7sTm8rvC/c5COUQKXqmOMA==
caseless@~0.12.0:
version "0.12.0"
@@ -8239,16 +8239,7 @@ string-hash@1.1.3:
resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b"
integrity sha512-kJUvRUFK49aub+a7T1nNE66EJbZBMnBgoC1UbCZ5n6bsZKBRga4KgBRTMn/pFkeCZSYtNeSyMxPDM0AXWELk2A==
-"string-width-cjs@npm:string-width@^4.2.0":
- version "4.2.3"
- resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
- integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
- dependencies:
- emoji-regex "^8.0.0"
- is-fullwidth-code-point "^3.0.0"
- strip-ansi "^6.0.1"
-
-string-width@^4.1.0:
+"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
From 59d2ddc4ea40266659880fb4c23dcf3a56e3cfdd Mon Sep 17 00:00:00 2001
From: Mutammim <58490040+mutammim@users.noreply.github.com>
Date: Sun, 28 Apr 2024 18:37:44 -0400
Subject: [PATCH 3/7] Create apocalypse.js
---
components/index/cards/apocalypse.js | 98 ++++++++++++++++++++++++++++
1 file changed, 98 insertions(+)
create mode 100644 components/index/cards/apocalypse.js
diff --git a/components/index/cards/apocalypse.js b/components/index/cards/apocalypse.js
new file mode 100644
index 00000000..e8db052c
--- /dev/null
+++ b/components/index/cards/apocalypse.js
@@ -0,0 +1,98 @@
+import CardModel from './card-model'
+import { Box, Flex, Grid, Image, Text } from 'theme-ui'
+import Buttons from './button'
+
+/** @jsxImportSource theme-ui */
+
+export default function Apocalypse() {
+ return (
+
+
+
+
+
+
+
+ Downtown Toronto
+
+ May 17–19
+
+
+
+
+ Join Us
+
+
+
+
+ It's 2034, and zombies have taken over! But tech still operates.
+ What would you do?
+
+
+ Join 150 high schoolers for 44 hours at Apocalypse! Take yourself
+ out of the real world and build wacky projects to spark a new age of
+ humanity.
+
+
+
+
+ )
+}
From 9c2bfba6794dc7cefb835a197a6e4bd1b02ececf Mon Sep 17 00:00:00 2001
From: Mutammim <58490040+mutammim@users.noreply.github.com>
Date: Sun, 28 Apr 2024 18:38:43 -0400
Subject: [PATCH 4/7] Update index.js
---
pages/index.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pages/index.js b/pages/index.js
index 880fb0bf..1b79d863 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -40,6 +40,7 @@ import Photo from '../components/photo'
import Comma from '../components/comma'
import Haxidraw from '../components/index/cards/haxidraw'
import Onboard from '../components/index/cards/onboard'
+import Apocalypse from '../components/index/cards/apocalypse'
/** @jsxImportSource theme-ui */
@@ -675,6 +676,7 @@ function Page({
+
From 1dfee5debc1664a0f600de4619bf3a0f5b72c8ed Mon Sep 17 00:00:00 2001
From: Mutammim <58490040+mutammim@users.noreply.github.com>
Date: Sun, 28 Apr 2024 18:54:56 -0400
Subject: [PATCH 5/7] Improve mobile-friendliness of Apocalypse card
---
components/index/cards/apocalypse.js | 63 +++++++++++++++-------------
1 file changed, 34 insertions(+), 29 deletions(-)
diff --git a/components/index/cards/apocalypse.js b/components/index/cards/apocalypse.js
index e8db052c..852df47c 100644
--- a/components/index/cards/apocalypse.js
+++ b/components/index/cards/apocalypse.js
@@ -22,28 +22,33 @@ export default function Apocalypse() {
justifyContent: 'space-between'
}}
>
-
-
+
+
May 17–19
-
-
- Join Us
-
+
+ Join Us
+
+
Date: Mon, 29 Apr 2024 16:47:54 -0400
Subject: [PATCH 6/7] Add initial API for wokwi
---
package.json | 1 +
pages/api/bin/wokwi/new.js | 94 ++++++++++++++++++++++++++++++++++++
pages/api/bin/wokwi/parts.js | 29 +++++++++++
yarn.lock | 16 +++++-
4 files changed, 139 insertions(+), 1 deletion(-)
create mode 100644 pages/api/bin/wokwi/new.js
create mode 100644 pages/api/bin/wokwi/parts.js
diff --git a/package.json b/package.json
index f06dc8cb..07dd8a65 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,7 @@
"animated-value": "^0.2.4",
"animejs": "^3.2.2",
"axios": "^1.6.7",
+ "camelcase": "^8.0.0",
"cookies-next": "^4.0.0",
"country-list": "^2.3.0",
"country-list-js": "^3.1.8",
diff --git a/pages/api/bin/wokwi/new.js b/pages/api/bin/wokwi/new.js
new file mode 100644
index 00000000..2a21a7ba
--- /dev/null
+++ b/pages/api/bin/wokwi/new.js
@@ -0,0 +1,94 @@
+import AirtablePlus from "airtable-plus"
+
+const createProject = async (partsList=[]) => {
+ const airtable = new AirtablePlus({
+ apiKey: process.env.AIRTABLE_API_KEY,
+ baseID: 'appKjALSnOoA0EmPk',
+ tableName: 'Supported Parts'
+ })
+
+ const parts = [
+ { "type": "board-pi-pico-w", "id": "pico", "top": 0, "left": 0, "attrs": {} }
+ ]
+
+ await Promise.all(partsList.map(async (part) => {
+ const airPart = await airtable.read({
+ filterByFormula: `{Wokwi Name}= "${part}"`,
+ maxRecords: 1
+ })
+ return airPart[0].fields['Wokwi Name'].split(',').forEach((name, i) => {
+ parts.push({
+ type: name,
+ id: name + '-' + i,
+ left: i * 100, // this is roughtly the width of most parts
+ })
+ })
+ }))
+
+ const body = JSON.stringify({
+ name: "The Bin!",
+ unlisted: false,
+ files: [{
+ name: "help.txt",
+ content: `
+# Welcome to The Bin!
+
+Build
+ `
+ },
+ {
+ name: "sketch.ino",
+ content: `// Now turn this trash into treasure!
+// Want some help? You can chat with us on the Hack Club Slack in the #electronics channel
+void setup() {
+ // put your setup code here, to run once:
+ Serial1.begin(115200);
+ Serial1.println("Hello, Raspberry Pi Pico W!");
+}
+void loop() {
+ // put your main code here, to run repeatedly:
+ delay(1); // this speeds up the simulation
+}`
+ }, {
+ name: "diagram.json",
+ content: JSON.stringify({
+ "version": 1,
+ "author": "The Bin - Hack Club",
+ "editor": "wokwi",
+ "parts": parts,
+ "connections": [["pico:GP0", "$serialMonitor:RX", "", []], ["pico:GP1", "$serialMonitor:TX", "", []]], "dependencies": {}
+ }, null, 2)
+ }],
+ })
+
+ const response = await fetch('https://wokwi.com/api/projects/save', {
+ method: 'POST',
+ cors: 'no-cors',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Referer': 'https://wokwi.com/projects/new/pi-pico-w',
+ 'User-Agent': 'Hack Club - contact max@hackclub.com for any complaints!'
+ },
+ body
+ }).catch((e) => {
+ console.log(e)
+ })
+
+ const data = await response.json()
+ const { projectId } = data
+
+ return `https://wokwi.com/projects/${projectId}`
+}
+
+export default async function handler(req, res) {
+ if (req.method === 'POST') {
+ const { parts } = req.body
+
+ const shareLink = await createProject(parts)
+ if (shareLink) {
+ res.status(200).json({ shareLink })
+ } else {
+ res.status(500).json({ error: 'Failed to create project' })
+ }
+ }
+}
\ No newline at end of file
diff --git a/pages/api/bin/wokwi/parts.js b/pages/api/bin/wokwi/parts.js
new file mode 100644
index 00000000..f01bdbd1
--- /dev/null
+++ b/pages/api/bin/wokwi/parts.js
@@ -0,0 +1,29 @@
+import AirtablePlus from "airtable-plus"
+import camelcase from "camelcase"
+
+const camelizeObject = (obj) => {
+ Object.keys(obj).forEach(key => {
+ obj[camelcase(key)] = obj[key]
+ if (key !== camelcase(key)) {
+ delete obj[key]
+ }
+ })
+ return obj
+}
+
+const wokwiParts = async () => {
+ const airtable = new AirtablePlus({
+ apiKey: process.env.AIRTABLE_API_KEY,
+ baseID: 'appKjALSnOoA0EmPk',
+ tableName: 'Supported Parts'
+ })
+
+ const records = await airtable.read()
+ const parts = records.map(record => camelizeObject(record.fields))
+ return parts
+}
+
+export default async function handler(req, res) {
+ const data = await wokwiParts()
+ res.status(200).json(data)
+}
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 2ee0c636..96487326 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3216,6 +3216,11 @@ camelcase@^5.3.1:
resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
+camelcase@^8.0.0:
+ version "8.0.0"
+ resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-8.0.0.tgz#c0d36d418753fb6ad9c5e0437579745c1c14a534"
+ integrity sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==
+
camelize@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.1.tgz#89b7e16884056331a35d6b5ad064332c91daa6c3"
@@ -8239,7 +8244,16 @@ string-hash@1.1.3:
resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b"
integrity sha512-kJUvRUFK49aub+a7T1nNE66EJbZBMnBgoC1UbCZ5n6bsZKBRga4KgBRTMn/pFkeCZSYtNeSyMxPDM0AXWELk2A==
-"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
+"string-width-cjs@npm:string-width@^4.2.0":
+ version "4.2.3"
+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
+ integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
+ dependencies:
+ emoji-regex "^8.0.0"
+ is-fullwidth-code-point "^3.0.0"
+ strip-ansi "^6.0.1"
+
+string-width@^4.1.0:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
From 7817ebe44acf340c80331bcb8fe9ebcbd1a4248e Mon Sep 17 00:00:00 2001
From: Max Wofford
Date: Mon, 29 Apr 2024 23:26:42 -0400
Subject: [PATCH 7/7] Create new wokwi help message
---
pages/api/bin/wokwi/new.js | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/pages/api/bin/wokwi/new.js b/pages/api/bin/wokwi/new.js
index 2a21a7ba..6fc38f34 100644
--- a/pages/api/bin/wokwi/new.js
+++ b/pages/api/bin/wokwi/new.js
@@ -29,11 +29,21 @@ const createProject = async (partsList=[]) => {
name: "The Bin!",
unlisted: false,
files: [{
- name: "help.txt",
- content: `
-# Welcome to The Bin!
+ name: "help.md",
+ content: `# Welcome to The Bin! 🦝
-Build
+Now that you've thrown some parts into The Bin, it's time to turn that trash into treasure! 🗑️➡️💎
+
+Wire up your parts and write some code to make them work together.
+
+If you'd like a tutorial, check out some sample projects:
+https://jams.hackclub.com/tags/the-bin
+
+You can get help by chatting with other high schoolers on the Hack Club Slack in the #electronics channel:
+👉 https://hackclub.com/slack 👈
+
+Once you're ready build your design IRL, click the "Share" button and submit your design:
+https://hackclub.com/bin/submit
`
},
{