diff --git a/dist/index.html b/dist/index.html index a54606c..3125b66 100644 --- a/dist/index.html +++ b/dist/index.html @@ -19,8 +19,8 @@ - - + +
diff --git a/example.jpg b/example.jpg new file mode 100644 index 0000000..d9bbe09 Binary files /dev/null and b/example.jpg differ diff --git a/src/App.jsx b/src/App.jsx index 311a77b..f1e5129 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,9 +1,10 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import './index.css'; import Nav from './components/Nav'; import BentoCard from './components/BentoCard'; import BentoSlideshow from './components/BentoSlideshow'; import CookieBanner from './components/CookieBanner'; +import { fetchLaboratoriumData, mapDirectusToContent } from './lib/directus'; import { slideshowData, articlesData, newsData, videosData } from './data/content'; import Hero from './sections/Hero'; @@ -44,21 +45,59 @@ const SubscribeBox = () => { }; function App() { + const [directusData, setDirectusData] = useState(null); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + async function loadData() { + try { + const items = await fetchLaboratoriumData(); + const mapped = mapDirectusToContent(items); + setDirectusData(mapped); + } catch (err) { + setError(err.message); + } finally { + setLoading(false); + } + } + loadData(); + }, []); + + // Użyj danych z Directus lub fallback na statyczne + const displaySlideshow = directusData?.slideshow || slideshowData; + const displayArticles = directusData?.articles || articlesData; + + if (loading) { + return ( +
+
+

Ładowanie danych z Laboratorium AI...

+
+ ); + } + return ( <>