From 490ff33d8544f0eed86666293c3e891d551f98f2 Mon Sep 17 00:00:00 2001 From: zasbu <136494048+zasbu@users.noreply.github.com> Date: Fri, 6 Nov 2026 13:44:10 +1100 Subject: [PATCH 1/8] Added a separator line between map name and server ip --- web/src/features/servers/ServerAddress.tsx | 2 +- web/src/features/servers/ServerRow.tsx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/features/servers/ServerAddress.tsx b/web/src/features/servers/ServerAddress.tsx index 0adc810..e41c427 100644 --- a/web/src/features/servers/ServerAddress.tsx +++ b/web/src/features/servers/ServerAddress.tsx @@ -21,7 +21,7 @@ export function ServerAddress({ address }: { address: string }) { type="button" onClick={copy} aria-label={`Copy "connect ${address}"`} - className="text-text-muted hover:text-text inline-flex items-center gap-1.5 text-sm tabular-nums transition-colors duration-(--duration-fast)" + className="text-text-muted hover:text-text inline-flex items-center gap-2.5 text-sm tabular-nums transition-colors duration-(--duration-fast)" > {address} {copied ? ( diff --git a/web/src/features/servers/ServerRow.tsx b/web/src/features/servers/ServerRow.tsx index b665638..9a990ec 100644 --- a/web/src/features/servers/ServerRow.tsx +++ b/web/src/features/servers/ServerRow.tsx @@ -58,6 +58,10 @@ export function ServerRow({ ) : ( {server.map} )} + From b1ded1ec09e23b788db3d2da130cecef6e59669f Mon Sep 17 00:00:00 2001 From: zasbu <136494048+zasbu@users.noreply.github.com> Date: Fri, 6 Nov 2026 14:26:36 +1100 Subject: [PATCH 2/8] Tidied the server rows on phones --- web/src/features/servers/ServerRow.tsx | 74 +++++++++++++++----------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/web/src/features/servers/ServerRow.tsx b/web/src/features/servers/ServerRow.tsx index 9a990ec..4155355 100644 --- a/web/src/features/servers/ServerRow.tsx +++ b/web/src/features/servers/ServerRow.tsx @@ -1,5 +1,6 @@ -// One server on the Servers page: its country's flag, map, hostname, address, players and a Join link. Staff -// rows add badges and tools, and show unlisted servers dimmed with a dashed edge. +// One server on the Servers page: its country's flag, map, hostname, address, players and a Join link, which +// phones leave out because they can't open it. Staff rows add badges and tools, and show unlisted servers dimmed +// with a dashed edge. import type { ReactNode } from "react"; import type { Schemas } from "@/api/client"; import { MapImage } from "@/features/maps/MapImage"; @@ -30,34 +31,56 @@ export function ServerRow({ "transition-opacity duration-(--duration-base)", unlisted ? "opacity-50" : !server.online && "opacity-60", ); + const status = server.online ? ( + + + + {server.players} + /{server.max_slots} + + + ) : ( + + Last seen{" "} + + + ); return ( - {/* Only a known country: Flag's placeholder speaks of Steam, which a server has nothing to do with. */} - {server.country_code && } - - {server.hostname} + + {/* Only a known country: Flag's placeholder speaks of Steam, which a server has nothing to do with. */} + {server.country_code && } + + {server.hostname} + {server.connected && ( Connected )} {badges} - - {server.map_has_page ? ( - - {server.map} - - ) : ( - {server.map} - )} + + + {server.map_has_page ? ( + + {server.map} + + ) : ( + {server.map} + )} + {status} + - - {server.online ? ( - - - - {server.players} - /{server.max_slots} - - - ) : ( - - Last seen{" "} - - - )} + + {status} {server.online && ( Date: Fri, 6 Nov 2026 14:37:12 +1100 Subject: [PATCH 3/8] Copy only the server address, and centre the copy icon --- web/src/features/servers/ServerAddress.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/web/src/features/servers/ServerAddress.tsx b/web/src/features/servers/ServerAddress.tsx index e41c427..3af5a43 100644 --- a/web/src/features/servers/ServerAddress.tsx +++ b/web/src/features/servers/ServerAddress.tsx @@ -8,7 +8,7 @@ export function ServerAddress({ address }: { address: string }) { async function copy() { try { - await navigator.clipboard.writeText(`connect ${address}`); + await navigator.clipboard.writeText(address); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch { @@ -20,14 +20,17 @@ export function ServerAddress({ address }: { address: string }) { ); From fef1a5498ab0568285d51b1e83c5618d0c8a7552 Mon Sep 17 00:00:00 2001 From: zasbu <136494048+zasbu@users.noreply.github.com> Date: Fri, 6 Nov 2026 14:49:10 +1100 Subject: [PATCH 4/8] Changed connected badge to a simple checkmark to reduce space used, moved player count to bottom right on mobile --- web/src/features/servers/ServerRow.tsx | 37 ++++++++++++++++++-------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/web/src/features/servers/ServerRow.tsx b/web/src/features/servers/ServerRow.tsx index 4155355..1b89d4a 100644 --- a/web/src/features/servers/ServerRow.tsx +++ b/web/src/features/servers/ServerRow.tsx @@ -1,6 +1,7 @@ // One server on the Servers page: its country's flag, map, hostname, address, players and a Join link, which // phones leave out because they can't open it. Staff rows add badges and tools, and show unlisted servers dimmed // with a dashed edge. +import { Check } from "lucide-react"; import type { ReactNode } from "react"; import type { Schemas } from "@/api/client"; import { MapImage } from "@/features/maps/MapImage"; @@ -58,6 +59,17 @@ export function ServerRow({ {server.hostname} + {/* Phones have no room for the word, so the badge shrinks to a tick beside the name. */} + {server.connected && ( + + + Connected + + )} {server.connected && ( - - {server.map_has_page ? ( - - {server.map} - - ) : ( - {server.map} - )} - {status} - + {server.map_has_page ? ( + + {server.map} + + ) : ( + {server.map} + )} - + {/* A long "Last seen" doesn't fit beside the address on a phone, so it wraps to the row's bottom right. */} + + + + {status} + + {/* With staff tools there's no room beside the name on a phone, so they take a line of their own. */} From c7028986f0ace2f073be2abc1e4e744263d06397 Mon Sep 17 00:00:00 2001 From: zasbu <136494048+zasbu@users.noreply.github.com> Date: Fri, 6 Nov 2026 16:55:25 +1100 Subject: [PATCH 5/8] Slightly modified how the servers appear, and made the players graph a bit more compact to reduce vertical space wasted --- docs/design-system.md | 2 +- web/src/features/servers/ServerActivity.tsx | 86 +++--- web/src/features/servers/ServerRow.tsx | 249 +++++++++++++----- web/src/features/servers/ServerRows.tsx | 58 ++-- .../features/staff/servers/StaffServerRow.tsx | 2 +- web/src/ui/LineChart.tsx | 8 +- 6 files changed, 282 insertions(+), 123 deletions(-) diff --git a/docs/design-system.md b/docs/design-system.md index ad898a2..bb1cf49 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -39,7 +39,7 @@ One visual language that every page is built from, so pages can't drift apart. S | `Pager` | Previous and next under a paged list | | `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 | +| `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. `size="sm"` is shorter | | `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) | diff --git a/web/src/features/servers/ServerActivity.tsx b/web/src/features/servers/ServerActivity.tsx index b642b5a..d8d37ae 100644 --- a/web/src/features/servers/ServerActivity.tsx +++ b/web/src/features/servers/ServerActivity.tsx @@ -2,9 +2,9 @@ // Players online across listed servers over the last day, week, month or year. Hovering, tapping or arrow // keys read a point: players and servers at that time. Every range arrives with the page, so switching is // instant. -import { useState } from "react"; +import { type ReactNode, useState } from "react"; import type { Schemas } from "@/api/client"; -import { Card, Label } from "@/ui/Card"; +import { Card } from "@/ui/Card"; import { LineChart } from "@/ui/LineChart"; import { Segmented } from "@/ui/Segmented"; @@ -17,6 +17,13 @@ const ranges: { value: Range; label: string }[] = [ { value: "year", label: "1 year" }, ]; +const peakLabels: Record = { + day: "24-hour peak", + week: "7-day peak", + month: "1-month peak", + year: "1-year peak", +}; + // UTC, like every date on the site, so the server and the visitor render the same text. const time = new Intl.DateTimeFormat("en", { hour: "2-digit", @@ -43,15 +50,46 @@ export function ServerActivity({ const [active, setActive] = useState(null); const current = activity[range]; const points = current?.points ?? []; - const shown = points[active ?? points.length - 1]; - if (!current || !shown || points.length < 2) return null; - // A day's buckets are short enough to read as "now"; longer ones are averages over hours or days. - const averaged = range !== "day"; + // "Now" is the day's latest bucket whichever range is shown: the longer ranges' buckets are averages. + const now = activity.day?.points.at(-1) ?? points.at(-1); + const hovered = active === null ? undefined : points[active]; + if (!current || !now || points.length < 2) return null; + const peak = Math.max(...points.map((point) => point.players)); return ( - +
- + {/* While the chart is hovered, its point replaces the line; the chart has no tooltip of its own. */} +

+ {hovered ? ( + <> + + {hovered.players === 1 ? "player" : "players"} + {range !== "day" && " on average"} + + + {hovered.servers === 1 ? "server" : "servers"} + + + {when(hovered.at, current.bucket_minutes)} + + + ) : ( + <> + online now + + {now.servers === 1 ? "server" : "servers"} + + + {peakLabels[range]}{" "} + {peak} + + + )} +

-

- - - {shown.players} - {" "} - - {shown.players === 1 ? "player" : "players"} - {averaged && " on average"} - - - - on {shown.servers === 1 ? "1 server" : `${shown.servers} servers`} - - - {active === null ? "Latest: " : ""} - {when(shown.at, current.bucket_minutes)} - -

-
r.value === range)?.label}. Use the arrow keys to read each point.`} points={points.map((p) => ({ x: Date.parse(p.at), y: p.players }))} active={active} @@ -103,6 +120,15 @@ export function ServerActivity({ ); } +/** A number in the line over the chart, with what it counts after it. */ +function Stat({ value, children }: { value: number; children: ReactNode }) { + return ( + + {value} {children} + + ); +} + /** The bucket a point covers: a time span within a day, or the whole day. */ function when(at: string, minutes: number): string { const start = new Date(at); diff --git a/web/src/features/servers/ServerRow.tsx b/web/src/features/servers/ServerRow.tsx index 1b89d4a..4d96788 100644 --- a/web/src/features/servers/ServerRow.tsx +++ b/web/src/features/servers/ServerRow.tsx @@ -1,10 +1,10 @@ -// One server on the Servers page: its country's flag, map, hostname, address, players and a Join link, which -// phones leave out because they can't open it. Staff rows add badges and tools, and show unlisted servers dimmed -// with a dashed edge. -import { Check } from "lucide-react"; +// One server on the Servers page: a picture of its map, its country's flag, hostname, address, players and a +// Join link, which phones leave out because they can't open it. On phones it's a card under a banner of the map, +// with the map's name and the players on it; wider, a compact row with the map as a thumbnail. Staff rows add +// badges and tools, and show unlisted servers dimmed with a dashed edge. +import { Check, ImageOff } from "lucide-react"; import type { ReactNode } from "react"; import type { Schemas } from "@/api/client"; -import { MapImage } from "@/features/maps/MapImage"; import { formatAgo } from "@/features/runs/time"; import { Badge } from "@/ui/Badge"; import { buttonClasses } from "@/ui/Button"; @@ -13,57 +13,75 @@ import { Flag } from "@/ui/Flag"; import { Link } from "@/ui/Link"; import { ServerAddress } from "./ServerAddress"; +type Server = Schemas["ListedServer"]; + export function ServerRow({ server, unlisted = false, badges, tools, + eager = false, }: { - server: Schemas["ListedServer"]; + server: Server; /** Shown to staff only: the public list never has unlisted servers. */ unlisted?: boolean; badges?: ReactNode; /** Staff controls after Join, kept at full strength when the row is dimmed. */ tools?: ReactNode; + /** Load the map's picture at once rather than when scrolled near: for the first rows, on screen from the start. */ + eager?: boolean; }) { const address = `${server.ip}:${server.port}`; - // Each part is dimmed on its own, not inside one wrapper, so the row still wraps as one flex line on phones. + // Each part is dimmed on its own, not inside one wrapper, so the staff tools stay at full strength. const dim = classNames( "transition-opacity duration-(--duration-base)", unlisted ? "opacity-50" : !server.online && "opacity-60", ); - const status = server.online ? ( - - - - {server.players} - /{server.max_slots} - - - ) : ( - - Last seen{" "} - - - ); + const connected = "Runs on this server count on SourceJump"; return ( - - - - - + + + + {/* On phones the map's name and the players sit on the picture; wider, they have columns of their own. */} + + + + + + + + + + + + + {/* Badges that don't fit beside the name wrap under it rather than squeezing it. */} + + {/* Only a known country: Flag's placeholder speaks of Steam, which a server has nothing to do with. */} {server.country_code && } - + {server.hostname} - {/* Phones have no room for the word, so the badge shrinks to a tick beside the name. */} {server.connected && ( + // Phones have no room for the word, so the badge shrinks to a tick. @@ -74,74 +92,163 @@ export function ServerRow({ {server.connected && ( Connected )} {badges} - - {server.map_has_page ? ( - - {server.map} - - ) : ( - {server.map} - )} - - {/* A long "Last seen" doesn't fit beside the address on a phone, so it wraps to the row's bottom right. */} - - - - {status} - - + + + + + - {/* With staff tools there's no room beside the name on a phone, so they take a line of their own. */} - - {status} - {server.online && ( - - Join - - )} - - {tools && {tools}} + + {server.online && ( + + Join + + )} + {tools && ( + + {tools} + + )} ); } -/** The row's box, shared with the staff-only row of a server listed before it was ever heard from. */ +/** + * The map's cover. Always the small file, the banner on a phone too: the large one is about ten times the bytes, + * a lot for a list, and the map's own page shows it. + */ +function MapPicture({ + image, + eager, +}: { + image: Server["map_image"]; + eager: boolean; +}) { + if (!image) { + return ( + + + + ); + } + return ( + // The API stores each picture at the sizes it's shown at, so there's nothing for Next's resizer to do. + // eslint-disable-next-line @next/next/no-img-element + + ); +} + +/** A label over the map's picture, see-through and blurring what's behind it so it reads on any picture. */ +function OnPicture({ children }: { children: ReactNode }) { + return ( + + {children} + + ); +} + +function MapName({ server }: { server: Server }) { + return server.map_has_page ? ( + + {server.map} + + ) : ( + {server.map} + ); +} + +/** + * Players out of slots while online, else when it was last heard from. `stacked` is the wider row's column, + * where "Last seen" takes two short lines. + */ +function Players({ + server, + stacked = false, +}: { + server: Server; + stacked?: boolean; +}) { + if (!server.online) { + return ( + + Last seen{" "} + + + ); + } + return ( + + + + + {server.players} + + /{server.max_slots} + {/* Left out on a narrow card, where it would cut the map's name short. */} + {!stacked && ( + playing + )} + + + ); +} + +/** + * The row's box, shared with the staff-only row of a server listed before it was ever heard from; `className` + * lays out what's inside. + */ export function ServerRowFrame({ unlisted = false, + className, children, }: { unlisted?: boolean; + className?: string; children: ReactNode; }) { return (
{children} diff --git a/web/src/features/servers/ServerRows.tsx b/web/src/features/servers/ServerRows.tsx index cd45fbc..f2e5b56 100644 --- a/web/src/features/servers/ServerRows.tsx +++ b/web/src/features/servers/ServerRows.tsx @@ -9,6 +9,7 @@ import { StaffServerRow } from "@/features/staff/servers/StaffServerRow"; import { useStaffServers } from "@/features/staff/servers/useStaffServers"; import { Card } from "@/ui/Card"; import { ChoiceBar } from "@/ui/ChoiceBar"; +import { classNames } from "@/ui/classNames"; import { LinkTabs } from "@/ui/LinkTabs"; import { ServerRow } from "./ServerRow"; @@ -38,6 +39,7 @@ export function ServerRows({ ({ address: server.address, row: , @@ -58,9 +60,9 @@ export function ServerRows({ server.whitelist)} - rows={shown.map((server) => ({ + rows={shown.map((server, index) => ({ address: `${server.ip}:${server.port}`, - row: , + row: , }))} /> ); @@ -73,10 +75,13 @@ export function ServerRows({ function View({ whitelist, hasWhitelist, + pairs = true, rows, }: { whitelist: boolean; hasWhitelist: boolean; + /** Two rows side by side where they fit; staff rows, with their badges and tools, need the whole width. */ + pairs?: boolean; rows: { address: string; row: ReactNode }[]; }) { return ( @@ -98,7 +103,7 @@ function View({ )} {rows.length > 0 ? ( - + ) : ( {whitelist @@ -111,22 +116,37 @@ function View({ } /** Keyed by address, so a row the public list already showed stays put when the staff list replaces it. */ -function Rows({ rows }: { rows: { address: string; row: ReactNode }[] }) { +function Rows({ + rows, + pairs, +}: { + rows: { address: string; row: ReactNode }[]; + pairs: boolean; +}) { return ( -
    - {rows.map(({ address, row }, index) => ( -
  • - {row} -
  • - ))} -
+
+
    + {rows.map(({ address, row }, index) => ( +
  • + {row} +
  • + ))} +
+
); } diff --git a/web/src/features/staff/servers/StaffServerRow.tsx b/web/src/features/staff/servers/StaffServerRow.tsx index 86a582d..3a1f964 100644 --- a/web/src/features/staff/servers/StaffServerRow.tsx +++ b/web/src/features/staff/servers/StaffServerRow.tsx @@ -26,7 +26,7 @@ export function StaffServerRow({ if (!server.server || !server.report) { return ( - + {server.address} diff --git a/web/src/ui/LineChart.tsx b/web/src/ui/LineChart.tsx index 9c5fd94..e633684 100644 --- a/web/src/ui/LineChart.tsx +++ b/web/src/ui/LineChart.tsx @@ -3,6 +3,7 @@ // scale, e.g. world records among runs. Hovering, tapping or arrow keys pick a point and report it through // `onActive`; the parent shows the values, so no tooltip covers the line. import { type KeyboardEvent, type PointerEvent } from "react"; +import { classNames } from "./classNames"; export interface LinePoint { /** Milliseconds since the epoch. */ @@ -25,6 +26,7 @@ export function LineChart({ onActive, formatValue, label, + size = "md", }: { /** Oldest first, evenly spaced. */ points: LinePoint[]; @@ -33,6 +35,8 @@ export function LineChart({ formatValue: (value: number) => string; /** Read out for the chart, since it's a picture. */ label: string; + /** `sm` is a shorter chart, for beside a summary rather than under it. */ + size?: "sm" | "md"; }) { if (points.length < 2) return null; const top = niceMax(Math.max(...points.map((point) => point.y))); @@ -76,7 +80,9 @@ export function LineChart({ // Vertical padding leaves room for the top and bottom value labels, which center on their gridlines. return ( -
+
Date: Fri, 6 Nov 2026 18:00:44 +1100 Subject: [PATCH 6/8] Slightly modified how the servers appear, and made the players graph a bit more compact to reduce vertical space wasted --- docs/design-system.md | 6 +- web/src/features/servers/ServerActivity.tsx | 64 ++++++++++++++------- web/src/features/servers/ServerRow.tsx | 52 ++++++++++++----- web/src/ui/Button.tsx | 11 +++- web/src/ui/LineChart.tsx | 20 ++++++- web/src/ui/Segmented.tsx | 5 ++ 6 files changed, 117 insertions(+), 41 deletions(-) diff --git a/docs/design-system.md b/docs/design-system.md index bb1cf49..2bdbec7 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -22,7 +22,7 @@ One visual language that every page is built from, so pages can't drift apart. S |---|---| | `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 | | `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 | +| `Button`, `ButtonLink`, `ButtonAnchor` | `primary` (one per view), `secondary` (default), `soft` (a list's repeated action), `ghost`; sizes `xs` (rows), `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 | | `StatCard` | Headline number with label and icon, counting up, and an optional short detail beside the number (never under it, so cards in a row stay one height). `null` shows a dash | | `Badge` | Short status: `neutral`, `accent` (WR), `success`, `warning`, `danger` | @@ -33,13 +33,13 @@ One visual language that every page is built from, so pages can't drift apart. S | `Table` + `TableHead`/`TableBody`/`TableRow`/`TableHeaderCell`/`TableCell` | Leaderboards and staff lists; `numeric` cells right-align, `wrap` cells let long names wrap. Scrolls sideways inside its frame when too wide | | `Tabs` | Panels on one page; `underline` or `segmented` | | `LinkTabs` | Looks like `Tabs`, but each tab is a link: a view the server renders, such as the Maps page's sort | -| `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 | +| `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; `fillOnPhones` spans phones | | `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 | | `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. `size="sm"` is shorter | +| `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. `size="sm"`: shorter; phones get the top value only | | `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) | diff --git a/web/src/features/servers/ServerActivity.tsx b/web/src/features/servers/ServerActivity.tsx index d8d37ae..c4a71fc 100644 --- a/web/src/features/servers/ServerActivity.tsx +++ b/web/src/features/servers/ServerActivity.tsx @@ -5,6 +5,7 @@ import { type ReactNode, useState } from "react"; import type { Schemas } from "@/api/client"; import { Card } from "@/ui/Card"; +import { classNames } from "@/ui/classNames"; import { LineChart } from "@/ui/LineChart"; import { Segmented } from "@/ui/Segmented"; @@ -17,13 +18,6 @@ const ranges: { value: Range; label: string }[] = [ { value: "year", label: "1 year" }, ]; -const peakLabels: Record = { - day: "24-hour peak", - week: "7-day peak", - month: "1-month peak", - year: "1-year peak", -}; - // UTC, like every date on the site, so the server and the visitor render the same text. const time = new Intl.DateTimeFormat("en", { hour: "2-digit", @@ -58,40 +52,49 @@ export function ServerActivity({ return ( -
+
{/* While the chart is hovered, its point replaces the line; the chart has no tooltip of its own. */}

