diff --git a/index.html b/index.html index 2e7619f..aebd9f1 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,6 @@ - DSA 5e Charakterbogen diff --git a/src/App.tsx b/src/App.tsx index 37640c9..960336f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,14 +1,38 @@ import './App.css' -import Header from "./modules/header/components/Header.tsx"; import Main from "./modules/main/components/Main.tsx"; import Footer from "./modules/footer/components/Footer.tsx"; +import {useEffect, useState} from "react"; +import type {CharacterData} from "./types/CharacterJson.ts"; function App() { + const [jsonData, setJsonData] = useState(null); + const [loading, setLoading] = useState(true); + + useEffect(() => { + const loadData = async () => { + try { + const data = await import('./assets/data/Faelyn Eichenhauch.json'); + setJsonData(data.default); + } catch (error) { + console.error('Error loading JSON file:', error); + } finally { + setLoading(false); + } + }; + + loadData(); + }, []); + + if (loading) return
Loading...
; + + if (!jsonData) return
Error loading JSON file.
; + + return ( <> -
+ {/*
*/} -
+