import { useQuery } from "@tanstack/react-query"; import { useParams, Link } from "wouter"; import { type Article } from "@shared/schema"; import { format } from "date-fns"; import { de } from "date-fns/locale"; import { Eye, ArrowLeft } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Skeleton } from "@/components/ui/skeleton"; import Header from "@/components/header"; import Footer from "@/components/footer"; import { ArticleCardAd } from "@/components/adsense"; export default function CategoryPage() { const { category } = useParams<{ category: string }>(); const { data: articles, isLoading } = useQuery({ queryKey: ["/api/articles/category", category], }); return (

{category}

{isLoading ? (
{Array.from({ length: 6 }).map((_, i) => (
))}
) : articles && articles.length > 0 ? (
{articles.flatMap((article, index) => { const items = [
{article.title}
{article.author} · {format(new Date(article.publishedAt), "d. MMMM yyyy", { locale: de })}

{article.title}

{article.excerpt}

{article.views.toLocaleString()}
, ]; if (index === 2) { items.push(); } return items; })}
) : (

Keine Artikel in dieser Kategorie gefunden.

)}
); }