import { Badge, Box, Button, Card, Flex, Grid, Heading, Link, Text } from 'theme-ui' import React, { useEffect, useRef, useState } from 'react' import Head from 'next/head' import { useRouter } from 'next/router' import Meta from '@hackclub/meta' import Nav from '../components/nav' import BGImg from '../components/background-image' import ForceTheme from '../components/force-theme' import Footer from '../components/footer' import Stage from '../components/stage' import Carousel from '../components/index/carousel' import Sprig from '../components/index/cards/sprig' import Sinerider from '../components/index/cards/sinerider' import SprigConsole from '../components/index/cards/sprig-console' import Clubs from '../components/index/cards/clubs' import Workshops from '../components/index/cards/workshops' import HCB from '../components/index/cards/hcb' import Hackathons from '../components/index/cards/hackathons' import OuternetImgFile from '../public/home/outernet-110.jpg' import Announcement from '../components/announcement' import Konami from 'react-konami-code' import JSConfetti from 'js-confetti' import Secret from '../components/secret' import MailingList from '../components/index/cards/mailing-list' import Slack from '../components/index/cards/slack' import Icon from '../components/icon' import GitHub from '../components/index/github' 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 Blueprint from '../components/index/cards/blueprint' import CampfireFlagship from '../components/index/cards/campfire-flagship' import Milkyway from '../components/index/cards/milkyway' import Flavortown from '../components/index/cards/flavortown' import Flavorless from '../components/index/cards/flavorless' import Scraps from '../components/index/cards/scraps' import Aces from '../components/index/cards/aces' import CTAS from '../components/index/ctas' /** @jsxImportSource theme-ui */ const ANNOUNCEMENTS = [ { id: 'blueprint', expiresAt: new Date('2026-01-31'), copy: 'Get up to $400 to make a hardware project!', caption: 'Design a project and get a grant to make it real with Blueprint, Hack Club\'s largest hardware program', href: 'https://blueprint.hackclub.com/?utm_source=site-announcement', imgSrc: '/hc-cdn/db8d0fd43bb664a8b07431b0262a7ca13c1602c7_blueprint_logo__img_.png' }, { id: 'campfire-flagship', expiresAt: new Date('2026-02-20'), copy: 'Code with your favorite YouTubers at a Game Jam!', caption: 'Spend up to 60 hours building games, earn a ticket to attend. Join us in LA with YouTubers like Michael Reeves this February!', href: 'https://flagship.hackclub.com?utm_source=site_announcement', imgSrc: '/hc-cdn/533c527e1ab6a77f_smore.png' }, { id: 'flavortown', expiresAt: new Date('2026-12-31'), copy: 'Build projects, earn cookies, get free tech!', caption: 'Make a website, game, or hardware project and exchange cookies for iPads, MacBooks, and more', href: 'https://flavortown.hackclub.com/?ref=site-announcement', imgSrc: '/hc-cdn/0256e44f53eb79e4_logo-b28e0e8b.avif' } ] function getActiveAnnouncements() { const now = new Date() return ANNOUNCEMENTS.filter(a => a.expiresAt > now) } function Page({ hackathonsData, bankData, slackData, gitHubData, gitHubDataLength, consoleCount, stars, // githubData2, dataPieces, game, gameTitle, events, carouselCards, blueprintData, context, ctaCards }) { let [gameImage, setGameImage] = useState('') let [gameImage1, setGameImage1] = useState('') let [reveal, setReveal] = useState(false) const [hover, setHover] = useState(true) let [github, setGithub] = useState(0) let [slackKey, setSlackKey] = useState(0) let [key, setKey] = useState(0) const [announcement, setAnnouncement] = useState(null) const { asPath } = useRouter() let jsConfetti = useRef() useEffect(() => { jsConfetti.current = new JSConfetti() window.kc = `In the days of old, when gaming was young \nA mysterious code was found among \nA sequence of buttons, pressed in a row \nIt unlocked something special, we all know \n\nUp, up, down, down, left, right, left, right \nB, A, Start, we all have heard it's plight \nIn the 8-bit days, it was all the rage \nAnd it still lives on, with time, it will never age \n\nKonami Code, it's a legend of days gone by \nIt's a reminder of the classics we still try \nNo matter the game, no matter the system \nThe code will live on, and still be with them \n\nSo the next time you play, take a moment to pause \nAnd remember the code, and the Konami cause \nIt's a part of gaming's history, and a part of our lives \nLet's keep it alive, and let the Konami Code thrive!\n` window.paper = `Welcome, intrepid hacker! We'd love to have you in our community. Get your invite at hack.af/slack. Under "Why do you want to join the Hack Club Slack?" add a 🦄 and we'll ship you some exclusive stickers! ` }, []) // Pick a random active announcement on client to avoid hydration mismatches useEffect(() => { const active = getActiveAnnouncements() if (active.length > 0) { const randomIndex = Math.floor(Math.random() * active.length) setAnnouncement(active[randomIndex]) } }, []) const easterEgg = () => { alert('Hey, you typed the Konami Code!') jsConfetti.current.addConfetti({ confettiColors: [ // Hack Club colours! '#ec3750', '#ff8c37', '#f1c40f', '#33d6a6', '#5bc0de', '#338eda', '#a633d6' ] }) } useEffect(() => { if (reveal && !hover) { setTimeout(() => { setReveal(false) }, 2000) } }, [reveal, hover]) const [count, setCount] = useState(0) let images = [ { alt: 'Map of Hack Clubs around the world', src: '/home/map.png' }, { alt: 'Hack Clubbers at SpaceX HQ in LA', src: '/home/zephyr-spacex.jpeg' }, { alt: 'MA Hacks, Hack Clubber organized hackathon', src: '/hackathons/mahacks.jpeg' }, { alt: 'AMA with Sal Khan', src: '/home/ama.png' }, { alt: 'Hack Clubbers at Flagship, 2019', src: '/home/flagship_4.jpg' } ] // janky right now and does not show last image useEffect(() => { console.log( `White sheets of paper\nWaiting to be printed on\nA blank console waits` ) if (count === images.length - 1) { setCount(0) } }, [count, images.length]) // Spotlight effect const spotlightRef = useRef() useEffect(() => { const handler = event => { var rect = document.getElementById('spotlight').getBoundingClientRect() var x = event.clientX - rect.left //x position within the element. var y = event.clientY - rect.top //y position within the element. spotlightRef.current.style.background = `radial-gradient( circle at ${x}px ${y}px, rgba(132, 146, 166, 0) 10px, rgba(249, 250, 252, 0.9) 80px )` } window.addEventListener('mousemove', handler) return () => window.removeEventListener('mousemove', handler) }, []) return ( <>