migration to new feed source

This commit is contained in:
2026-07-01 16:34:01 -05:00
parent cfb778776e
commit 4e4c72da7f
58 changed files with 444 additions and 48 deletions

View File

@@ -1,32 +1,27 @@
"use client";
import { useState } from "react";
import { Team } from "@/lib/types";
import { TLA_TO_ISO2 } from "@/lib/flags";
// Zeigt die Flagge/das Wappen eines Teams. Fällt auf ein neutrales Rund
// zurück, wenn keine crest-URL vorliegt oder das Bild nicht geladen werden kann.
// Zeigt die Flagge eines Teams aus lokalem circle-flags-Bestand.
// Fallback: kein Rendering bei fehlendem Team/Code (kein Broken-Image).
export default function Flag({
team, size = 22,
}: { team?: Team; size?: number }) {
const [imgFailed, setImgFailed] = useState(false);
const style = { width: size, height: size } as const;
if (team?.crest && !imgFailed) {
const iso2 = team?.code ? TLA_TO_ISO2[team.code.toUpperCase()] : undefined;
if (iso2) {
return (
<img
src={team.crest}
alt={team.code || team.localisedName || team.name}
src={`/flags/${iso2}.svg`}
alt={team!.code || team!.localisedName || team!.name}
className="flag"
style={style}
loading="lazy"
onError={() => setImgFailed(true)}
/>
);
}
// Fallback: Kreis mit Ländercode
return (
<span className="flag flag-fallback" style={style} aria-hidden>
{team?.code?.slice(0, 2) || "··"}
</span>
);
// Kein Team / kein Code: nichts rendern (kein Broken-Image)
return null;
}