+ {/* One size throughout, like a sentence: bold numbers, quiet words, dots between. */} {hovered ? ( <> {hovered.players === 1 ? "player" : "players"} {range !== "day" && " on average"} + {hovered.servers === 1 ? "server" : "servers"} + {when(hovered.at, current.bucket_minutes)} ) : ( <> - online now + {/* Coloured like a server's player count: green with anyone on, red when nobody is. */} + 0 ? "text-success" : "text-danger"} + > + online now + + {now.servers === 1 ? "server" : "servers"} - - {peakLabels[range]}{" "} - {peak} - + + peak in {rangeLabel(range)} )}

{ @@ -104,14 +107,14 @@ export function ServerActivity({
r.value === range)?.label}. Use the arrow keys to read each point.`} + label={`Players online over the last ${rangeLabel(range)}. Use the arrow keys to read each point.`} points={points.map((p) => ({ x: Date.parse(p.at), y: p.players }))} active={active} onActive={setActive} formatValue={(value) => String(Math.round(value))} /> - {/* Indented by the value labels' width, so the dates sit under the plot's ends. */} -
+ {/* Indented by the value labels' width, so the dates sit under the plot's ends; a phone has the labels inside. */} +
{edge(points[0]?.at, range)} {edge(points.at(-1)?.at, range)}
@@ -120,15 +123,36 @@ export function ServerActivity({ ); } -/** A number in the line over the chart, with what it counts after it. */ -function Stat({ value, children }: { value: number; children: ReactNode }) { +/** A figure in the line over the chart: the number, then what it counts. */ +function Stat({ + value, + tone = "text-text", + children, +}: { + value: number; + /** The number's color class. */ + tone?: string; + children: ReactNode; +}) { return ( - {value} {children} + {value} {children} + + ); +} + +function Dot() { + return ( + + · ); } +function rangeLabel(range: Range): string { + return ranges.find((r) => r.value === range)?.label ?? ""; +} + /** The bucket a point covers: a time span within a day, or the whole day. */ function when(at: string, minutes: number): string { const start = new Date(at); diff --git a/web/src/features/servers/ServerRow.tsx b/web/src/features/servers/ServerRow.tsx index 4d96788..b87476c 100644 --- a/web/src/features/servers/ServerRow.tsx +++ b/web/src/features/servers/ServerRow.tsx @@ -28,7 +28,7 @@ export function ServerRow({ badges?: ReactNode; /** Staff controls after Join, kept at full strength when the row is dimmed. */ tools?: ReactNode; - /** Load the map's picture at once rather than when scrolled near: for the first rows, on screen from the start. */ + /** Load the map's picture at once and first, not when scrolled near: for the rows on screen from the start. */ eager?: boolean; }) { const address = `${server.ip}:${server.port}`; @@ -41,12 +41,22 @@ export function ServerRow({ return ( + {/* Whether the server is up, down the box's left edge: green while it reports in, red once it has gone + quiet. Left at full strength when the rest of a row is dimmed, since it's the row's status. */} + + {server.online ? "Online" : "Offline"} + @@ -109,7 +119,9 @@ export function ServerRow({ @@ -117,7 +129,11 @@ export function ServerRow({ {server.online && ( Join @@ -160,6 +176,9 @@ function MapPicture({ src={image.thumbnail_url} alt="" loading={eager ? "eager" : "lazy"} + // The first rows' pictures are on screen at once, the biggest thing there on a phone: fetch them ahead of + // anything that can wait. + fetchPriority={eager ? "high" : "auto"} className="absolute inset-0 size-full object-cover" /> ); @@ -168,7 +187,7 @@ function MapPicture({ /** A label over the map's picture, see-through and blurring what's behind it so it reads on any picture. */ function OnPicture({ children }: { children: ReactNode }) { return ( - + {children} ); @@ -203,7 +222,7 @@ function Players({ Last seen{" "} @@ -214,13 +233,20 @@ function Players({ ); } return ( - - + - - {server.players} + {/* All bold, so the players and the slots share one height and baseline; only the players are coloured, + green with someone on, red when it's empty. A hair of space either side of the slash keeps a wide 0 + from crowding it the way a narrow 1 doesn't. */} + + 0 ? "text-success" : "text-danger"}> + {server.players} + + + / + {server.max_slots} + - /{server.max_slots} {/* Left out on a narrow card, where it would cut the map's name short. */} {!stacked && ( playing @@ -246,7 +272,7 @@ export function ServerRowFrame({ return (
= { primary: "bg-accent text-on-accent hover:bg-accent-hover", secondary: "border border-border bg-surface text-text hover:border-border-strong hover:bg-surface-raised", + // A light accent tint, for a small action repeated down a list (a server's Join), where a row of primary + // buttons would shout and secondary ones would read heavy. + soft: "border border-accent/30 bg-accent-soft text-accent hover:border-accent/60 hover:bg-accent/20", // A ghost button that toggles something (a viewer's freecam, a settings popover) shows the accent while on. ghost: "text-text-muted hover:bg-surface-raised hover:text-text aria-expanded:text-accent aria-pressed:bg-accent-soft aria-pressed:text-accent", }; const sizes: Record = { + // For an action repeated on every row of a list, such as a server's Join. + xs: "h-6 gap-1 px-2.5 text-xs", sm: "h-8 gap-1.5 px-3 text-sm", md: "h-10 gap-2 px-4 text-sm", }; diff --git a/web/src/ui/LineChart.tsx b/web/src/ui/LineChart.tsx index e633684..85be3e2 100644 --- a/web/src/ui/LineChart.tsx +++ b/web/src/ui/LineChart.tsx @@ -35,7 +35,10 @@ export function LineChart({ formatValue: (value: number) => string; /** Read out for the chart, since it's a picture. */ label: string; - /** `sm` is a shorter chart, for beside a summary rather than under it. */ + /** + * `sm` is a shorter chart, for beside a summary rather than under it. On a phone it drops the column of value + * labels for the top value alone, above its gridline, so the line gets the card's whole width. + */ size?: "sm" | "md"; }) { if (points.length < 2) return null; @@ -85,7 +88,10 @@ export function LineChart({ >
{ticks.map((tick) => ( onActive(null)} onKeyDown={onKeyDown} > + {size === "sm" && ( + // Only the top value: it sits above the top gridline, where the line never reaches, so it gives the + // scale without running into the line the way the lower ones would. + + {formatValue(top)} + + )} void; /** Names the group for screen readers. */ label: string; + /** On a phone, spans its container with the options sharing the width, to line up with what's under it. */ + fillOnPhones?: boolean; className?: string; }) { const styles = tabStyles.segmented; @@ -31,6 +34,7 @@ export function Segmented({ className={classNames( styles.list, "max-w-full [scrollbar-width:none] overflow-x-auto", + fillOnPhones && "max-sm:flex max-sm:w-full", className, )} > @@ -42,6 +46,7 @@ export function Segmented({ onClick={() => onChange(option.value)} className={classNames( "shrink-0 whitespace-nowrap transition-colors duration-(--duration-fast)", + fillOnPhones && "max-sm:flex-1", styles.tab, option.value === value ? styles.active : styles.idle, )} From 6e679550ee39524eb68a36ca8c0eec17a2e246f7 Mon Sep 17 00:00:00 2001 From: zasbu <136494048+zasbu@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:43:31 +1100 Subject: [PATCH 7/8] Slightly modified how the servers appear, and made the players graph a bit more compact to reduce vertical space wasted --- web/src/features/servers/ServerActivity.tsx | 9 ++--- web/src/features/servers/ServerRow.tsx | 38 +++------------------ web/src/features/servers/ServerRows.tsx | 4 +-- web/src/ui/Button.tsx | 6 ++-- web/src/ui/LineChart.tsx | 7 +--- web/src/ui/Segmented.tsx | 2 +- 6 files changed, 12 insertions(+), 54 deletions(-) diff --git a/web/src/features/servers/ServerActivity.tsx b/web/src/features/servers/ServerActivity.tsx index c4a71fc..61b2468 100644 --- a/web/src/features/servers/ServerActivity.tsx +++ b/web/src/features/servers/ServerActivity.tsx @@ -44,7 +44,7 @@ export function ServerActivity({ const [active, setActive] = useState(null); const current = activity[range]; const points = current?.points ?? []; - // "Now" is the day's latest bucket whichever range is shown: the longer ranges' buckets are averages. + // The longer ranges' buckets are averages, so "now" always comes from the day's. const now = activity.day?.points.at(-1) ?? points.at(-1); const hovered = active === null ? undefined : points[active]; if (!current || !now || points.length < 2) return null; @@ -53,12 +53,10 @@ export function ServerActivity({ return (
- {/* While the chart is hovered, its point replaces the line; the chart has no tooltip of its own. */}

- {/* One size throughout, like a sentence: bold numbers, quiet words, dots between. */} {hovered ? ( <> @@ -76,7 +74,6 @@ export function ServerActivity({ ) : ( <> - {/* Coloured like a server's player count: green with anyone on, red when nobody is. */} 0 ? "text-success" : "text-danger"} @@ -113,7 +110,7 @@ export function ServerActivity({ onActive={setActive} formatValue={(value) => String(Math.round(value))} /> - {/* Indented by the value labels' width, so the dates sit under the plot's ends; a phone has the labels inside. */} + {/* Indented by the value labels' width, so the dates sit under the plot's ends. */}

{edge(points[0]?.at, range)} {edge(points.at(-1)?.at, range)} @@ -123,14 +120,12 @@ export function ServerActivity({ ); } -/** A figure in the line over the chart: the number, then what it counts. */ function Stat({ value, tone = "text-text", children, }: { value: number; - /** The number's color class. */ tone?: string; children: ReactNode; }) { diff --git a/web/src/features/servers/ServerRow.tsx b/web/src/features/servers/ServerRow.tsx index b87476c..390f762 100644 --- a/web/src/features/servers/ServerRow.tsx +++ b/web/src/features/servers/ServerRow.tsx @@ -1,7 +1,4 @@ -// One server on the Servers page: a picture of its map, its country's flag, hostname, address, players and a -// Join link, which phones leave out because they can't open it. On phones it's a card under a banner of the map, -// with the map's name and the players on it; wider, a compact row with the map as a thumbnail. Staff rows add -// badges and tools, and show unlisted servers dimmed with a dashed edge. +// One server on the Servers page: a card on phones, a compact row wider. Staff rows add badges and tools. import { Check, ImageOff } from "lucide-react"; import type { ReactNode } from "react"; import type { Schemas } from "@/api/client"; @@ -28,7 +25,7 @@ export function ServerRow({ badges?: ReactNode; /** Staff controls after Join, kept at full strength when the row is dimmed. */ tools?: ReactNode; - /** Load the map's picture at once and first, not when scrolled near: for the rows on screen from the start. */ + /** For the first rows, on screen from the start. */ eager?: boolean; }) { const address = `${server.ip}:${server.port}`; @@ -43,8 +40,6 @@ export function ServerRow({ unlisted={unlisted} className="relative flex flex-col sm:h-full sm:flex-row sm:items-center sm:gap-3 sm:p-3" > - {/* Whether the server is up, down the box's left edge: green while it reports in, red once it has gone - quiet. Left at full strength when the rest of a row is dimmed, since it's the row's status. */} - {/* On phones the map's name and the players sit on the picture; wider, they have columns of their own. */} @@ -79,7 +73,6 @@ export function ServerRow({ dim, )} > - {/* Badges that don't fit beside the name wrap under it rather than squeezing it. */} {/* Only a known country: Flag's placeholder speaks of Steam, which a server has nothing to do with. */} @@ -88,7 +81,6 @@ export function ServerRow({ {server.hostname} {server.connected && ( - // Phones have no room for the word, so the badge shrinks to a tick. @@ -148,10 +137,7 @@ export function ServerRow({ ); } -/** - * The map's cover. Always the small file, the banner on a phone too: the large one is about ten times the bytes, - * a lot for a list, and the map's own page shows it. - */ +// Always the small file, even for a phone's banner: the large one is about ten times the size. function MapPicture({ image, eager, @@ -170,21 +156,17 @@ function MapPicture({ ); } return ( - // The API stores each picture at the sizes it's shown at, so there's nothing for Next's resizer to do. // eslint-disable-next-line @next/next/no-img-element ); } -/** A label over the map's picture, see-through and blurring what's behind it so it reads on any picture. */ function OnPicture({ children }: { children: ReactNode }) { return ( @@ -206,10 +188,7 @@ function MapName({ server }: { server: Server }) { ); } -/** - * Players out of slots while online, else when it was last heard from. `stacked` is the wider row's column, - * where "Last seen" takes two short lines. - */ +/** `stacked` is the wider row's column. */ function Players({ server, stacked = false, @@ -235,9 +214,6 @@ function Players({ return ( - {/* All bold, so the players and the slots share one height and baseline; only the players are coloured, - green with someone on, red when it's empty. A hair of space either side of the slash keeps a wide 0 - from crowding it the way a narrow 1 doesn't. */} 0 ? "text-success" : "text-danger"}> {server.players} @@ -247,7 +223,6 @@ function Players({ {server.max_slots} - {/* Left out on a narrow card, where it would cut the map's name short. */} {!stacked && ( playing )} @@ -256,10 +231,7 @@ function Players({ ); } -/** - * The row's box, shared with the staff-only row of a server listed before it was ever heard from; `className` - * lays out what's inside. - */ +/** The row's box, shared with the staff-only row of a server listed before it was ever heard from. */ export function ServerRowFrame({ unlisted = false, className, diff --git a/web/src/features/servers/ServerRows.tsx b/web/src/features/servers/ServerRows.tsx index f2e5b56..bf7ca1c 100644 --- a/web/src/features/servers/ServerRows.tsx +++ b/web/src/features/servers/ServerRows.tsx @@ -80,7 +80,7 @@ function View({ }: { whitelist: boolean; hasWhitelist: boolean; - /** Two rows side by side where they fit; staff rows, with their badges and tools, need the whole width. */ + /** Staff rows need the whole width for their tools. */ pairs?: boolean; rows: { address: string; row: ReactNode }[]; }) { @@ -128,8 +128,6 @@ function Rows({
    diff --git a/web/src/ui/Button.tsx b/web/src/ui/Button.tsx index b2b5038..ac6ae20 100644 --- a/web/src/ui/Button.tsx +++ b/web/src/ui/Button.tsx @@ -1,4 +1,4 @@ -// Buttons and button-styled links. One primary action per view; everything else is secondary, soft or ghost. +// Buttons and button-styled links. One primary action per view; everything else is secondary or ghost. import { Link } from "./Link"; import type { ComponentProps } from "react"; import { classNames } from "./classNames"; @@ -15,8 +15,7 @@ const variants: Record = { primary: "bg-accent text-on-accent hover:bg-accent-hover", secondary: "border border-border bg-surface text-text hover:border-border-strong hover:bg-surface-raised", - // A light accent tint, for a small action repeated down a list (a server's Join), where a row of primary - // buttons would shout and secondary ones would read heavy. + // For an action repeated down a list, such as a server's Join. soft: "border border-accent/30 bg-accent-soft text-accent hover:border-accent/60 hover:bg-accent/20", // A ghost button that toggles something (a viewer's freecam, a settings popover) shows the accent while on. ghost: @@ -24,7 +23,6 @@ const variants: Record = { }; const sizes: Record = { - // For an action repeated on every row of a list, such as a server's Join. xs: "h-6 gap-1 px-2.5 text-xs", sm: "h-8 gap-1.5 px-3 text-sm", md: "h-10 gap-2 px-4 text-sm", diff --git a/web/src/ui/LineChart.tsx b/web/src/ui/LineChart.tsx index 85be3e2..d21dc6b 100644 --- a/web/src/ui/LineChart.tsx +++ b/web/src/ui/LineChart.tsx @@ -35,10 +35,7 @@ export function LineChart({ formatValue: (value: number) => string; /** Read out for the chart, since it's a picture. */ label: string; - /** - * `sm` is a shorter chart, for beside a summary rather than under it. On a phone it drops the column of value - * labels for the top value alone, above its gridline, so the line gets the card's whole width. - */ + /** `sm` is shorter, and on a phone shows only the top value so the line spans the card. */ size?: "sm" | "md"; }) { if (points.length < 2) return null; @@ -116,8 +113,6 @@ export function LineChart({ onKeyDown={onKeyDown} > {size === "sm" && ( - // Only the top value: it sits above the top gridline, where the line never reaches, so it gives the - // scale without running into the line the way the lower ones would. void; /** Names the group for screen readers. */ label: string; - /** On a phone, spans its container with the options sharing the width, to line up with what's under it. */ + /** On a phone, spans its container with the options sharing the width. */ fillOnPhones?: boolean; className?: string; }) { From c2e4db02071a57c6eac20ae7c9116b000ea21549 Mon Sep 17 00:00:00 2001 From: zasbu <136494048+zasbu@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:52:43 +1100 Subject: [PATCH 8/8] Slightly modified how the servers appear, and made the players graph a bit more compact to reduce vertical space wasted --- docs/design-system.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/design-system.md b/docs/design-system.md index 2bdbec7..ad898a2 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -22,7 +22,7 @@ One visual language that every page is built from, so pages can't drift apart. S |---|---| | `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 | | `Link` | Every internal link; never prefetches. Lint blocks importing `next/link` elsewhere | -| `Button`, `ButtonLink`, `ButtonAnchor` | `primary` (one per view), `secondary` (default), `soft` (a list's repeated action), `ghost`; sizes `xs` (rows), `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 | +| `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 | | `StatCard` | Headline number with label and icon, counting up, and an optional short detail beside the number (never under it, so cards in a row stay one height). `null` shows a dash | | `Badge` | Short status: `neutral`, `accent` (WR), `success`, `warning`, `danger` | @@ -33,13 +33,13 @@ One visual language that every page is built from, so pages can't drift apart. S | `Table` + `TableHead`/`TableBody`/`TableRow`/`TableHeaderCell`/`TableCell` | Leaderboards and staff lists; `numeric` cells right-align, `wrap` cells let long names wrap. Scrolls sideways inside its frame when too wide | | `Tabs` | Panels on one page; `underline` or `segmented` | | `LinkTabs` | Looks like `Tabs`, but each tab is a link: a view the server renders, such as the Maps page's sort | -| `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; `fillOnPhones` spans phones | +| `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 | | `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. `size="sm"`: shorter; phones get the top value only | +| `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) |