fix timezones for next match card and add last match vods

This commit is contained in:
2025-04-29 12:55:40 +02:00
parent b6c93b1c96
commit 1169866839
3 changed files with 11 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ import { NextMatchInfoCard } from '@/app/(home)/major-league-balatro/_components
import { CountdownTimer } from '@/components/countdown-timer' import { CountdownTimer } from '@/components/countdown-timer'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Calendar, Clock } from 'lucide-react' import { Calendar, Clock } from 'lucide-react'
import { useFormatter } from 'next-intl' import { useFormatter, useTimeZone } from 'next-intl'
import type { PropsWithChildren } from 'react' import type { PropsWithChildren } from 'react'
import { players } from '../_constants/players' import { players } from '../_constants/players'
import type { Match } from '../types' import type { Match } from '../types'
@@ -12,6 +12,7 @@ export type NextMatchInfoProps = {
} }
export function NextMatchInfo({ nextMatch }: NextMatchInfoProps) { export function NextMatchInfo({ nextMatch }: NextMatchInfoProps) {
const timeZone = useTimeZone()
const formatter = useFormatter() const formatter = useFormatter()
if (!nextMatch) { if (!nextMatch) {
return ( return (
@@ -45,9 +46,11 @@ export function NextMatchInfo({ nextMatch }: NextMatchInfoProps) {
month: 'long', month: 'long',
day: 'numeric', day: 'numeric',
year: 'numeric', year: 'numeric',
timeZone,
}) })
const time = formatter.dateTime(nextMatch.datetime, { const time = formatter.dateTime(nextMatch.datetime, {
timeStyle: 'short', timeStyle: 'short',
timeZone,
}) })
if (!nextMatchPlayer1) { if (!nextMatchPlayer1) {

View File

@@ -221,7 +221,9 @@ export const matches: Match[] = [
player1Id: 'haelian', player1Id: 'haelian',
player2Id: 'bear', player2Id: 'bear',
datetime: new Date('2025-04-28T17:00:00-04:00'), datetime: new Date('2025-04-28T17:00:00-04:00'),
completed: false, completed: true,
vod1: 'https://www.twitch.tv/videos/2445030299?t=4h1m48s',
vod2: 'https://www.twitch.tv/videos/2445202859?t=0h9m7s',
week: 4, week: 4,
}, },
{ {

View File

@@ -1,4 +1,4 @@
import { Standings } from '@/app/(home)/major-league-balatro/_components/standings' import { TimeZoneProvider } from '@/components/timezone-provider'
import Link from 'next/link' import Link from 'next/link'
import { Competitors } from './_components/competitors' import { Competitors } from './_components/competitors'
import { HeroSection } from './_components/hero' import { HeroSection } from './_components/hero'
@@ -25,9 +25,9 @@ export default function MLBPage() {
<div className='flex min-h-screen flex-col'> <div className='flex min-h-screen flex-col'>
<main className='flex-1'> <main className='flex-1'>
<HeroSection /> <HeroSection />
<TimeZoneProvider>
<NextMatchInfo nextMatch={nextMatch} /> <NextMatchInfo nextMatch={nextMatch} />
</TimeZoneProvider>
{/*<Standings />*/} {/*<Standings />*/}
<TournamentFormat /> <TournamentFormat />