From e0328a642835c97d8bd819126e114b6431a136eb Mon Sep 17 00:00:00 2001 From: Legend <126304434+ExpiredWarranty@users.noreply.github.com> Date: Fri, 17 May 2024 22:28:01 -0600 Subject: [PATCH] Update page.tsx im autism --- src/app/page.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/app/page.tsx b/src/app/page.tsx index 3a154fb..1a24e53 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -10,7 +10,19 @@ import store from 'store2' export default function Home() { const router = useRouter() const [shortcuts, setShortcuts] = useState([]) + const [splashText, setSplashText] = useState('') + useEffect(() => { + // Fetch splash text from JSON file + fetch('/splash.json') + .then(response => response.json()) + .then(data => { + const randomIndex = Math.floor(Math.random() * data.length); + setSplashText(data[randomIndex].sp); + }) + .catch(error => console.error('Error fetching splash text:', error)); + + // Fetch shortcuts from local storage store.set('shortcuts', [], false) const data: Item[] = store('shortcuts') setShortcuts(data) @@ -36,6 +48,7 @@ export default function Home() { +

{splashText}

{shortcuts.length > 0 && (
{shortcuts.map((shortcut: Item) => {