// Rahmen der Bot-Produktseite — eigene Navigation, gleiche Marke wie der Hub. // Das Dashboard ist dieselbe Config-Seite wie bisher, nur unter /dashboard. import { useEffect, useState } from 'react'; import { Routes, Route, NavLink, Navigate, useLocation } from 'react-router-dom'; import { apiGet } from './api.js'; import BotLanding from './pages/BotLanding.jsx'; import BotFeatures from './pages/BotFeatures.jsx'; import BotCommands from './pages/BotCommands.jsx'; import Settings from './pages/Settings.jsx'; import Impressum from './pages/Impressum.jsx'; import Datenschutz from './pages/Datenschutz.jsx'; import { IconMenu, IconX } from './icons.jsx'; import { useT, LangSwitch } from './i18n.jsx'; export default function BotApp() { const [me, setMe] = useState({ user: null, admin: false, scopes: [], loading: true }); const [drawer, setDrawer] = useState(false); const [hub, setHub] = useState(null); // Seiten wie die Nutzungsbedingungen liegen auf dem Hub — verlinkt // wird deshalb absolut, und nur wenn es einen Hub gibt. const [pages, setPages] = useState([]); const location = useLocation(); const { t } = useT(); useEffect(() => { setDrawer(false); }, [location.pathname]); useEffect(() => { apiGet('/api/me') .then((data) => setMe({ scopes: [], ...data, loading: false })) .catch(() => setMe({ user: null, admin: false, scopes: [], loading: false })); apiGet('/api/legal').then((d) => setHub(d.split ? d.hubUrl : null)).catch(() => {}); apiGet('/api/pages').then((d) => setPages(d.pages)).catch(() => {}); }, []); const canDashboard = me.admin || me.scopes?.length > 0; return (
D4RKBOT_