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
13 changes: 7 additions & 6 deletions docs/design-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
One visual language that every page is built from, so pages can't drift apart. See it all at `/dev/ui` (dev builds only).

## Direction
"Navy", chosen by the lead on 2026-10-19 (reference: `design/reference.webp`, a direction, not a target).
- Dark blue slate, never pitch black. One cyan accent; at most one primary button per view.
"Classic" (2026-11-07): the old sourcejump.net, updated. Replaced "Navy".
- A slate sheet (`bg`, `shadow-sheet`) between darker gutters. One cyan accent; at most one primary button per view.
- Gamified but professional: medals, tier colors, WR badges, count-ups and small motions. No mascots, confetti, slogans or sales copy.
- Play for everything. Its digits are all the same width, so times line up in columns without a second font.
- Corners: `rounded-sm` (4px) for badges, `rounded-md` (8px) for controls and rows, `rounded-lg` (12px) only for padded cards and dialogs.
Expand All @@ -21,6 +21,7 @@ One visual language that every page is built from, so pages can't drift apart. S
| Component | Use |
|---|---|
| `Page` | Every page's content area; `width` is `wide`, `narrow` (reading) or `fill` (inside a section layout that sets its own width, such as the staff area). Runs the page fade |
| `Masthead` | Full-width top band, plain or over a map picture; inside `Page width="fill"` (Players pages) |
| `Link` | Every internal link; never prefetches. Lint blocks importing `next/link` elsewhere |
| `Button`, `ButtonLink`, `ButtonAnchor` | `primary` (one per view), `secondary` (default), `ghost`; sizes `sm`, `md`. A `ghost` button with `aria-pressed` or `aria-expanded` shows the accent while on. `ButtonAnchor` is for full page loads, such as sign-in |
| `Card`, `Label` | Bordered surface; `interactive` adds the hover lift. `Label` is the small uppercase heading |
Expand All @@ -36,15 +37,16 @@ One visual language that every page is built from, so pages can't drift apart. S
| `Segmented` | Looks like segmented `Tabs`, for a choice that changes the view in place (a server's activity range, a post's kind). The chosen option is in the accent |
| `ChoiceMenu` | "Label Value ▾": one choice from a list, in a `Menu` of radio items, changing the view in place, or following each option's `href` on a server page. Boards, profiles and the Maps page use a row of them (Style, Track, Runs; Sort, Records in; lead, 2026-10-26); quiet options are dimmed but choosable, disabled ones dimmed and kept in place. On a phone each takes a full row, label left and value right |
| `ChoiceBar` | The row those menus sit in, with any tabs beside them. Every page uses it, so the spacing between choices stays the same everywhere |
| `Pager` | Previous and next under a paged list |
| `Pager` | Previous and next under a paged list; `param`: its address key |
| `DividedList`, `DividedSection` | Rows with lines between them, and a part set off by a line above, inside a `Card` or `Dialog`. The lines run to the surface's edges |
| `StepChart` | A value that changes in steps over time (WR history). Hover snaps a crosshair to the nearest point; points take focus and open their link |
| `LineChart` | One count over time from zero (players online). Drawn in a fixed box stretched by CSS, so it fills its container before scripts load. Hover, tap or arrow keys pick a point; the parent shows its values. An optional second line (`y2`, gold) shows a part of the first on the same scale (world records among runs). Never two scales on one chart |
| `TierSpread` | How many maps hold each tier: a donut in tier colors beside each tier's count and share; each slice and row links to that tier's maps, the others dim, and "All" closes the list (Maps page) |
| `Tooltip` | Hint on hover and focus; the child must be focusable |
| `Menu`, `MenuItem`, `MenuLink`, `MenuSeparator` | Menu button (account, mobile sections) |
| `Dialog` | Controlled modal (`open`, `onClose`). A field marked `data-autofocus` takes focus on each opening (React's `autoFocus` fires only on mount). Closes itself, without calling `onClose`, when its page is hidden for Back |
| `Input`, `Textarea`, `CountUp` | Text field with optional icon; multi-line field; animated number |
| `BrandIcon`, `SteamButton` | Community and Steam logos (`colored`: in their own colors); Steam sign-in |
| `Input`, `SearchField`, `Textarea`, `CountUp` | Text field with optional icon; search, button inside; multi-line field; animated number |
| `Prose` | Long-form HTML (a post's body) in the site's type. Only for HTML the API made safe |

The run dialog opens in place: `RunLink` adds `?run=<id>` to the address with `history.pushState`, and `RunDialogHost` (in the root layout) opens at once and loads the run inside. Back or Escape closes it, and the address can be shared. A run link's `href` is `/runs/{id}`, the run's own page, for new tabs. A map page's style and track work the same way, with `replaceState`.
Expand All @@ -63,7 +65,6 @@ Named utilities, so pages never write their own transitions:
- `motion-reveal`: a section rising in as it scrolls into view (scroll-driven; browsers without it show it at once).
- `motion-settle`: a large picture easing out of a slight zoom as the page opens (the home header).
- `HeaderDepth` (`features/home/`): the home header's picture leans with the mouse, by a depth map of it (`scripts/header-depth.py`; rerun it when the picture changes). Dust drifts in the light shaft, and a click sends cyan traces crawling over the surfaces (`headerTraces.ts`). WebGL, running only while the header is on screen; off on touch screens and with reduced motion.
- `motion-ripple`: a ring spreading and fading from where something landed; re-key it to replay.
- `motion-pop`: a popover menu fading in with a slight drop and grow, and fading out as it closes (`Menu`).
- `CountUp`: counts up when scrolled into view, and from the old value when it changes. A number already in view when the page loads stays as it is.
- `page-fade`: between pages (see Navigation).
Expand All @@ -76,7 +77,7 @@ Pages swap in place with no full page load. The old page fades out quickly and t
Links never prefetch, whether in view or hovered (lead's choice, 2026-10-19). A page loads only once it's opened, and the fade covers the wait. `e2e/navigation.e2e.ts` checks that following a link doesn't reload the page.

## Layout shell (`web/src/features/site/`)
Header (wordmark, sections, account corner) and footer, applied in the root layout. On narrow screens the sections collapse into a menu. The account corner (sign-in button, or the player's menu) and the current-section highlight depend on the request, so each sits in `<Suspense>` and every page's shell stays static. Search lives on the Players page. Section pages arrive with their roadmap slices.
Header, page and footer sit on the sheet. The header is one sticky bar: wordmark, sections, search (`/`), Steam sign-in; footer: one line, community logos. Phones: menu, wordmark, search, account. Account and current section sit in `<Suspense>`, so every shell stays static. Search lives on the Players page. Section pages arrive with their roadmap slices.

## Screenshot tests
`npm run test:ui` (part of `just check`) screenshots `/dev/ui` wide, on a phone, with the menu open and with the dialog open, and fails on any pixel change. After an intended visual change:
Expand Down
Binary file modified web/e2e/style-guide.e2e.ts-snapshots/desktop-chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/e2e/style-guide.e2e.ts-snapshots/dialog-chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/e2e/style-guide.e2e.ts-snapshots/menu-chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/e2e/style-guide.e2e.ts-snapshots/phone-chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion web/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
cursor: pointer;
}

/* The window either side of the sheet; pages sit on the sheet (the root layout). */
body {
background: var(--color-bg);
background: var(--color-gutter);
color: var(--color-text);
font-family: var(--font-sans);
font-size: var(--text-base);
Expand Down
35 changes: 28 additions & 7 deletions web/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Root layout: fonts, global styles, the header and footer, the run dialog, and site-wide metadata.
import type { Metadata } from "next";
import Image from "next/image";
import { Play } from "next/font/google";
import { Suspense } from "react";
import art from "@/features/site/header-interloper.webp";
import { RunDialogHost } from "@/features/runs/RunDialogHost";
import { SiteFooter } from "@/features/site/SiteFooter";
import { SiteHeader } from "@/features/site/SiteHeader";
Expand All @@ -28,14 +30,33 @@ export default function RootLayout({ children }: LayoutProps<"/">) {
<html lang="en" className={`${play.variable} h-full antialiased`}>
<body className="flex min-h-full flex-col">
<NavigationProgress />
{/* The header and page fill at least the window, so the footer starts right at the fold: the page
always scrolls, and the scrollbar doesn't come and go between short and long pages. The space
above the footer is padding in here, not a margin on the footer, so it doesn't push it lower. */}
<div className="flex min-h-svh flex-col">
<SiteHeader />
<div className="flex flex-1 flex-col pb-16">{children}</div>
{/* What shows in the gutters either side of the sheet: the header's map picture, blurred and darkened
far back, fixed while the page scrolls. Blurred anyway, so a small copy of it is plenty. */}
<div
aria-hidden
className="pointer-events-none fixed inset-0 -z-10 overflow-hidden"
>
<Image
src={art}
alt=""
sizes="640px"
quality={75}
className="size-full scale-110 object-cover opacity-80 blur-lg"
/>
<div className="from-gutter/10 to-gutter/85 absolute inset-0 bg-linear-to-b" />
</div>
{/* The sheet, as the old sourcejump.net had it: one column down the middle of the window, edges lit,
holding the header, the page and the footer, the gutters either side. */}
<div className="bg-bg shadow-sheet mx-auto flex w-full max-w-6xl flex-1 flex-col">
{/* The header and page fill at least the window, so the footer starts right at the fold: the page
always scrolls, and the scrollbar doesn't come and go between short and long pages. The space
above the footer is padding in here, not a margin on the footer, so it doesn't push it lower. */}
<div className="flex min-h-svh flex-col">
<SiteHeader />
<div className="flex flex-1 flex-col pb-16">{children}</div>
</div>
<SiteFooter />
</div>
<SiteFooter />
{/* The run dialog, over whichever page opened it (`?run=` in the address). */}
<Suspense>
<RunDialogHost />
Expand Down
3 changes: 2 additions & 1 deletion web/src/app/leaderboards/[ranking]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function LeaderboardListPage({
return (
<Page className="gap-6">
{Promise.all([params, searchParams]).then(
([{ ranking }, { style, track, view }]) => {
([{ ranking }, { style, track, view, page }]) => {
if (!rankings.includes(ranking)) notFound();
return (
<LeaderboardList
Expand All @@ -41,6 +41,7 @@ export default function LeaderboardListPage({
track: typeof track === "string" ? track : undefined,
view: typeof view === "string" ? view : undefined,
}}
page={typeof page === "string" ? page : undefined}
/>
);
},
Expand Down
30 changes: 19 additions & 11 deletions web/src/app/leaderboards/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Leaderboards page: the top players by points and by completions, per style and track, and pre-2.0.
// Leaderboards page: the top players by points and by completions, per style and track, and pre-2.0, each list
// paged on its own.
import type { Metadata } from "next";
import { Leaderboards } from "@/features/leaderboards/Leaderboards";
import { Page } from "@/ui/Page";
Expand All @@ -12,17 +13,24 @@ export default function LeaderboardsPage({
searchParams,
}: PageProps<"/leaderboards">) {
return (
<Page className="gap-6">
<Page className="gap-4">
<h1 className="text-3xl font-bold">Leaderboards</h1>
{searchParams.then(({ style, track, view }) => (
<Leaderboards
params={{
style: typeof style === "string" ? style : undefined,
track: typeof track === "string" ? track : undefined,
view: typeof view === "string" ? view : undefined,
}}
/>
))}
{searchParams.then(
({ style, track, view, points_page, completed_page }) => (
<Leaderboards
params={{
style: typeof style === "string" ? style : undefined,
track: typeof track === "string" ? track : undefined,
view: typeof view === "string" ? view : undefined,
}}
pages={{
points: typeof points_page === "string" ? points_page : undefined,
completed:
typeof completed_page === "string" ? completed_page : undefined,
}}
/>
),
)}
</Page>
);
}
9 changes: 3 additions & 6 deletions web/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
// Home page: the site's header, what bunnyhopping is, how to start, and the latest records and servers.
import { BhopIntro } from "@/features/home/BhopIntro";
import { GetStarted } from "@/features/home/GetStarted";
// Home page: the site's header with the way in, then what's happening now: how busy SourceJump is, the newest
// world records beside the top players, and the servers people are playing on.
import { HomeHeader } from "@/features/home/HomeHeader";
import { LiveNow } from "@/features/home/LiveNow";
import { Page } from "@/ui/Page";

export default function HomePage() {
return (
<Page className="gap-20">
<Page className="gap-4">
<HomeHeader />
<BhopIntro />
<GetStarted />
<LiveNow />
</Page>
);
Expand Down
9 changes: 6 additions & 3 deletions web/src/app/players/[steamid]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// A player's pages: the header stays while the profile and the Manage view swap beneath it.
// A player's pages: the masthead stays while the profile and the Manage view swap beneath it.
import { PlayerHeader } from "@/features/players/PlayerHeader";
import { Page } from "@/ui/Page";

Expand All @@ -7,11 +7,14 @@ export default function PlayerLayout({
children,
}: LayoutProps<"/players/[steamid]">) {
return (
<Page className="gap-8">
// The masthead runs edge to edge, so the page sets its own width below it.
<Page width="fill">
{params.then(({ steamid }) => (
<PlayerHeader steamid={decodeURIComponent(steamid)} />
))}
{children}
<div className="mx-auto flex w-full max-w-6xl flex-col gap-8 px-4 pt-6 pb-10 sm:px-8">
{children}
</div>
</Page>
);
}
53 changes: 41 additions & 12 deletions web/src/app/players/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Players page: how many players have a recorded time over time, search by name or SteamID, and recently
// active players; for staff, a Banned tab.
// Players page, laid out as the other boards: the title with how many players have a recorded time and the search
// beside it, players found as you type or recently active in two columns, then players over time. For staff, a
// Banned tab.
import type { Metadata } from "next";
import { api } from "@/api/client";
import { DailyTotals } from "@/features/dailyTotals/DailyTotals";
import { PlayerSearch } from "@/features/players/PlayerSearch";
import { PlayersBoard } from "@/features/players/PlayerSearch";
import { CountUp } from "@/ui/CountUp";
import { Page } from "@/ui/Page";

export const metadata: Metadata = {
Expand All @@ -12,15 +15,41 @@ export const metadata: Metadata = {

export default function PlayersPage({ searchParams }: PageProps<"/players">) {
return (
<Page className="gap-6">
<h1 className="text-3xl font-bold">Players</h1>
<DailyTotals kind="players" />
{searchParams.then(({ q, view }) => (
<PlayerSearch
q={typeof q === "string" ? q : ""}
banned={view === "banned"}
/>
))}
<Page className="gap-4">
{searchParams.then(async ({ q, view }) => {
const search = typeof q === "string" ? q.trim() : "";
const total = await playerTotal();
return (
<>
<PlayersBoard
q={search}
banned={view === "banned"}
heading={
<div className="flex flex-col gap-1">
<h1 className="text-3xl font-bold">Players</h1>
{total != null && (
<p className="text-text-muted">
<span className="text-text font-bold">
<CountUp value={total} />
</span>{" "}
players have a recorded time on SourceJump.
</p>
)}
</div>
}
/>
<DailyTotals kind="players" />
</>
);
})}
</Page>
);
}

/** How many players have a recorded time; none if the totals can't be loaded. */
async function playerTotal(): Promise<number | undefined> {
const result = await api
.GET("/v1/daily-totals/players", { params: { query: { range: "month" } } })
.catch(() => undefined);
return result?.data?.points.at(-1)?.players;
}
6 changes: 2 additions & 4 deletions web/src/app/sign-in/failed/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Where sign-in lands when Steam didn't confirm it.
import type { Metadata } from "next";
import { ButtonAnchor } from "@/ui/Button";
import { Page } from "@/ui/Page";
import { SteamButton } from "@/ui/SteamButton";

export const metadata: Metadata = {
title: "Sign-in didn't complete",
Expand All @@ -16,9 +16,7 @@ export default function SignInFailedPage() {
Steam didn&apos;t confirm the sign-in, or it took too long. Nothing was
changed. Try again.
</p>
<ButtonAnchor href="/v1/auth/steam" variant="primary">
Sign in with Steam
</ButtonAnchor>
<SteamButton href="/v1/auth/steam">Sign in with Steam</SteamButton>
</Page>
);
}
Loading