"use client"; import { useState, useEffect } from "react"; import { BentoGrid, BentoGridItem } from "./ui/BentoGrid"; import { Globe, Server, Wrench, Shield, Gamepad2, Code, Activity, Lightbulb, MapPin, User, BookOpen } from "lucide-react"; import { useLocale, useTranslations } from "next-intl"; import type { JSONContent } from "@tiptap/react"; import RichTextClient from "./RichTextClient"; import CurrentlyReading from "./CurrentlyReading"; import ReadBooks from "./ReadBooks"; import { motion } from "framer-motion"; import { TechStackCategory, Hobby } from "@/lib/directus"; // Map icon names from Directus to Lucide components const iconMap: Record = { Globe, Server, Code, Wrench, Shield, Activity, Lightbulb, Gamepad2 }; const About = () => { const locale = useLocale(); const t = useTranslations("home.about"); const [cmsDoc, setCmsDoc] = useState(null); // Data State const [techStack, setTechStack] = useState([]); const [hobbies, setHobbies] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const fetchData = async () => { setLoading(true); try { const [cmsRes, techRes, hobbiesRes] = await Promise.all([ fetch(`/api/content/page?key=home-about&locale=${locale}`), fetch(`/api/tech-stack?locale=${locale}`), fetch(`/api/hobbies?locale=${locale}`) ]); const cmsData = await cmsRes.json(); if (cmsData?.content?.content) setCmsDoc(cmsData.content.content as JSONContent); const techData = await techRes.json(); if (techData?.techStack) setTechStack(techData.techStack); const hobbiesData = await hobbiesRes.json(); if (hobbiesData?.hobbies) setHobbies(hobbiesData.hobbies); } catch (error) { console.error("Error fetching about data:", error); } finally { setLoading(false); } }; fetchData(); }, [locale]); return (
{/* Background Decor */}
{t("title")}
{/* 1. Bio (2x2) */} Dennis Konkol } description={
{cmsDoc ? ( ) : (

{t("p1")} {t("p2")} {t("p3")}

)}
} header={
Available for hire
} /> {/* 2. Tech Stack */} {techStack && techStack.length > 0 ? ( techStack.flatMap(cat => cat.items?.map((item: any) => ( {item.name} ))) ) : (
{[1,2,3,4,5,6].map(i =>
)}
)}
} icon={} /> {/* 3. Location */} } header={
52.27° N, 8.04° E
} /> {/* 4. Currently Reading & Reviews (Long) */}
Reading Log
} /> {/* 5. Hobbies (Wide) */} {hobbies && hobbies.length > 0 ? hobbies.map((hobby, i) => { const Icon = iconMap[hobby.icon] || Lightbulb; return ( {hobby.title} ) }) : ( [1,2,3,4].map(i =>
) )}
} icon={} />
); }; export default About;