'use client' import { useState } from 'react' import PageLayout from '../../components/PageLayout' import { DASHBOARD_PLATFORMS_COLOR_OPTIONS, type DashboardPlatform, type DashboardPlatformColorClass } from '../../utils/dashboardPlatforms' import { PlusIcon, TrashIcon, CheckIcon, ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline' import { useAdminDashboardPlatforms, type PlatformRow } from './hooks/useAdminDashboardPlatforms' export default function AdminDashboardManagementPage() { const { platforms, loading, saving, error, savedAt, hasValidationErrors, addPlatform, updatePlatform, removeNewPlatform, setPlatformState, save, isValidHref, } = useAdminDashboardPlatforms() const [openById, setOpenById] = useState>({}) const toggleOpen = (id: string) => { setOpenById(prev => ({ ...prev, [id]: !prev[id] })) } const addAndOpen = () => { const id = addPlatform() setOpenById(prev => ({ ...prev, [id]: true })) } const isOpen = (p: PlatformRow) => Boolean(openById[p.id] ?? p._isNew) return (

Dashboard Management

Manage the “Platforms” cards shown on the user dashboard.

{error && (
{error}
)} {savedAt && (
Saved at {new Date(savedAt).toLocaleTimeString('de-DE')}
)} {hasValidationErrors && (
Please ensure every platform has a title and a valid link (must start with “/” or “http(s)://”).
)}
{loading && (
Loading…
)} {!loading && platforms.map(platform => (
{platform.title}
{platform.href}
{isOpen(platform) && (
{platform.disabled && ( )}
)}
))} {!loading && platforms.length === 0 && (
No platforms configured.
)}
) }