init localize
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ node_modules
|
||||
.env
|
||||
.env.local
|
||||
*.log
|
||||
testdata
|
||||
BIN
app/[locale]/favicon.ico
Normal file
BIN
app/[locale]/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
501
app/[locale]/globals.css
Normal file
501
app/[locale]/globals.css
Normal file
@@ -0,0 +1,501 @@
|
||||
:root {
|
||||
/* Palette: Stadion bei Nacht über drei Zeitzonen.
|
||||
Tiefes Mitternachtsblau, kühles Flutlicht-Weiß, warmer Rasen-Akzent,
|
||||
ein Signal-Magenta für "live". Bewusst nicht die üblichen AI-Defaults. */
|
||||
--bg: #0b1020;
|
||||
--bg-raised: #121a32;
|
||||
--bg-card: #16203c;
|
||||
--line: #243152;
|
||||
--line-soft: #1b2540;
|
||||
--ink: #eef2fb;
|
||||
--ink-dim: #9aa6c4;
|
||||
--ink-faint: #5f6d92;
|
||||
--turf: #4ade80; /* Rasen / qualifiziert */
|
||||
--turf-deep: #1f7a45;
|
||||
--floodlight: #cfe0ff;
|
||||
--live: #ff3d7f; /* Live-Signal */
|
||||
--gold: #ffd24a; /* Sieger / Finale */
|
||||
--radius: 10px;
|
||||
--radius-sm: 6px;
|
||||
--shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
|
||||
|
||||
--font-display: "Archivo Expanded", "Archivo", system-ui, sans-serif;
|
||||
--font-body: "Inter", system-ui, -apple-system, sans-serif;
|
||||
--font-mono: "Geist Mono", "SFMono-Regular", ui-monospace, monospace;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
html { scroll-behavior: smooth; }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html { scroll-behavior: auto; }
|
||||
* { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
|
||||
}
|
||||
|
||||
body {
|
||||
background:
|
||||
radial-gradient(1200px 600px at 70% -10%, #16224a 0%, transparent 55%),
|
||||
radial-gradient(900px 500px at 10% 0%, #102046 0%, transparent 50%),
|
||||
var(--bg);
|
||||
color: var(--ink);
|
||||
font-family: var(--font-body);
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
a { color: inherit; text-decoration: none; }
|
||||
|
||||
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px 0 0; }
|
||||
|
||||
/* ---------- Header / Hero ---------- */
|
||||
.masthead {
|
||||
border-bottom: 1px solid var(--line);
|
||||
background: linear-gradient(180deg, rgba(18,26,50,0.7), transparent);
|
||||
position: sticky; top: 0; z-index: 50;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
.masthead-inner {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 14px 0; gap: 16px; flex-wrap: wrap;
|
||||
}
|
||||
.brand { display: flex; align-items: baseline; gap: 12px; }
|
||||
.brand-mark {
|
||||
font-family: var(--font-display);
|
||||
font-weight: 800; letter-spacing: -0.02em;
|
||||
font-size: clamp(20px, 3vw, 28px);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.brand-mark .accent { color: var(--turf); }
|
||||
.brand-sub {
|
||||
font-family: var(--font-mono); font-size: 11px;
|
||||
color: var(--ink-faint); letter-spacing: 0.08em; text-transform: uppercase;
|
||||
}
|
||||
|
||||
.status-pill {
|
||||
display: inline-flex; align-items: center; gap: 8px;
|
||||
font-family: var(--font-mono); font-size: 12px;
|
||||
color: var(--ink-dim);
|
||||
border: 1px solid var(--line); border-radius: 999px;
|
||||
padding: 6px 12px; background: var(--bg-card);
|
||||
}
|
||||
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
|
||||
.dot.on { background: var(--turf); box-shadow: 0 0 0 3px rgba(74,222,128,0.18); }
|
||||
.dot.live { background: var(--live); box-shadow: 0 0 0 3px rgba(255,61,127,0.2); animation: pulse 1.6s infinite; }
|
||||
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255,61,127,0); } }
|
||||
|
||||
/* ---------- Tabs ---------- */
|
||||
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 4px; }
|
||||
.masthead-tabs { width: 100%; border-bottom: none; margin: 0; }
|
||||
.tab {
|
||||
font-family: var(--font-display); font-weight: 700;
|
||||
text-transform: uppercase; letter-spacing: 0.01em;
|
||||
font-size: 14px; color: var(--ink-faint);
|
||||
padding: 16px 18px; cursor: pointer; border: none; background: none;
|
||||
border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
|
||||
}
|
||||
.tab:hover { color: var(--ink-dim); }
|
||||
.tab.active { color: var(--ink); border-bottom-color: var(--turf); }
|
||||
|
||||
.section { padding: 28px 0 64px; }
|
||||
|
||||
/* ---------- Gruppen ---------- */
|
||||
.group-grid {
|
||||
display: grid; gap: 16px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
|
||||
}
|
||||
.group-card {
|
||||
background: var(--bg-card); border: 1px solid var(--line);
|
||||
border-radius: var(--radius); overflow: hidden;
|
||||
}
|
||||
.group-head {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
|
||||
background: var(--bg-raised);
|
||||
}
|
||||
.group-name {
|
||||
font-family: var(--font-display); font-weight: 800; font-size: 16px;
|
||||
text-transform: uppercase; letter-spacing: 0.02em;
|
||||
}
|
||||
.group-name.group-complete { color: var(--turf); }
|
||||
.group-tag { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); }
|
||||
|
||||
table.standings { width: 100%; border-collapse: collapse; }
|
||||
.standings th {
|
||||
font-family: var(--font-mono); font-size: 10px; font-weight: 500;
|
||||
text-transform: uppercase; letter-spacing: 0.06em;
|
||||
color: var(--ink-faint); text-align: right; padding: 8px 6px;
|
||||
}
|
||||
.standings th.team { text-align: left; padding-left: 14px; }
|
||||
.standings td {
|
||||
padding: 9px 6px; text-align: right; font-variant-numeric: tabular-nums;
|
||||
border-top: 1px solid var(--line-soft); font-size: 13px;
|
||||
}
|
||||
.standings td.team {
|
||||
text-align: left; padding-left: 14px; display: flex; align-items: center; gap: 9px;
|
||||
}
|
||||
.rankdot {
|
||||
width: 18px; height: 18px; border-radius: 5px; flex: none;
|
||||
display: grid; place-items: center;
|
||||
font-family: var(--font-mono); font-size: 10px; font-weight: 600;
|
||||
color: var(--bg); background: var(--ink-faint);
|
||||
}
|
||||
.rankdot.q1, .rankdot.q2 { background: var(--turf); }
|
||||
.rankdot.q3 { background: var(--gold); color: #2a2200; }
|
||||
.rankdot.q3.out { background: var(--ink-faint); color: var(--bg); }
|
||||
.team-name { font-weight: 600; }
|
||||
.team-code { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
|
||||
.pts { font-weight: 700; color: var(--floodlight); }
|
||||
|
||||
/* Live-Zeile */
|
||||
.score-live { color: var(--live); font-weight: 700; }
|
||||
|
||||
/* Gruppen-Tab: grüne Hervorhebung für Teams mit laufendem Spiel */
|
||||
.group-grid .row-live { background: rgba(74, 222, 128, 0.08); }
|
||||
.group-grid .row-live .team-name { color: var(--turf); }
|
||||
.group-grid .row-live-dot {
|
||||
background: var(--turf);
|
||||
}
|
||||
|
||||
/* ---------- Drittplatzierte ---------- */
|
||||
.third-wrap { margin-top: 8px; }
|
||||
.third-table { width: 100%; border-collapse: collapse; background: var(--bg-card);
|
||||
border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
|
||||
.third-table th {
|
||||
font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
|
||||
letter-spacing: 0.06em; color: var(--ink-faint); padding: 11px 12px; text-align: right;
|
||||
background: var(--bg-raised); border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.third-table th:first-child, .third-table td:first-child { text-align: left; }
|
||||
.third-table td {
|
||||
padding: 10px 12px; text-align: right; font-variant-numeric: tabular-nums;
|
||||
border-top: 1px solid var(--line-soft); font-size: 13px;
|
||||
}
|
||||
.third-row.qual { background: linear-gradient(90deg, rgba(74,222,128,0.07), transparent); }
|
||||
.third-row.cut td { border-top: 2px solid var(--turf-deep); }
|
||||
.qual-badge {
|
||||
font-family: var(--font-mono); font-size: 10px; padding: 2px 7px; border-radius: 999px;
|
||||
}
|
||||
.qual-badge.yes { background: rgba(74,222,128,0.16); color: var(--turf); }
|
||||
.qual-badge.no { background: rgba(95,109,146,0.16); color: var(--ink-faint); }
|
||||
|
||||
/* Drittplatzierte: Teamname grün, wenn alle 3 Gruppenspiele gespielt */
|
||||
.third-table td.team-complete { color: var(--turf); }
|
||||
|
||||
/* ---------- Bracket ---------- */
|
||||
.bracket-banner {
|
||||
display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
|
||||
background: var(--bg-card); border: 1px solid var(--line);
|
||||
border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px;
|
||||
}
|
||||
.bracket-banner .k {
|
||||
font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim);
|
||||
}
|
||||
.bracket-banner .v { font-family: var(--font-mono); font-size: 12px; color: var(--turf); }
|
||||
.bracket-scroll {
|
||||
margin-left: -20px;
|
||||
margin-right: -20px;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
overflow-x: auto;
|
||||
overflow-y: visible;
|
||||
padding-bottom: 10px;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
.bracket {
|
||||
display: flex; gap: 26px; min-width: max-content; align-items: stretch;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.round { display: flex; flex-direction: column; min-width: 220px; }
|
||||
.round-label {
|
||||
font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
|
||||
font-size: 12px; letter-spacing: 0.06em; color: var(--ink-faint);
|
||||
margin-bottom: 10px; padding-left: 2px;
|
||||
}
|
||||
.round-matches { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 12px; }
|
||||
|
||||
.tie {
|
||||
background: var(--bg-card); border: 1px solid var(--line);
|
||||
border-radius: var(--radius-sm); position: relative;
|
||||
}
|
||||
.tie.final-tie { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(255,210,74,0.2); }
|
||||
.tie-meta {
|
||||
font-family: var(--font-mono); font-size: 9px; color: rgba(255,255,255,0.55);
|
||||
letter-spacing: 0.04em; padding: 5px 10px 0;
|
||||
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||
}
|
||||
.match-badge {
|
||||
position: absolute; top: -6px; right: -6px;
|
||||
font-family: var(--font-mono); font-size: 9px; font-weight: 700;
|
||||
line-height: 18px; min-width: 18px; text-align: center;
|
||||
border-radius: 999px; padding: 0 4px;
|
||||
background: #1a2744; color: #ffffff; border: 1px solid rgba(255,255,255,0.15);
|
||||
}
|
||||
.side {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 8px 10px; font-size: 13px;
|
||||
}
|
||||
.side + .side { border-top: 1px solid var(--line-soft); }
|
||||
.side .nm { display: flex; align-items: center; gap: 7px; min-width: 0; }
|
||||
.side .nm .c { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); }
|
||||
.side .lbl { color: var(--ink-dim); font-style: italic; }
|
||||
.side .sc { font-family: var(--font-mono); font-weight: 700; color: var(--floodlight); }
|
||||
.side.win .sc { color: var(--turf); }
|
||||
.side .prob {
|
||||
font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint);
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px;
|
||||
font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
|
||||
.legend span { display: inline-flex; align-items: center; gap: 6px; }
|
||||
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
|
||||
|
||||
/* Tooltip im K.o.-Baum (position: fixed, damit overflow-x den Tooltip nicht abschneidet) */
|
||||
.kobaum-tip {
|
||||
position: fixed;
|
||||
z-index: 200;
|
||||
pointer-events: none;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--ink);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
padding: 6px 9px;
|
||||
border-radius: var(--radius-sm);
|
||||
white-space: nowrap;
|
||||
box-shadow: 0 6px 20px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
/* ---------- Zustände ---------- */
|
||||
.notice {
|
||||
background: var(--bg-card); border: 1px solid var(--line);
|
||||
border-radius: var(--radius); padding: 18px 20px; color: var(--ink-dim);
|
||||
font-size: 14px;
|
||||
}
|
||||
.notice.err { border-color: #5a2230; color: #ffb0c0; }
|
||||
.skel { background: var(--bg-card); border: 1px solid var(--line);
|
||||
border-radius: var(--radius); height: 220px; animation: shimmer 1.4s infinite; }
|
||||
@keyframes shimmer { 50% { opacity: .55; } }
|
||||
|
||||
.foot {
|
||||
border-top: 1px solid var(--line); padding: 24px 0 48px;
|
||||
color: var(--ink-faint); font-size: 12px; font-family: var(--font-mono);
|
||||
}
|
||||
.foot a { color: var(--ink-dim); text-decoration: underline; text-underline-offset: 2px; }
|
||||
|
||||
/* =====================================================================
|
||||
MOBIL — Breakpoint 640px (iPhone ~375, Galaxy ~412, alle ≤640)
|
||||
===================================================================== */
|
||||
@media (max-width: 640px) {
|
||||
body { font-size: 14px; }
|
||||
.wrap { padding: 0 12px; }
|
||||
|
||||
/* ---------- mobil: Header ---------- */
|
||||
.masthead { padding: 0 12px; }
|
||||
.masthead-inner { padding: 10px 0; gap: 8px; }
|
||||
.brand { gap: 6px; }
|
||||
.brand-mark { font-size: 18px; }
|
||||
.brand-sub { font-size: 9px; letter-spacing: 0.04em; }
|
||||
.status-pill { font-size: 10px; padding: 4px 10px; gap: 5px; }
|
||||
.dot { width: 6px; height: 6px; }
|
||||
|
||||
/* ---------- mobil: Tabs (zwei Zeilen, kein horizontaler Scroll) ---------- */
|
||||
.masthead-tabs {
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 2px 4px;
|
||||
}
|
||||
.tab { padding: 8px 13px; font-size: 12px; }
|
||||
|
||||
.section { padding: 18px 0 48px; }
|
||||
|
||||
/* ---------- mobil: Gruppen ---------- */
|
||||
.group-grid { grid-template-columns: 1fr; gap: 12px; }
|
||||
.group-head { padding: 10px 12px; }
|
||||
.group-name { font-size: 14px; }
|
||||
.standings th { font-size: 9px; padding: 6px 3px; }
|
||||
.standings th.team { padding-left: 10px; }
|
||||
.standings td { font-size: 11px; padding: 7px 3px; }
|
||||
.standings td.team { padding-left: 10px; gap: 6px; }
|
||||
.rankdot { width: 16px; height: 16px; font-size: 8px; }
|
||||
.team-name { font-size: 12px; }
|
||||
|
||||
/* ---------- mobil: Spiele (Fixtures) ---------- */
|
||||
.fx { grid-template-columns: 1fr; gap: 8px; padding: 10px 12px; }
|
||||
.fx-meta { flex-direction: row; gap: 14px; align-items: center; }
|
||||
.fx-status { order: -1; }
|
||||
.fx-teams { column-gap: 16px; }
|
||||
.fx-score { font-size: 16px; min-width: 44px; }
|
||||
.fx-vs { font-size: 14px; min-width: 44px; }
|
||||
.fx-name { font-size: 13px; max-width: 110px; }
|
||||
.grp-switch { gap: 8px; }
|
||||
.grp-chip { width: 40px; height: 40px; font-size: 14px; }
|
||||
|
||||
/* ---------- mobil: Drittplatzierte ---------- */
|
||||
.third-table th { font-size: 9px; padding: 8px 6px; }
|
||||
.third-table td { font-size: 11px; padding: 7px 6px; }
|
||||
|
||||
/* ---------- mobil: K.o.-Baum ---------- */
|
||||
.bracket-scroll {
|
||||
margin-left: -12px;
|
||||
margin-right: -12px;
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.bracket { gap: 18px; }
|
||||
.round { min-width: 170px; }
|
||||
.round-label { font-size: 10px; }
|
||||
.round-matches { gap: 8px; }
|
||||
.tie-meta { font-size: 8px; padding: 3px 8px 0; }
|
||||
.side { padding: 6px 8px; font-size: 11px; }
|
||||
.side .nm { gap: 5px; }
|
||||
.prov-mark { font-size: 10px; }
|
||||
.side .prob { font-size: 9px; }
|
||||
.bracket-banner { padding: 10px 12px; font-size: 13px; }
|
||||
.legend { font-size: 10px; gap: 12px; }
|
||||
|
||||
/* ---------- mobil: Simulation ---------- */
|
||||
.sim-row { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
|
||||
.sim-row-phase { min-width: 100%; font-size: 9px; }
|
||||
.sim-row-date { min-width: auto; font-size: 9px; }
|
||||
.sim-row input[type="number"] { width: 32px; height: 32px; font-size: 15px; }
|
||||
|
||||
/* ---------- mobil: Footer ---------- */
|
||||
.foot { font-size: 11px; padding: 16px 0 32px; }
|
||||
|
||||
/* Kein horizontaler Überlauf außer im Bracket */
|
||||
body { overflow-x: hidden; }
|
||||
.bracket-scroll { overflow-x: auto; }
|
||||
}
|
||||
|
||||
/* ============ Erweiterungen v2 ============ */
|
||||
|
||||
/* Flaggen / Wappen */
|
||||
.flag {
|
||||
border-radius: 50%; object-fit: cover; flex: none;
|
||||
background: var(--bg-raised); border: 1px solid var(--line-soft);
|
||||
}
|
||||
.flag-fallback {
|
||||
display: grid; place-items: center;
|
||||
font-family: var(--font-mono); font-size: 9px; color: var(--ink-faint);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* Gruppen-Header als Button */
|
||||
.group-head-btn {
|
||||
width: 100%; cursor: pointer; text-align: left;
|
||||
font: inherit; color: inherit;
|
||||
transition: background .15s;
|
||||
}
|
||||
.group-head-btn:hover { background: var(--bg-card); }
|
||||
.group-head-btn:hover .group-tag { color: var(--turf); }
|
||||
.group-head-btn:focus-visible { outline: 2px solid var(--turf); outline-offset: -2px; }
|
||||
|
||||
/* Gruppen-Wechsler im Spiele-Tab */
|
||||
.grp-switch { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
|
||||
.grp-chip {
|
||||
width: 38px; height: 38px; border-radius: 8px;
|
||||
border: 1px solid var(--line); background: var(--bg-card);
|
||||
color: var(--ink-dim); font-family: var(--font-display); font-weight: 700;
|
||||
font-size: 14px; cursor: pointer; transition: all .15s;
|
||||
}
|
||||
.grp-chip:hover { border-color: var(--turf); color: var(--ink); }
|
||||
.grp-chip.active { background: var(--turf); color: var(--bg); border-color: var(--turf); }
|
||||
|
||||
/* Spiele-Karten */
|
||||
.fixtures { display: flex; flex-direction: column; gap: 10px; }
|
||||
.fx {
|
||||
background: var(--bg-card); border: 1px solid var(--line);
|
||||
border-radius: var(--radius); padding: 12px 16px;
|
||||
display: grid; grid-template-columns: 110px minmax(0, 560px) 1fr; gap: 14px; align-items: center;
|
||||
}
|
||||
.fx-live { border-color: rgba(255,61,127,0.4); }
|
||||
.fx-status {
|
||||
display: flex; align-items: center; gap: 7px;
|
||||
font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim);
|
||||
}
|
||||
.fx-teams {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
||||
align-items: center; column-gap: 34px;
|
||||
}
|
||||
/* Beide Teams: Flagge links, Name daneben. Linkes Team rechtsbündig an den Score,
|
||||
rechtes Team linksbündig – so ist der Abstand zum Ergebnis beidseitig gleich. */
|
||||
.fx-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
||||
.fx-team.home { justify-content: flex-end; }
|
||||
.fx-team.away { justify-content: flex-start; }
|
||||
.fx-team .fx-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.fx-team.win .fx-name { color: var(--turf); }
|
||||
.fx-score { font-family: var(--font-mono); font-weight: 700; font-size: 18px; color: var(--floodlight); white-space: nowrap; text-align: center; min-width: 54px; }
|
||||
.fx-score.score-live { color: var(--live); }
|
||||
.fx-vs { font-family: var(--font-mono); font-size: 15px; color: var(--ink-faint); text-align: center; min-width: 54px; }
|
||||
.fx-meta {
|
||||
display: flex; flex-direction: column; gap: 3px; align-items: flex-end;
|
||||
font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); white-space: nowrap;
|
||||
}
|
||||
/* Austragungsort heller hervorheben. */
|
||||
.fx-venue { color: var(--ink-dim); }
|
||||
|
||||
/* Live-Tabelle der Gruppe unterhalb der Spiele. */
|
||||
.fx-standings { margin-top: 22px; }
|
||||
.fx-standings-title {
|
||||
font-family: var(--font-display, var(--font-mono)); font-size: 13px; letter-spacing: 0.06em;
|
||||
text-transform: uppercase; color: var(--ink-dim); margin: 0 2px 10px;
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
}
|
||||
.fx-standings-live {
|
||||
font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
|
||||
color: var(--live); font-weight: 700;
|
||||
animation: livepulse 1.6s ease-in-out infinite;
|
||||
}
|
||||
.fx-standings .standings { width: 100%; }
|
||||
/* Zeile eines Teams mit laufendem Spiel hervorheben. */
|
||||
.fx-standings .row-live { background: rgba(255, 61, 127, 0.07); }
|
||||
.fx-standings .row-live .team-name { color: var(--floodlight); }
|
||||
.row-live-dot {
|
||||
display: inline-block; width: 7px; height: 7px; border-radius: 50%;
|
||||
background: var(--live); margin-left: 8px; vertical-align: middle;
|
||||
animation: livepulse 1.6s ease-in-out infinite;
|
||||
}
|
||||
@keyframes livepulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.35; }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.fx { grid-template-columns: 1fr; gap: 8px; }
|
||||
.fx-meta { flex-direction: row; gap: 14px; align-items: center; }
|
||||
.fx-status { order: -1; }
|
||||
}
|
||||
|
||||
/* Bracket: Label-Header braucht kein Extra-Padding mehr (sitzt im Kasten) */
|
||||
.round-matches { padding-top: 0; }
|
||||
|
||||
/* Bracket: fix vs. vorläufig.
|
||||
.nm trägt die Standardfarbe; Team-Name liegt in .tn. */
|
||||
.side .nm .tn { color: var(--ink); }
|
||||
|
||||
/* vorläufig: gedimmt + kursiv + Marker */
|
||||
.side.prov .nm .tn { color: var(--ink-dim); font-style: italic; }
|
||||
.prov-mark {
|
||||
color: #f0a23a; font-family: var(--font-mono); font-weight: 700;
|
||||
font-size: 12px; margin-left: 2px;
|
||||
}
|
||||
|
||||
/* fix: echtes Team steht fest -> fett weiß + grüner Marker links */
|
||||
.side.fix .nm .tn { color: #ffffff; font-weight: 700; }
|
||||
.side.fix { box-shadow: inset 3px 0 0 var(--turf-deep); }
|
||||
|
||||
/* Sieger eines bereits gespielten Tie sticht zusätzlich grün hervor */
|
||||
.side.win .nm .tn { color: var(--turf); font-weight: 700; }
|
||||
.side.win { box-shadow: inset 3px 0 0 var(--turf); }
|
||||
|
||||
/* Legende-Marker */
|
||||
.legend i.leg-fix { background: var(--turf-deep); }
|
||||
.legend i.leg-prov {
|
||||
background: repeating-linear-gradient(45deg, #f0a23a, #f0a23a 3px, transparent 3px, transparent 6px);
|
||||
border: 1px solid #f0a23a;
|
||||
}
|
||||
36
app/[locale]/layout.tsx
Normal file
36
app/[locale]/layout.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import type { Metadata } from "next";
|
||||
import Script from "next/script";
|
||||
import { Locale, getDictionary } from "@/lib/i18n";
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
|
||||
const { locale } = await params;
|
||||
const dict = getDictionary(locale as Locale);
|
||||
return {
|
||||
title: dict.meta.title,
|
||||
description: dict.meta.description,
|
||||
};
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return [{ locale: "en" }, { locale: "de" }];
|
||||
}
|
||||
|
||||
export default function LocaleLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
{children}
|
||||
{process.env.NEXT_PUBLIC_UMAMI_SRC && process.env.NEXT_PUBLIC_UMAMI_ID && (
|
||||
<Script
|
||||
defer
|
||||
src={process.env.NEXT_PUBLIC_UMAMI_SRC}
|
||||
data-website-id={process.env.NEXT_PUBLIC_UMAMI_ID}
|
||||
strategy="afterInteractive"
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,21 +1,8 @@
|
||||
import type { Metadata } from "next";
|
||||
import Script from "next/script";
|
||||
import "./globals.css";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "WM 26 — Gruppen & K.o.-Baum",
|
||||
description:
|
||||
"Live-Gruppentabellen, Drittplatzierten-Wertung und der vollständige K.o.-Baum der FIFA WM 2026 mit Annex-C-Zuordnung und Polymarket-Wahrscheinlichkeiten.",
|
||||
};
|
||||
|
||||
export const viewport = {
|
||||
width: "device-width",
|
||||
initialScale: 1,
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="de">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
|
||||
@@ -24,17 +11,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
{children}
|
||||
{process.env.NEXT_PUBLIC_UMAMI_SRC && process.env.NEXT_PUBLIC_UMAMI_ID && (
|
||||
<Script
|
||||
defer
|
||||
src={process.env.NEXT_PUBLIC_UMAMI_SRC}
|
||||
data-website-id={process.env.NEXT_PUBLIC_UMAMI_ID}
|
||||
strategy="afterInteractive"
|
||||
/>
|
||||
)}
|
||||
</body>
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
140
lib/i18n/de.ts
Normal file
140
lib/i18n/de.ts
Normal file
@@ -0,0 +1,140 @@
|
||||
import { Dictionary } from "./types";
|
||||
|
||||
const de: Dictionary = {
|
||||
meta: {
|
||||
title: "WM 26 — Gruppen & K.o.-Baum",
|
||||
description:
|
||||
"Live-Gruppentabellen, Drittplatzierten-Wertung und der vollständige K.o.-Baum der FIFA WM 2026 mit Annex-C-Zuordnung und Polymarket-Wahrscheinlichkeiten.",
|
||||
},
|
||||
header: {
|
||||
hostCountries: "USA · Kanada · Mexiko",
|
||||
},
|
||||
status: {
|
||||
feedOffline: "Feed offline",
|
||||
updated: (time: string) => `Aktualisiert ${time}`,
|
||||
live: "Live",
|
||||
loading: "Lade Daten…",
|
||||
running: "läuft",
|
||||
halftime: "Halbzeit",
|
||||
finished: "Beendet",
|
||||
postponed: "Verzögert",
|
||||
},
|
||||
nav: {
|
||||
koFixtures: "K.O.-Spiele",
|
||||
groups: "Gruppen",
|
||||
groupFixtures: (group: string) => `Gruppenspiele – ${group}`,
|
||||
groupFixturesNoGroup: "Gruppenspiele",
|
||||
thirdPlace: "Drittplatzierte",
|
||||
bracket: "K.o.-Baum",
|
||||
simulation: "Simulation",
|
||||
},
|
||||
error: {
|
||||
feedUnreachable:
|
||||
"Die Live-Feeds sind gerade nicht erreichbar. Die Seite versucht es automatisch erneut.",
|
||||
unknown: "unbekannter Fehler",
|
||||
},
|
||||
footer: {
|
||||
dashboard: "WM 2026 Dashboard",
|
||||
dataSources: "Daten: football-data.org · Polymarket Gamma API · FIFA Annex C",
|
||||
},
|
||||
sim: {
|
||||
notice:
|
||||
"Simulation — alle ungespielten Spiele sind mit dem Polymarket-Favoriten vorbelegt. Die angezeigten Wahrscheinlichkeiten stammen von Polymarket.",
|
||||
heading: "Simulierter K.o.-Baum",
|
||||
},
|
||||
koFixtures: {
|
||||
noMatches: "Keine K.o.-Spiele mit bekannten Teams verfügbar.",
|
||||
liveBadge: "LIVE",
|
||||
nextMatch: "NÄCHSTES SPIEL",
|
||||
postponedBadge: "VERZÖGERT",
|
||||
match: (n: number) => `Spiel ${n}`,
|
||||
},
|
||||
label: {
|
||||
goals: "Tore",
|
||||
liveIndicator: "● LIVE",
|
||||
scrollToTop: "Nach oben scrollen",
|
||||
securelyQualified: "sicher qualifiziert",
|
||||
},
|
||||
stage: {
|
||||
r16: "Achtelfinale",
|
||||
qf: "Viertelfinale",
|
||||
sf: "Halbfinale",
|
||||
thirdPlace: "Platz 3",
|
||||
final: "Finale",
|
||||
},
|
||||
round: {
|
||||
r32: "Letzte 32",
|
||||
r16: "Achtelfinale",
|
||||
qf: "Viertelfinale",
|
||||
sf: "Halbfinale",
|
||||
final: "Finale",
|
||||
thirdPlace: "Spiel um Platz 3",
|
||||
},
|
||||
bracket: {
|
||||
provisionalTooltip: "vorläufig – Gruppe/Zuordnung noch nicht fix",
|
||||
match: (n: number) => `Spiel ${n}`,
|
||||
penaltyShootout: "i.E.",
|
||||
annexHeader: "Annex-C-Zuordnung der Drittplatzierten:",
|
||||
annexResolved:
|
||||
"aufgelöst — die acht Dritten sind den Gruppensiegern fest zugeteilt",
|
||||
annexPending:
|
||||
"noch offen — sobald die 8 besten Dritten feststehen, verbindet sich der Baum automatisch",
|
||||
winner: "Sieger",
|
||||
loser: "Verlierer",
|
||||
winnerFromMatch: (n: number) => `Sieger aus Spiel ${n}`,
|
||||
loserFromMatch: (n: number) => `Verlierer aus Spiel ${n}`,
|
||||
},
|
||||
legend: {
|
||||
winner: "Sieger / weiter",
|
||||
final: "Finale",
|
||||
fixed: "fix qualifiziert",
|
||||
provisional: "vorläufig (≈, nach aktueller Tabelle)",
|
||||
placeholder: "Platzhalter offen",
|
||||
probExplanation:
|
||||
"%-Werte: Polymarket-Wahrscheinlichkeit (falls verfügbar)",
|
||||
},
|
||||
tooltips: {
|
||||
provisionalPrefix: "aktuell",
|
||||
firstOfGroup: (group: string) => `1. Gruppe ${group}`,
|
||||
secondOfGroup: (group: string) => `2. Gruppe ${group}`,
|
||||
thirdOfGroup: (group: string) => `3. der Gruppe ${group}`,
|
||||
provisionalThird: (pool: string) => `aktuell 3. Gruppe ${pool}`,
|
||||
},
|
||||
slot: {
|
||||
winner: (group: string) => `Sieger ${group}`,
|
||||
runnerUp: (group: string) => `Zweiter ${group}`,
|
||||
thirdOfGroup: (group: string) => `3. der Gruppe ${group}`,
|
||||
thirdPlacePool: (pool: string) => `3. ${pool}`,
|
||||
},
|
||||
table: {
|
||||
rank: "#",
|
||||
team: "Mannschaft",
|
||||
group: "Gruppe",
|
||||
matches: "Sp",
|
||||
won: "S",
|
||||
drawn: "U",
|
||||
lost: "N",
|
||||
goals: "Tore",
|
||||
goalDiff: "±",
|
||||
points: "Pkt",
|
||||
status: "Status",
|
||||
},
|
||||
thirds: {
|
||||
explanation:
|
||||
"Acht der zwölf Gruppendritten erreichen die Runde der letzten 32. Gewertet wird gruppenübergreifend nach Punkten, Tordifferenz und Toren — der Direktvergleich entfällt, weil diese Teams nie gegeneinander gespielt haben. Die Trennlinie markiert den Schnitt zwischen Platz 8 und 9.",
|
||||
advances: "weiter",
|
||||
eliminated: "raus",
|
||||
},
|
||||
fixtures: {
|
||||
standingsTitle: (group: string) => `Tabelle – Gruppe ${group}`,
|
||||
noMatches: (group: string) =>
|
||||
`Für Gruppe ${group} liegen noch keine Spiele im Feed vor.`,
|
||||
},
|
||||
groups: {
|
||||
viewGroupGames: (group: string) => `Spiele der Gruppe ${group} ansehen`,
|
||||
groupLabel: (group: string) => `Gruppe ${group}`,
|
||||
viewGames: "Spiele ansehen →",
|
||||
},
|
||||
};
|
||||
|
||||
export default de;
|
||||
145
lib/i18n/en.ts
Normal file
145
lib/i18n/en.ts
Normal file
@@ -0,0 +1,145 @@
|
||||
import { Dictionary } from "./types";
|
||||
|
||||
function ordinal(n: number): string {
|
||||
const s = ["th", "st", "nd", "rd"];
|
||||
const v = n % 100;
|
||||
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
||||
}
|
||||
|
||||
const en: Dictionary = {
|
||||
meta: {
|
||||
title: "WC 26 — Groups & KO Bracket",
|
||||
description:
|
||||
"Live group tables, third-place ranking and the complete KO bracket for the FIFA World Cup 2026 with Annex C assignment and Polymarket probabilities.",
|
||||
},
|
||||
header: {
|
||||
hostCountries: "USA · Canada · Mexico",
|
||||
},
|
||||
status: {
|
||||
feedOffline: "Feed offline",
|
||||
updated: (time: string) => `Updated ${time}`,
|
||||
live: "Live",
|
||||
loading: "Loading…",
|
||||
running: "running",
|
||||
halftime: "Half time",
|
||||
finished: "Finished",
|
||||
postponed: "Postponed",
|
||||
},
|
||||
nav: {
|
||||
koFixtures: "KO Matches",
|
||||
groups: "Groups",
|
||||
groupFixtures: (group: string) => `Group Stage – ${group}`,
|
||||
groupFixturesNoGroup: "Group Stage",
|
||||
thirdPlace: "Third Place",
|
||||
bracket: "KO Bracket",
|
||||
simulation: "Simulation",
|
||||
},
|
||||
error: {
|
||||
feedUnreachable:
|
||||
"Live feeds are currently unavailable. The page will retry automatically.",
|
||||
unknown: "unknown error",
|
||||
},
|
||||
footer: {
|
||||
dashboard: "WC 2026 Dashboard",
|
||||
dataSources: "Data: football-data.org · Polymarket Gamma API · FIFA Annex C",
|
||||
},
|
||||
sim: {
|
||||
notice:
|
||||
"Simulation — all unplayed matches are pre-filled with the Polymarket favourite. Probabilities shown are from Polymarket.",
|
||||
heading: "Simulated KO Bracket",
|
||||
},
|
||||
koFixtures: {
|
||||
noMatches: "No KO matches with known teams available.",
|
||||
liveBadge: "LIVE",
|
||||
nextMatch: "NEXT MATCH",
|
||||
postponedBadge: "POSTPONED",
|
||||
match: (n: number) => `Match ${n}`,
|
||||
},
|
||||
label: {
|
||||
goals: "Goals",
|
||||
liveIndicator: "● LIVE",
|
||||
scrollToTop: "Scroll to top",
|
||||
securelyQualified: "securely qualified",
|
||||
},
|
||||
stage: {
|
||||
r16: "Round of 16",
|
||||
qf: "Quarter-finals",
|
||||
sf: "Semi-finals",
|
||||
thirdPlace: "3rd Place",
|
||||
final: "Final",
|
||||
},
|
||||
round: {
|
||||
r32: "Round of 32",
|
||||
r16: "Round of 16",
|
||||
qf: "Quarter-finals",
|
||||
sf: "Semi-finals",
|
||||
final: "Final",
|
||||
thirdPlace: "Third Place Match",
|
||||
},
|
||||
bracket: {
|
||||
provisionalTooltip: "provisional – group/assignment not yet fixed",
|
||||
match: (n: number) => `Match ${n}`,
|
||||
penaltyShootout: "PSO",
|
||||
annexHeader: "Annex C third-place assignment:",
|
||||
annexResolved:
|
||||
"resolved — the eight third-placed teams are permanently assigned to group winners",
|
||||
annexPending:
|
||||
"pending — once the 8 best third-placed teams are determined, the bracket auto-connects",
|
||||
winner: "Winner",
|
||||
loser: "Loser",
|
||||
winnerFromMatch: (n: number) => `Winner of match ${n}`,
|
||||
loserFromMatch: (n: number) => `Loser of match ${n}`,
|
||||
},
|
||||
legend: {
|
||||
winner: "Winner / advances",
|
||||
final: "Final",
|
||||
fixed: "securely qualified",
|
||||
provisional: "provisional (≈, current standings)",
|
||||
placeholder: "placeholder open",
|
||||
probExplanation: "% values: Polymarket probability (if available)",
|
||||
},
|
||||
tooltips: {
|
||||
provisionalPrefix: "currently",
|
||||
firstOfGroup: (group: string) => `${ordinal(1)} in Group ${group}`,
|
||||
secondOfGroup: (group: string) => `${ordinal(2)} in Group ${group}`,
|
||||
thirdOfGroup: (group: string) => `${ordinal(3)} in Group ${group}`,
|
||||
provisionalThird: (pool: string) => `currently 3rd of Group ${pool}`,
|
||||
},
|
||||
slot: {
|
||||
winner: (group: string) => `Winner ${group}`,
|
||||
runnerUp: (group: string) => `Runner-up ${group}`,
|
||||
thirdOfGroup: (group: string) => `3rd of Group ${group}`,
|
||||
thirdPlacePool: (pool: string) => `3rd ${pool}`,
|
||||
},
|
||||
table: {
|
||||
rank: "#",
|
||||
team: "Team",
|
||||
group: "Group",
|
||||
matches: "GP",
|
||||
won: "W",
|
||||
drawn: "D",
|
||||
lost: "L",
|
||||
goals: "Goals",
|
||||
goalDiff: "±",
|
||||
points: "Pts",
|
||||
status: "Status",
|
||||
},
|
||||
thirds: {
|
||||
explanation:
|
||||
"Eight of the twelve group third-placed teams advance to the Round of 32. Ranking is across all groups by points, goal difference and goals scored — head-to-head does not apply because these teams have never met. The separator marks the cut between 8th and 9th place.",
|
||||
advances: "advances",
|
||||
eliminated: "out",
|
||||
},
|
||||
fixtures: {
|
||||
standingsTitle: (group: string) => `Standings – Group ${group}`,
|
||||
noMatches: (group: string) =>
|
||||
`No matches available yet for Group ${group}.`,
|
||||
},
|
||||
groups: {
|
||||
viewGroupGames: (group: string) => `View Group ${group} matches`,
|
||||
groupLabel: (group: string) => `Group ${group}`,
|
||||
viewGames: "View matches →",
|
||||
},
|
||||
};
|
||||
|
||||
export default en;
|
||||
11
lib/i18n/index.ts
Normal file
11
lib/i18n/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Locale, Dictionary } from "./types";
|
||||
import de from "./de";
|
||||
import en from "./en";
|
||||
|
||||
export const dictionaries: Record<Locale, Dictionary> = { de, en };
|
||||
|
||||
export function getDictionary(locale: Locale): Dictionary {
|
||||
return dictionaries[locale] ?? en;
|
||||
}
|
||||
|
||||
export { type Locale, type Dictionary } from "./types";
|
||||
130
lib/i18n/types.ts
Normal file
130
lib/i18n/types.ts
Normal file
@@ -0,0 +1,130 @@
|
||||
export type Locale = "de" | "en";
|
||||
|
||||
export interface Dictionary {
|
||||
meta: {
|
||||
title: string;
|
||||
description: string;
|
||||
};
|
||||
header: {
|
||||
hostCountries: string;
|
||||
};
|
||||
status: {
|
||||
feedOffline: string;
|
||||
updated: (time: string) => string;
|
||||
live: string;
|
||||
loading: string;
|
||||
running: string;
|
||||
halftime: string;
|
||||
finished: string;
|
||||
postponed: string;
|
||||
};
|
||||
nav: {
|
||||
koFixtures: string;
|
||||
groups: string;
|
||||
groupFixtures: (group: string) => string;
|
||||
groupFixturesNoGroup: string;
|
||||
thirdPlace: string;
|
||||
bracket: string;
|
||||
simulation: string;
|
||||
};
|
||||
error: {
|
||||
feedUnreachable: string;
|
||||
unknown: string;
|
||||
};
|
||||
footer: {
|
||||
dashboard: string;
|
||||
dataSources: string;
|
||||
};
|
||||
sim: {
|
||||
notice: string;
|
||||
heading: string;
|
||||
};
|
||||
koFixtures: {
|
||||
noMatches: string;
|
||||
liveBadge: string;
|
||||
nextMatch: string;
|
||||
postponedBadge: string;
|
||||
match: (n: number) => string;
|
||||
};
|
||||
label: {
|
||||
goals: string;
|
||||
liveIndicator: string;
|
||||
scrollToTop: string;
|
||||
securelyQualified: string;
|
||||
};
|
||||
stage: {
|
||||
r16: string;
|
||||
qf: string;
|
||||
sf: string;
|
||||
thirdPlace: string;
|
||||
final: string;
|
||||
};
|
||||
round: {
|
||||
r32: string;
|
||||
r16: string;
|
||||
qf: string;
|
||||
sf: string;
|
||||
final: string;
|
||||
thirdPlace: string;
|
||||
};
|
||||
bracket: {
|
||||
provisionalTooltip: string;
|
||||
match: (n: number) => string;
|
||||
penaltyShootout: string;
|
||||
annexHeader: string;
|
||||
annexResolved: string;
|
||||
annexPending: string;
|
||||
winner: string;
|
||||
loser: string;
|
||||
winnerFromMatch: (n: number) => string;
|
||||
loserFromMatch: (n: number) => string;
|
||||
};
|
||||
legend: {
|
||||
winner: string;
|
||||
final: string;
|
||||
fixed: string;
|
||||
provisional: string;
|
||||
placeholder: string;
|
||||
probExplanation: string;
|
||||
};
|
||||
tooltips: {
|
||||
provisionalPrefix: string;
|
||||
firstOfGroup: (group: string) => string;
|
||||
secondOfGroup: (group: string) => string;
|
||||
thirdOfGroup: (group: string) => string;
|
||||
provisionalThird: (pool: string) => string;
|
||||
};
|
||||
slot: {
|
||||
winner: (group: string) => string;
|
||||
runnerUp: (group: string) => string;
|
||||
thirdOfGroup: (group: string) => string;
|
||||
thirdPlacePool: (pool: string) => string;
|
||||
};
|
||||
table: {
|
||||
rank: string;
|
||||
team: string;
|
||||
group: string;
|
||||
matches: string;
|
||||
won: string;
|
||||
drawn: string;
|
||||
lost: string;
|
||||
goals: string;
|
||||
goalDiff: string;
|
||||
points: string;
|
||||
status: string;
|
||||
};
|
||||
thirds: {
|
||||
explanation: string;
|
||||
advances: string;
|
||||
eliminated: string;
|
||||
};
|
||||
fixtures: {
|
||||
standingsTitle: (group: string) => string;
|
||||
noMatches: (group: string) => string;
|
||||
};
|
||||
groups: {
|
||||
viewGroupGames: (group: string) => string;
|
||||
groupLabel: (group: string) => string;
|
||||
viewGames: string;
|
||||
};
|
||||
}
|
||||
42
middleware.ts
Normal file
42
middleware.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import type { NextRequest } from "next/server";
|
||||
|
||||
const SUPPORTED_LOCALES = ["en", "de"] as const;
|
||||
|
||||
function getLocale(request: NextRequest): string {
|
||||
const acceptLang = request.headers.get("accept-language") ?? "";
|
||||
const preferred = acceptLang.split(",")[0]?.trim().slice(0, 2);
|
||||
if (preferred && SUPPORTED_LOCALES.includes(preferred as any)) return preferred;
|
||||
return "en";
|
||||
}
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
const { pathname } = request.nextUrl;
|
||||
|
||||
// API routes and static files pass through
|
||||
if (
|
||||
pathname.startsWith("/api/") ||
|
||||
pathname.includes(".") ||
|
||||
pathname.startsWith("/_next")
|
||||
) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// Check if pathname already has a supported locale
|
||||
const hasLocale = SUPPORTED_LOCALES.some(
|
||||
(l) => pathname === `/${l}` || pathname.startsWith(`/${l}/`),
|
||||
);
|
||||
|
||||
if (!hasLocale) {
|
||||
const locale = getLocale(request);
|
||||
const url = request.nextUrl.clone();
|
||||
url.pathname = `/${locale}${pathname === "/" ? "" : pathname}`;
|
||||
return NextResponse.redirect(url);
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/((?!_next|api|favicon.ico).*)"],
|
||||
};
|
||||
Reference in New Issue
Block a user