Skip to content

Commit

Permalink
Merge branch 'main' into text
Browse files Browse the repository at this point in the history
  • Loading branch information
grymmy authored Apr 30, 2024
2 parents 3f01d2e + b325e3b commit 6e47fa3
Show file tree
Hide file tree
Showing 18 changed files with 382 additions and 79 deletions.
2 changes: 0 additions & 2 deletions components/bin/rsvp-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export default function RsvpForm() {
<Input
{...useField('address_line_1')}
placeholder="1 Hacker Way"
required
sx={{ border: '1px solid', borderColor: 'muted' }}
/>
</Label>
Expand All @@ -49,7 +48,6 @@ export default function RsvpForm() {
<Input
{...useField('address_zip')}
placeholder="01337"
required
sx={{ border: '1px solid', borderColor: 'muted' }}
/>
</Label>
Expand Down
103 changes: 103 additions & 0 deletions components/index/cards/apocalypse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
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 (
<CardModel
color="white"
sx={{
backgroundSize: 'cover',
backgroundColor: '#95C9E5'
}}
position={[null, 'bottom', 'bottom']}
image="https://cloud-1132qsbcy-hack-club-bot.vercel.app/0image__6_.png"
>
<Grid columns={[1, 1, 2]} sx={{ position: 'relative', zIndex: 2 }}>
<Flex
sx={{
flexDirection: 'column',
justifyContent: 'space-between'
}}
>
<Image
src="https://cloud-lvxa0tab7-hack-club-bot.vercel.app/0apotitle_cropped.png"
sx={{
width: ['200px', '250px', '300px'],
mt: ['-5px', '-5px', '-5px'],
mb: ['30px', '30px', '30px'],
position: 'relative',
zIndex: 2,
fontSize: ['36px', 4, 5],
color: 'white'
}}
alt="Apocalypse"
/>

<Flex
sx={{
flexDirection: ['row', 'row', 'column'],
justifyContent: 'space-between'
}}
>
<Text
as="p"
variant="subheadline"
sx={{
ml: ['0px', '0px', '10px'],
mt: ['0px', '0px', '-10px'],
mb: ['0px', '0px', '20px'],
zIndex: 2,
color: 'white',
fontSize: ['24px !important'],

textShadow: '0 0 20px #fbbae4'
}}
>
Downtown Toronto
<br />
May 17–19
</Text>

<Buttons
icon="flag-fill"
href="https://apocalypse.hackclub.com/"
target="_blank"
rel="noopener"
primary="#FE5CA8"
id="43"
sx={{ color: '#fff' }}
>
Join Us
</Buttons>
</Flex>
</Flex>
<Box>
<Text
as="p"
variant="subtitle"
sx={{
fontSize: ['22px', '20px', '18px']
}}
>
It's 2034, and zombies have taken over! But tech still operates.
What would you do?
</Text>
<Text
as="p"
variant="subtitle"
sx={{
fontSize: ['22px', '20px', '18px']
}}
>
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.
</Text>
</Box>
</Grid>
</CardModel>
)
}
4 changes: 2 additions & 2 deletions components/index/cards/sprig.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function Game({ game, gameImage, gameImage1, ...props }) {
mb: 1
}}
>
<RelativeTime value={game['added on']} titleFormat="YYYY-MM-DD" />
<RelativeTime value={game['addedOn']} titleFormat="YYYY-MM-DD" />
</Text>
</Box>
</Box>
Expand Down Expand Up @@ -257,7 +257,7 @@ export default function Sprig({ stars, game, gameImage, gameImage1 }) {
>
<Game
game={game[0]}
// gameImage={gameImage}
// gameImage={gameImage}
/>
<Game
game={game[1]}
Expand Down
2 changes: 1 addition & 1 deletion components/slack/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const projects = [
{
title: 'Brainwave device for thought-based computer interaction.',
description:
'The team of teens behind BCI is building both the hardware and software for a brainwave reading device to interact with computers using thoughts',
'The team of teens behind Monolith BCI is building both the hardware and software for a brainwave reading device to interact with computers using thoughts',
img: 'bci',
color: ['#ec3750', '#F58695'],
itemId: 0
Expand Down
5 changes: 5 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ const nextConfig = {
source: '/daysofservice/',
destination: 'https://daysofservice.hackclub.com',
permanent: true
},
{
source: '/blot/',
destination: 'https://blot.hackclub.com',
permanent: false
}
]
},
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"format": "prettier --write ."
},
"dependencies": {
"@apollo/client": "^3.9.9",
"@apollo/client": "^3.9.11",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@github/time-elements": "^4.0.0",
Expand All @@ -25,18 +25,19 @@
"@octokit/auth-app": "^6.0.1",
"@octokit/core": "^5.1.0",
"@octokit/rest": "^20.0.2",
"@sendgrid/mail": "^8.1.1",
"@tracespace/core": "^5.0.0-alpha.0",
"@tracespace/identify-layers": "^5.0.0-alpha.0",
"@tracespace/parser": "^5.0.0-next.0",
"@tracespace/plotter": "^5.0.0-alpha.0",
"@tracespace/renderer": "^5.0.0-alpha.0",
"@tracespace/xml-id": "^4.2.7",
"@sendgrid/mail": "^8.1.1",
"add": "^2.0.6",
"airtable-plus": "^1.0.4",
"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",
Expand Down Expand Up @@ -74,7 +75,8 @@
"react-ticker": "^1.3.2",
"react-tooltip": "^4.5.1",
"react-tsparticles": "^2.12.2",
"react-use-websocket": "^4.7.0",
"react-type-animation": "^3.2.0",
"react-use-websocket": "^4.8.1",
"react-wrap-balancer": "^1.1.0",
"recharts": "2.12.2",
"remark": "^15.0.1",
Expand Down
104 changes: 104 additions & 0 deletions pages/api/bin/wokwi/new.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
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.md",
content: `# Welcome to The Bin! 🦝
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
`
},
{
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 [email protected] 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' })
}
}
}
29 changes: 29 additions & 0 deletions pages/api/bin/wokwi/parts.js
Original file line number Diff line number Diff line change
@@ -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)
}
5 changes: 1 addition & 4 deletions pages/api/games.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
export async function getGames() {
let games = await fetch(
'https://raw.githubusercontent.com/hackclub/sprig/main/games/metadata.json'
'https://sprig.hackclub.com/api/gallery?new'
).then(res => res.json())
games = games
.sort((a, b) => new Date(b.addedOn) - new Date(a.addedOn))
.slice(-4)

return games
}
Expand Down
9 changes: 8 additions & 1 deletion pages/api/onboard/p/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ export const getAllOnboardProjects = async () => {
}
}

const res = await fetch(url, fetchOptions).then(r => r.json())
let res;
try { res = await fetch(url, fetchOptions).then(r => r.json()) }
catch (e) {
console.error('Failed to fetch projects from GitHub', e)
return []
}

if (res.message && res.message.startsWith('API rate limit exceeded')) {
console.error('GitHub API rate limit exceeded')
return []
}
if(!res) return []

const projects = []

Expand Down
Loading

0 comments on commit 6e47fa3

Please sign in to comment.