import { useState, useEffect, useMemo } from 'react' import { Link } from 'react-router-dom' import { fetchServices } from '../lib/projectKindsApi' import { servicesCards } from '../lib/servicesView' import { ticketPath } from '../lib/ticketRoutes' import { previewStateTone } from '../components/projectTones' import { PageHeader, Card, Button, Badge } from '../components/ui' export default function ServicesPage() { const [data, setData] = useState(null) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) const load = async () => { setLoading(true) setError(null) try { setData(await fetchServices()) } catch (err) { setError(err.message || 'Services konnten nicht geladen werden.') } finally { setLoading(false) } } useEffect(() => { load() }, []) const cards = useMemo(() => servicesCards(data), [data]) if (loading) return
Wird geladen …
return (
{error && (

{error}

)} {cards.map((c) => (
{c.description &&

{c.description}

} {c.features.length > 0 && (
{c.features.map((f) => ( {f.label}{f.statusLabel ? ` · ${f.statusLabel}` : ''} ))}
)} {c.projects.length > 0 ? (
{c.projects.map((p) => (
{p.projectName || p.repoFullName} {p.previewState && Preview: {p.previewState}} {p.features?.analyse === 'active' && Analyse an}
{[p.customerName, p.previewUrl && 'Preview'].filter(Boolean).join(' · ') || 'Intern'}
{(p.woid || c.key === 'missing') && (
{p.woid && Ticket #{p.woid}} {c.key === 'missing' && Zuordnen}
)}
))}
) : (

Noch keine Projekte.

)}
))}
) }