diff --git a/src/app/page.tsx b/src/app/page.tsx index a9ca5f7..462eb60 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -87,7 +87,7 @@ export default function Home() { - + {/* */} diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 278564d..a335901 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -16,12 +16,12 @@ const quoteArray = [ "..than right here, right now?!" ] -async function getQuote() { - return quoteArray[Math.floor(Math.random() * quoteArray.length)] +async function getQuote(index: number) { + return quoteArray[index] } export default async function Header() { - const quote = await getQuote() + const quote = await getQuote(Math.floor(Math.random() * quoteArray.length)) return (
@@ -38,93 +38,4 @@ export default async function Header() {
) -} - -// "use client"; - -// import { useState, useEffect, useCallback } from "react" - -// export default function Header() { -// const [ shouldShowAudio, setShouldShowAudio ] = useState(false) -// const [ pressedKeys, setPressedKeys ] = useState([]) -// const keyCombination = [ -// "ArrowUp", -// "ArrowUp", -// "ArrowDown", -// "ArrowDown", -// "ArrowLeft", -// "ArrowRight", -// "ArrowLeft", -// "ArrowRight", -// "b", -// "a", -// "Enter" -// ] -// const isArraysEqual = (arr1: string[], arr2: string[]) => { -// return arr1.length === arr2.length && -// arr1.every((val, ind) => val === arr2[ind]); -// } -// const onKeyDown = useCallback((e: KeyboardEvent) => { -// const currentlyPressedKeys = pressedKeys; -// currentlyPressedKeys.push(e.key) - -// if (!isArraysEqual(keyCombination, currentlyPressedKeys) && keyCombination.filter((v) => v === e.key) && !e.repeat) { -// setPressedKeys(() => { -// return currentlyPressedKeys -// }) -// } else { -// document.removeEventListener('keydown', onKeyDown) -// setShouldShowAudio(true) -// console.log('heeey-ey-ey-ey') -// } -// }, []) -// useEffect(() => { -// document.addEventListener('keydown', onKeyDown); -// }) - - // const quoteArray = [ - // "It works on my machine", - // "Revert 'Revert 'Revert", - // "'fuck the tests'", - // "this is so cooked", - // "Professional Production Tester", - // "I break hearts to save lives.", - // "go bills", - // "josh allen is my goat", - // "lets go buffalo", - // "oorah", - // "how bout them bills??", - // "where else would you rather be..", - // "..than right here, right now?!" - // ] -// const [ quote, setQuote ] = useState(quoteArray[0]); - -// useEffect(() => { -// setQuote(quoteArray[Math.floor(Math.random() * quoteArray.length)]) -// }, []) -// const drawNewQuote = () => { -// const newQuote = quoteArray[Math.floor(Math.random() * quoteArray.length)] - -// // redraw if this quote == current quote -// if (newQuote !== quote) { -// setQuote(newQuote); -// } else drawNewQuote(); -// } - -// return ( - //
- // { shouldShowAudio &&
-// ) -// } \ No newline at end of file +} \ No newline at end of file