Fix group stage default view and localize match times

Default to Groups tab instead of Bracket when no teams have been
assigned to the knockout bracket yet (group stage still in progress).

Fix match kick-off times showing in UTC server timezone by adding
suppressHydrationWarning so React uses the client's local timezone
during hydration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Bo6Rsmg8FosYcDJsg14tX
This commit is contained in:
Claude 2026-06-17 01:40:00 +00:00
parent 7da8be9978
commit 5db574263f
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View file

@ -70,7 +70,7 @@ function MatchResult({ match }: { match: GroupMatch }) {
<span className="truncate max-w-[80px]">{p2}</span>
</div>
{kickoff && (
<span className="text-[10px] text-muted-foreground/50">
<span className="text-[10px] text-muted-foreground/50" suppressHydrationWarning>
{kickoff.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" })}
</span>
)}
@ -181,7 +181,7 @@ export function GroupStageStandings({
<div className="px-4 pb-3 space-y-0.5 border-t pt-2">
{[...byDay.entries()].map(([day, matches]) => (
<div key={day} className="space-y-0.5">
<p className="text-[10px] text-muted-foreground/70 uppercase tracking-wide pt-1">
<p className="text-[10px] text-muted-foreground/70 uppercase tracking-wide pt-1" suppressHydrationWarning>
{day}
</p>
{matches.map((m) => (

View file

@ -45,6 +45,7 @@ export default function SportSeasonDetail({
} = loaderData;
const hasBracket = playoffMatches && playoffMatches.length > 0;
const bracketHasTeams = hasBracket && playoffMatches.some((m) => m.participant1 !== null || m.participant2 !== null);
const hasStandings = regularSeasonStandings && regularSeasonStandings.length > 0;
const showOtLosses = hasStandings && regularSeasonStandings.some((s) => s.otLosses !== null);
@ -75,7 +76,8 @@ export default function SportSeasonDetail({
const [view, setView] = useState<BracketView>(() => {
if (showGroupStageToggle) {
return sportsSeason.status === "completed" ? "finished" : "playoffs";
if (sportsSeason.status === "completed") return "finished";
return bracketHasTeams ? "playoffs" : "groups";
}
if (!hasBracket) return "standings";
if (sportsSeason.status === "completed") return "finished";