fix: kickoff time centered without 'Uhr', unified countdown badge, DevPanel close button

- Kickoff: centered "21:00" above flags (no 'Uhr' suffix)
- Countdown: always rendered as badge (was unstyled span for <60min)
- DevPanel: added close button (✕) in panel header for reliable closing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ronny
2026-04-11 22:46:53 +02:00
parent e1b9f03d60
commit 137e14b3d1
4 changed files with 47 additions and 26 deletions
+20 -22
View File
@@ -47,17 +47,7 @@ const STATUS_LABELS: Record<string, string> = {
function formatKickoff(utcDate: string): string {
return new Date(utcDate).toLocaleString('de-DE', {
hour: '2-digit', minute: '2-digit', timeZone: 'Europe/Berlin',
}) + ' Uhr';
}
function CountdownBadge({ minutes }: { minutes: number }) {
if (minutes <= 0) return null;
if (minutes < 60) return <span className={styles.badgeUrgent}> in {minutes} Min.</span>;
const h = Math.floor(minutes / 60);
const m = minutes % 60;
if (h < 24) return <span className={styles.badge}>in {h}h{m > 0 ? ` ${m}m` : ''}</span>;
const d = Math.floor(h / 24);
return <span className={styles.badge}>in {d} Tag{d > 1 ? 'en' : ''}</span>;
});
}
function FlagBox({ crest, name }: { crest: string | null; name: string }) {
@@ -94,7 +84,7 @@ export default function MatchCard({ match, onTip }: Props) {
return (
<div className={`card ${styles.card} ${styles[`card_${state}`]} ${isLive ? styles.live : ''} ${glowClass}`}>
{/* Top row: Group + Kickoff + Countdown */}
{/* Top row: Group + Countdown */}
<div className={styles.topRow}>
{(isLive || isFinished) && (
<span className={`${styles.status} ${isLive ? styles.statusLive : ''}`}>
@@ -107,21 +97,29 @@ export default function MatchCard({ match, onTip }: Props) {
{match.group.replace('GROUP_', 'Gruppe ')}
</span>
)}
{!isFinished && !isLive && (
<span className={styles.kickoffBadge}>{formatKickoff(match.utcDate)}</span>
)}
<span className={styles.topRowSpacer} />
{(state === 'open' || state === 'tipped') && match.tippable && (
match.minutesUntilKickoff < 60 ? (
<span className={`${styles.countdown} ${remainingMins < 5 ? styles.countdownUrgent : ''}`}>
Noch {remainingMins} Min!
</span>
) : (
<CountdownBadge minutes={match.minutesUntilKickoff} />
)
<span className={`${styles.badge} ${remainingMins < 60 ? styles.badgeUrgent : ''} ${remainingMins < 5 ? styles.countdownUrgent : ''}`}>
{match.minutesUntilKickoff < 60
? `Noch ${remainingMins} Min!`
: (() => {
const h = Math.floor(match.minutesUntilKickoff / 60);
if (h < 24) return `in ${h}h`;
const d = Math.floor(h / 24);
return `in ${d} Tag${d > 1 ? 'en' : ''}`;
})()
}
</span>
)}
</div>
{/* Kickoff time — centered above flags */}
{!isFinished && !isLive && (
<div className={styles.kickoffRow}>
<span className={styles.kickoffTime}>{formatKickoff(match.utcDate)}</span>
</div>
)}
{/* Teams + Score */}
<div className={styles.matchRow}>
{/* Home */}