import { Box, Container, Text, Heading, Card, Flex, Image, Link, Grid, Button } from 'theme-ui' import Head from 'next/head' import Meta from '@hackclub/meta' import Nav from '../components/nav' import { useEffect, useState, useRef } from 'react' import Footer from '../components/footer' import { keyframes } from '@emotion/react' import RsvpForm from '../components/bin/rsvp-form' import { Fade } from 'react-reveal' import ForceTheme from '../components/force-theme' import JSConfetti from 'js-confetti' import Sparkles from '../components/sparkles' import Icon from "@hackclub/icons" import Announcement from '../components/announcement' import { TypeAnimation } from 'react-type-animation' const RsvpCount = () => { const targetRSVPs = 500 const [rsvpCount, setRsvpCount] = useState(0) useEffect(async () => { // const url = 'https://api2.hackclub.com/v0.1/The Bin/rsvp' <- switch to this once we have api2 back up and running const url = '/api/bin/rsvp' const results = await fetch(url).then(r => r.json()) setRsvpCount(results) }, []) if (rsvpCount < targetRSVPs) { return {targetRSVPs - rsvpCount} RSVPs until the start of... } else { return {rsvpCount} have already RSVP'd to... } } const stickerImages = [ 'https://cloud-mt5wqf6f5-hack-club-bot.vercel.app/0rummaging.png', 'https://cloud-mt5wqf6f5-hack-club-bot.vercel.app/1prototype.png', 'https://cloud-i547pyt1f-hack-club-bot.vercel.app/0idea.png' ] const PartPicker = () => { const parts = [ { name: "Relay", description: "On/Off Switch", image: "https://cloud-4zl0ojqxq-hack-club-bot.vercel.app/0placeholder3.png" }, { name: "Mic", description: "Record Sound", image: "https://cloud-4zl0ojqxq-hack-club-bot.vercel.app/0placeholder3.png" } ] const [currentParts, setCurrentParts] = useState(parts) function randomizeParts() { const randomParts = [] for (let i = 0; i < 3; i++) { randomParts.push(parts[Math.floor(Math.random() * parts.length)]) } setCurrentParts(randomParts) } return ( <> {currentParts.map((part, index) => ( ))} ) } const OnboardCount = () => { const [onboardCount, setOnboardCount] = useState(200) useEffect(async () => { const url = '/api/onboard/p/count' const results = await fetch(url).then(r => r.json()) setOnboardCount(results.count) }, []) return {onboardCount} } const Electronic = ({ imageUrl, name, description }) => { return ( {name} {description} ) } const spin = keyframes({ from: { transform: 'rotate(0deg)' }, to: { transform: 'rotate(360deg)' } }) const wobble = keyframes({ '0%': { transform: 'rotate(15deg)' }, '50%': { transform: 'scale(1.1)' }, '100%': { transform: 'rotate(20deg)' } }) const bounce = keyframes({ '0%': { transform: 'scaleX(100%) scaleY(100%)' }, '50%': { transform: 'scaleX(115%) scaleY(90%)' }, '100%': { transform: 'scaleX(100%) scaleY(100%)' } }) const slideIn = keyframes({ '0%': { transform: 'translateX(-100%)', opacity: 0 }, '100%': { transform: 'translateX(0);', opacity: 1 } }) const slideOut = keyframes({ '100%': { transform: 'translateX(-100%)', opacity: 0 }, '0%': { transform: 'translateX(0);', opacity: 1 } }) function crunch() { const crunchAudioUrls = [ 'https://cloud-fwf97jf44-hack-club-bot.vercel.app/0crunch_4_audio.mp4', 'https://cloud-fwf97jf44-hack-club-bot.vercel.app/1crunch_3_audio.mp4', 'https://cloud-fwf97jf44-hack-club-bot.vercel.app/2crunch_2_audio.mp4', 'https://cloud-fwf97jf44-hack-club-bot.vercel.app/3crunch_1_audio.mp4', ] const randomCrunch = crunchAudioUrls[Math.floor(Math.random() * crunchAudioUrls.length)] const audio = new Audio(randomCrunch) audio.play() } const ExpiresAt = ({ children, expirationDate = new Date() - 1 }) => { console.log(expirationDate, new Date()) if (expirationDate > new Date()) { return children } else { return null } } function spinIt(el) { el.classList.add("spin"); setTimeout(() => el.classList.remove("spin"), 500); } export default function Bin() { const confettiInstance = useRef(null); function fireConfetti() { if (!confettiInstance.current) { confettiInstance.current = new JSConfetti() } confettiInstance.current.addConfetti({ emojis: ['🔌', '⚡️', '💥', '🚨', '🔋', '🤖', '🛞', '🔊', '🎙️', '💿', '🖲️', '⚙️', '🛠️'], }) } return ( <>