import { useQuery } from "@tanstack/react-query"; import { Link, useRoute } from "wouter"; import { ArrowLeft, Play, Clock, Youtube } from "lucide-react"; import Header from "@/components/header"; import Footer from "@/components/footer"; import { PageSideAds, TopBannerAd, MultiplexAd } from "@/components/adsense"; import { Skeleton } from "@/components/ui/skeleton"; import { format } from "date-fns"; import { de } from "date-fns/locale"; export interface YtVideo { ytId: string; slug: string; title: string; shortTitle: string; rubrik: string; publishedAt: string; durationS: number; teaser: string; description: string; chapters: { t: string; label: string }[]; tags: string[]; previewUrl: string; previewS: number; posterUrl: string; youtubeUrl: string; } export function dauer(s: number) { const m = Math.floor(s / 60); const r = s % 60; return `${m}:${String(r).padStart(2, "0")}`; } function RelatedCard({ v }: { v: YtVideo }) { return (
{v.shortTitle} {dauer(v.durationS)}

{v.shortTitle}

); } export default function VideoDetailPage() { const [, params] = useRoute("/video/:slug"); const slug = params?.slug || ""; const { data, isLoading } = useQuery<{ item: YtVideo; related: YtVideo[] }>({ queryKey: [`/api/yt-videos/${slug}`], enabled: !!slug, }); const v = data?.item; return (
{isLoading || !v ? (
) : ( <>
{v.rubrik} {dauer(v.durationS)} {format(new Date(v.publishedAt), "d. MMMM yyyy", { locale: de })} Vorschau {v.previewS} Sek.

{v.shortTitle}

{v.teaser && (

{v.teaser}

)} Ganzes Video auf YouTube ansehen {v.chapters?.length > 0 && (

Kapitel

    {v.chapters.map((c) => (
  • {c.t} {c.label}
  • ))}
)} {v.description && (

Zum Video

{v.description.replace(/\n{3,}/g, "\n\n")}

)} {data?.related?.length ? (

Mehr aus {v.rubrik}

{data.related.map((r) => )}
) : null} )}
); }