Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 191888225f | |||
| c418a51f08 |
+1
-12
@@ -21,16 +21,6 @@ interface Tournament {
|
|||||||
topScorers: Array<{ playerName: string; goals: number; team?: { name: string; iso2?: string | null } | null }>
|
topScorers: Array<{ playerName: string; goals: number; team?: { name: string; iso2?: string | null } | null }>
|
||||||
}
|
}
|
||||||
|
|
||||||
function HostIso(host: string): string {
|
|
||||||
const map: Record<string, string> = {
|
|
||||||
'Uruguay': 'uy', 'Italy': 'it', 'France': 'fr', 'Brazil': 'br',
|
|
||||||
'Switzerland': 'ch', 'Sweden': 'se', 'Chile': 'cl', 'England': 'gb-eng',
|
|
||||||
'Mexico': 'mx', 'Germany': 'de', 'Argentina': 'ar', 'Spain': 'es',
|
|
||||||
'South Korea / Japan': 'kr', 'South Africa': 'za', 'Russia': 'ru',
|
|
||||||
'Qatar': 'qa', 'USA': 'us', 'USA / Canada / Mexico': 'us',
|
|
||||||
}
|
|
||||||
return map[host] ?? 'un'
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function HistoryPage() {
|
export default function HistoryPage() {
|
||||||
const { data, loading } = useQuery(HISTORY_QUERY)
|
const { data, loading } = useQuery(HISTORY_QUERY)
|
||||||
@@ -72,8 +62,7 @@ export default function HistoryPage() {
|
|||||||
<div className="flex justify-between items-start mb-3.5">
|
<div className="flex justify-between items-start mb-3.5">
|
||||||
<div>
|
<div>
|
||||||
<div className="font-['Bebas_Neue'] text-[34px] text-[#22c55e] leading-none">{t.year}</div>
|
<div className="font-['Bebas_Neue'] text-[34px] text-[#22c55e] leading-none">{t.year}</div>
|
||||||
<div className="text-xs text-[#2a5c35] mt-0.5 flex items-center gap-1.5">
|
<div className="text-xs text-[#2a5c35] mt-0.5">
|
||||||
<span className={`fi fi-${HostIso(t.host)} rounded-sm text-sm inline-block`} />
|
|
||||||
{t.host}
|
{t.host}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+1
-4
@@ -117,10 +117,7 @@ export default function HomePage() {
|
|||||||
World Cup 2026
|
World Cup 2026
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-[#2a5c35] text-sm mb-9">
|
<p className="text-[#2a5c35] text-sm mb-9">
|
||||||
<span className="fi fi-us rounded-sm text-lg mx-0.5 inline-block" /> USA ·{' '}
|
USA · Canada · Mexico · 11 June – 19 July 2026 · 48 Teams
|
||||||
<span className="fi fi-ca rounded-sm text-lg mx-0.5 inline-block" /> Canada ·{' '}
|
|
||||||
<span className="fi fi-mx rounded-sm text-lg mx-0.5 inline-block" /> Mexico
|
|
||||||
· 11 June – 19 July 2026 · 48 Teams
|
|
||||||
</p>
|
</p>
|
||||||
<div className="flex gap-2.5 flex-wrap max-w-[760px]">
|
<div className="flex gap-2.5 flex-wrap max-w-[760px]">
|
||||||
{stats ? <>
|
{stats ? <>
|
||||||
|
|||||||
+3
-1
@@ -226,7 +226,6 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function syncGoals(matchId: number, teamId: number, rawGoals: RawGoal[], isOwnGoalTeamId: number) {
|
async function syncGoals(matchId: number, teamId: number, rawGoals: RawGoal[], isOwnGoalTeamId: number) {
|
||||||
await db.execute(sql`DELETE FROM goals WHERE match_id = ${matchId}`)
|
|
||||||
for (const g of rawGoals) {
|
for (const g of rawGoals) {
|
||||||
if (!g.name) continue
|
if (!g.name) continue
|
||||||
const minute = g.minute != null ? parseInt(String(g.minute)) : null
|
const minute = g.minute != null ? parseInt(String(g.minute)) : null
|
||||||
@@ -294,8 +293,11 @@ async function run() {
|
|||||||
const score = parseScore(m.score)
|
const score = parseScore(m.score)
|
||||||
const group = m.group ?? null
|
const group = m.group ?? null
|
||||||
const matchId = await upsertMatch(year, m.round ?? 'Unknown', group, m.date ?? null, m.time ?? null, t1Id, t2Id, score, false)
|
const matchId = await upsertMatch(year, m.round ?? 'Unknown', group, m.date ?? null, m.time ?? null, t1Id, t2Id, score, false)
|
||||||
|
if (m.goals1?.length || m.goals2?.length) {
|
||||||
|
await db.execute(sql`DELETE FROM goals WHERE match_id = ${matchId}`)
|
||||||
if (m.goals1?.length) await syncGoals(matchId, t1Id, m.goals1, t2Id)
|
if (m.goals1?.length) await syncGoals(matchId, t1Id, m.goals1, t2Id)
|
||||||
if (m.goals2?.length) await syncGoals(matchId, t2Id, m.goals2, t1Id)
|
if (m.goals2?.length) await syncGoals(matchId, t2Id, m.goals2, t1Id)
|
||||||
|
}
|
||||||
matchCount++
|
matchCount++
|
||||||
goalCount += (m.goals1?.length ?? 0) + (m.goals2?.length ?? 0)
|
goalCount += (m.goals1?.length ?? 0) + (m.goals2?.length ?? 0)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user