Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 7 additions & 30 deletions apps/web/components/overlay/MatchOverlay.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/**
* MatchOverlay, bottom-sheet card with the compact match-preview view.
*
* Renders a slimmed-down version of `/match/[id]/preview`: kickoff
* Renders a slimmed-down version of the match-preview surface: kickoff
* label + venue, both team flags, and quick links to each team's
* overlay (replaces self) plus a "View full preview" link to the real
* route.
* overlay (replaces self).
*
* Like TeamOverlay, this doesn't import the full preview component -
* it builds its own compact view from pure helpers so the overlay opens
* instantly.
* Tim 2026-06-05: the "Full page →" header CTA and the "Open full
* preview (Predict / H2H / Form / Lineup / Stats) →" footer CTA were
* removed because the underlying `/match/[id]/preview` route doesn't
* exist as a publishable surface yet. The overlay IS the preview
* surface for now.
*/

"use client";

import Link from "next/link";
import { useMemo } from "react";

import { loadFixtures2026 } from "@tournamental/bracket-engine";
Expand Down Expand Up @@ -66,28 +66,15 @@ export function MatchOverlay(props: MatchOverlayProps) {
const home = match.homeCode ? canonicalTeam(match.homeCode) : undefined;
const away = match.awayCode ? canonicalTeam(match.awayCode) : undefined;

const fullPageHref = `/match/${match.matchId}/preview`;
const homeName = home?.name ?? match.homeCode ?? "TBD";
const awayName = away?.name ?? match.awayCode ?? "TBD";

const headerSlot = (
<Link
href={fullPageHref}
className="vt-overlay-fullpage-cta"
onClick={() => overlay.closeAll()}
aria-label="Open the full match preview page"
>
Full page →
</Link>
);

const kickoff = new Date(match.kickoffUtc);
const kickoffLabel = formatKickoff(kickoff);

return (
<Sheet
title={`${homeName} vs ${awayName}`}
headerSlot={headerSlot}
depth={depth}
onClose={overlay.close}
idHint={`match-${match.matchId}`}
Expand Down Expand Up @@ -118,16 +105,6 @@ export function MatchOverlay(props: MatchOverlayProps) {
onOpenTeam={(code) => overlay.replace("team", { code })}
/>
</div>

<footer className="vt-match-overlay-actions">
<Link
href={fullPageHref}
className="vt-overlay-fullpage-cta"
onClick={() => overlay.closeAll()}
>
Open full preview (Predict / H2H / Form / Lineup / Stats) →
</Link>
</footer>
</div>
</Sheet>
);
Expand Down
46 changes: 7 additions & 39 deletions apps/web/components/overlay/TeamOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
*
* Pulls a compact set of fields from the canonical teams JSON + the
* tournament fixture data so the overlay is light enough to open
* instantly. The "View full team page" CTA in the header navigates to
* the real `/team/[code]` route for the deeper detail view.
* instantly. The overlay IS the team-detail surface for now.
*
* Note: we deliberately don't import the full team page component -
* it's a server component with its own data dependencies. Instead we
* hand-roll a compact card view here that mirrors the same data
* surface (flag, name, world rank, group, manager, fixtures).
* Tim 2026-06-05: the "Full page →" header CTA, the "View match
* preview" button in the Next-Match section, and the "Open full team
* page →" footer CTA were removed because the underlying `/team/[code]`
* route doesn't exist as a publishable surface yet. Fixture rows below
* the Next-Match section still open the MatchOverlay (not a route), so
* navigation between team + match overlays continues to work.
*/

"use client";
Expand Down Expand Up @@ -82,22 +83,9 @@ export function TeamOverlay(props: TeamOverlayProps) {

const primary = canonical.kit?.primary ?? "#fbbf24";

const fullPageHref = `/team/${upper}`;
const headerSlot = (
<Link
href={fullPageHref}
className="vt-overlay-fullpage-cta"
onClick={() => overlay.closeAll()}
aria-label={`Open the full ${canonical.name} team page`}
>
Full page →
</Link>
);

return (
<Sheet
title={canonical.name}
headerSlot={headerSlot}
depth={depth}
onClose={overlay.close}
idHint={`team-${upper}`}
Expand Down Expand Up @@ -146,16 +134,6 @@ export function TeamOverlay(props: TeamOverlayProps) {
</time>
{upcoming.venue && <span>, {upcoming.venue}</span>}
</p>
<button
type="button"
className="vt-overlay-fullpage-cta"
onClick={() =>
overlay.replace("match", { id: upcoming.matchId })
}
aria-label="Open match preview"
>
View match preview
</button>
</section>
)}

Expand Down Expand Up @@ -195,16 +173,6 @@ export function TeamOverlay(props: TeamOverlayProps) {
</ul>
</section>
)}

<footer className="vt-team-overlay-actions">
<Link
href={fullPageHref}
className="vt-overlay-fullpage-cta"
onClick={() => overlay.closeAll()}
>
Open full team page →
</Link>
</footer>
</div>
</Sheet>
);
Expand Down
Loading