Website: the hub (/hub) with the roadmap, a Simple / Technical switch and live states
playhorizon.dev/hub is the public entry point to what is happening on Horizon. Overview: where Horizon is, the 3 to 5 things in focus, what is next, what shipped last, how to help. Roadmap: Now / Next / Later / Help wanted / Shipped, filtered by area, every item with its issues and pull requests in their GitHub state (baked at build, refreshed in the browser). Contribute: good first tasks, claiming, connecting an agent to Kira, the rules. A Simple / Technical switch swaps every item's plain and dev text and is remembered. /roadmap redirects to the Roadmap tab. tools/roadmap.py build now also writes website/data/roadmap.json, which the site reads and serves at /hub/roadmap.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
// The hub page (/hub): its tabs (one per #hash, so /hub#roadmap and /hub#item-<id> can be linked), the
|
||||
// Simple / Technical switch (remembered in localStorage), the area filter, and the live state of every
|
||||
// linked issue and pull request, refreshed from GitHub's public API. Without JavaScript, every tab reads
|
||||
// one after the other with what was baked at build time.
|
||||
import { cached, get, setUpMenu, setUpTheme } from "./chrome.js";
|
||||
import { REPO, overviewHtml, roadmapHtml, slimIssue } from "./hub.js";
|
||||
|
||||
const root = document.documentElement;
|
||||
const data = JSON.parse(document.getElementById("hub-data").textContent);
|
||||
const tabs = [...document.querySelectorAll('.hub-tabs [role="tab"]')];
|
||||
const pill = document.querySelector(".hub-tabs .tab-pill");
|
||||
let area = "all";
|
||||
|
||||
// --- Tabs ------------------------------------------------------------------------------------------------------
|
||||
|
||||
const panelOf = (tab) => document.getElementById(tab.getAttribute("aria-controls"));
|
||||
const place = (tab) => {
|
||||
pill.style.width = `${tab.offsetWidth}px`;
|
||||
pill.style.height = `${tab.offsetHeight}px`;
|
||||
pill.style.transform = `translate(${tab.offsetLeft}px, ${tab.offsetTop}px)`;
|
||||
};
|
||||
function choose(tab, { focus = false, push = false } = {}) {
|
||||
for (const t of tabs) {
|
||||
const on = t === tab;
|
||||
t.setAttribute("aria-selected", String(on));
|
||||
t.tabIndex = on ? 0 : -1;
|
||||
panelOf(t).classList.toggle("is-active", on);
|
||||
}
|
||||
place(tab);
|
||||
if (focus) tab.focus();
|
||||
if (push && location.hash !== `#${panelOf(tab).id}`) history.replaceState(null, "", `#${panelOf(tab).id}`);
|
||||
}
|
||||
// "#roadmap" opens its tab; "#item-x" or "#help-wanted" opens the tab holding it and scrolls there.
|
||||
function follow() {
|
||||
const target = location.hash && document.getElementById(decodeURIComponent(location.hash.slice(1)));
|
||||
const tab = tabs.find((t) => target && (panelOf(t) === target || panelOf(t).contains(target))) || tabs[0];
|
||||
choose(tab);
|
||||
if (target && target !== panelOf(tab)) {
|
||||
if (target.dataset.area && area !== "all" && target.dataset.area !== area) filter("all");
|
||||
requestAnimationFrame(() => target.scrollIntoView({ block: "start" }));
|
||||
}
|
||||
}
|
||||
tabs.forEach((tab, i) => {
|
||||
tab.addEventListener("click", () => choose(tab, { push: true }));
|
||||
tab.addEventListener("keydown", (e) => {
|
||||
const step = { ArrowRight: 1, ArrowLeft: -1 }[e.key];
|
||||
if (step) choose(tabs[(i + step + tabs.length) % tabs.length], { focus: true, push: true });
|
||||
});
|
||||
});
|
||||
// Links inside the page ("Help wanted", an item of the overview) switch tabs through the hash.
|
||||
addEventListener("hashchange", follow);
|
||||
addEventListener("resize", () => place(tabs.find((t) => t.getAttribute("aria-selected") === "true")));
|
||||
document.fonts?.ready.then(() => place(tabs.find((t) => t.getAttribute("aria-selected") === "true")));
|
||||
|
||||
// --- Simple / Technical ----------------------------------------------------------------------------------------
|
||||
|
||||
const detailButtons = [...document.querySelectorAll("[data-detail]")];
|
||||
function detail(mode) {
|
||||
if (mode === "dev") root.dataset.detail = "dev";
|
||||
else delete root.dataset.detail;
|
||||
detailButtons.forEach((b) => b.setAttribute("aria-pressed", String(b.dataset.detail === mode)));
|
||||
}
|
||||
detailButtons.forEach((b) =>
|
||||
b.addEventListener("click", () => {
|
||||
detail(b.dataset.detail);
|
||||
try {
|
||||
localStorage.setItem("hub:detail", b.dataset.detail);
|
||||
} catch {}
|
||||
}),
|
||||
);
|
||||
detail(root.dataset.detail === "dev" ? "dev" : "plain");
|
||||
|
||||
// --- Area filter -----------------------------------------------------------------------------------------------
|
||||
|
||||
const areaButtons = [...document.querySelectorAll("[data-area-filter]")];
|
||||
function filter(to) {
|
||||
area = to;
|
||||
areaButtons.forEach((b) => b.setAttribute("aria-pressed", String(b.dataset.areaFilter === area)));
|
||||
for (const section of document.querySelectorAll("[data-roadmap] .hub-section")) {
|
||||
let shown = 0;
|
||||
for (const item of section.querySelectorAll(".hub-item")) {
|
||||
item.hidden = area !== "all" && item.dataset.area !== area;
|
||||
if (!item.hidden) shown++;
|
||||
}
|
||||
section.hidden = shown === 0;
|
||||
}
|
||||
}
|
||||
areaButtons.forEach((b) => b.addEventListener("click", () => filter(b.dataset.areaFilter)));
|
||||
|
||||
// --- Live state from GitHub ------------------------------------------------------------------------------------
|
||||
|
||||
// The open issues and pull requests, and those closed or merged lately: four requests at most, kept ten minutes.
|
||||
async function loadLive() {
|
||||
const list = [];
|
||||
for (let page = 1; page <= 3; page++) {
|
||||
const batch = await get(`https://api.github.com/repos/${REPO}/issues?state=open&per_page=100&page=${page}`);
|
||||
list.push(...batch.map(slimIssue));
|
||||
if (batch.length < 100) break;
|
||||
}
|
||||
const closed = await get(`https://api.github.com/repos/${REPO}/issues?state=closed&sort=updated&direction=desc&per_page=100`);
|
||||
return list.concat(closed.map(slimIssue));
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
const fresh = await cached("horizon:hub-live", loadLive).catch(() => null);
|
||||
if (!fresh) return;
|
||||
// What the build knew about older links stays; GitHub's answer wins for the rest.
|
||||
const live = new Map([...data.live, ...fresh].map((i) => [i.n, i]));
|
||||
document.querySelector("[data-overview]").innerHTML = overviewHtml(data.roadmap, live);
|
||||
document.querySelector("[data-roadmap]").innerHTML = roadmapHtml(data.roadmap, live);
|
||||
filter(area);
|
||||
const note = document.querySelector("[data-live-note]");
|
||||
if (note) note.textContent = "Pull request and issue states are live from GitHub.";
|
||||
}
|
||||
|
||||
setUpTheme();
|
||||
setUpMenu();
|
||||
follow();
|
||||
refresh().then(() => location.hash.startsWith("#item-") && follow());
|
||||
@@ -0,0 +1,110 @@
|
||||
<!doctype html>
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<title>Hub · Horizon</title>
|
||||
<meta name="description" content="Where Horizon is: what is being done now, what comes next, what shipped, and how to help, in plain words or in technical detail.">
|
||||
<meta name="theme-color" content="#ece7f7" media="(prefers-color-scheme: light)">
|
||||
<meta name="theme-color" content="#0f0d17" media="(prefers-color-scheme: dark)">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<link rel="canonical" href="https://playhorizon.dev/hub">
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="/favicon-32.png" sizes="32x32" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:site_name" content="Horizon">
|
||||
<meta property="og:title" content="Hub · Horizon">
|
||||
<meta property="og:description" content="What is being done on Horizon now, what comes next, what shipped, and how to help.">
|
||||
<meta property="og:url" content="https://playhorizon.dev/hub">
|
||||
<meta property="og:image" content="https://playhorizon.dev/og.png">
|
||||
<link rel="preconnect" href="https://api.github.com" crossorigin>
|
||||
<style>{{STYLE}}</style>
|
||||
<script>document.documentElement.classList.replace("no-js", "js"); try { const t = localStorage.getItem("theme"); if (t === "light" || t === "dark") document.documentElement.dataset.theme = t; if (localStorage.getItem("hub:detail") === "dev") document.documentElement.dataset.detail = "dev" } catch {}</script>
|
||||
<script type="module" src="{{HUB_JS}}"></script>
|
||||
</head>
|
||||
<body class="subpage">
|
||||
<a class="skip" href="#main">Skip to the content</a>
|
||||
{{SITE_NAV}}
|
||||
<main id="main" class="section page-main hub">
|
||||
<div class="container">
|
||||
<p class="kicker"><span>Hub</span>Now, next and how to help</p>
|
||||
<h1 class="display page-title">Where Horizon is going</h1>
|
||||
<p class="lede">What is being done, what comes next, what shipped and where you can help. No dates: things are Now, Next or Later. Read it in plain words, or switch to the technical picture.</p>
|
||||
<div class="hub-bar">
|
||||
<div class="tabs hub-tabs" role="tablist" aria-label="Hub">
|
||||
<span class="tab-pill" aria-hidden="true"></span>
|
||||
<button type="button" role="tab" id="tab-overview" aria-controls="overview" aria-selected="true">Overview</button>
|
||||
<button type="button" role="tab" id="tab-roadmap" aria-controls="roadmap" aria-selected="false" tabindex="-1">Roadmap</button>
|
||||
<button type="button" role="tab" id="tab-contribute" aria-controls="contribute" aria-selected="false" tabindex="-1">Contribute</button>
|
||||
</div>
|
||||
<div class="hub-detail" role="group" aria-label="Detail">
|
||||
<button type="button" class="button secondary small" data-detail="plain" aria-pressed="true">Simple</button>
|
||||
<button type="button" class="button secondary small" data-detail="dev" aria-pressed="false">Technical</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hub-panel is-active" role="tabpanel" id="overview" aria-labelledby="tab-overview" data-overview>
|
||||
{{HUB_OVERVIEW}}
|
||||
</div>
|
||||
|
||||
<div class="hub-panel" role="tabpanel" id="roadmap" aria-labelledby="tab-roadmap">
|
||||
<div class="release-filter hub-areas" role="group" aria-label="Area">
|
||||
{{HUB_AREAS}}
|
||||
</div>
|
||||
<div data-roadmap>
|
||||
{{HUB_ROADMAP}}
|
||||
</div>
|
||||
<p class="meta hub-source">The roadmap lives in the repository: <a href="https://github.com/ludovic111/horizon/blob/main/ROADMAP.md">ROADMAP.md</a>, generated from <a href="https://github.com/ludovic111/horizon/blob/main/roadmap/roadmap.toml">roadmap/roadmap.toml</a>. Pull requests carry the <code>roadmap:<id></code> label of their item. <span data-live-note></span></p>
|
||||
</div>
|
||||
|
||||
<div class="hub-panel" role="tabpanel" id="contribute" aria-labelledby="tab-contribute">
|
||||
<section class="hub-block" aria-labelledby="h-first">
|
||||
<h2 class="title" id="h-first">Good first tasks</h2>
|
||||
<p class="hub-plain hub-intro">Each one is a small difference from vanilla, with an issue that says how to see it.</p>
|
||||
<p class="hub-dev hub-intro">Each links its issue; the technical text says where in the code and in vanilla to start.</p>
|
||||
<ol class="index hub-rows">{{HUB_HELP_WANTED}}</ol>
|
||||
</section>
|
||||
<section class="hub-block" aria-labelledby="h-ways">
|
||||
<h2 class="title" id="h-ways">Ways to help</h2>
|
||||
<div class="hub-cards">
|
||||
<article class="highlight">
|
||||
<h3>Tell us what differs</h3>
|
||||
<p>Something that doesn't play like vanilla is a bug. Say what you did, what happened and what vanilla does, with your Horizon version and system.</p>
|
||||
<p class="hub-actions"><a class="button secondary small" href="{{DISCORD}}">Discord</a><a class="button secondary small" href="https://github.com/ludovic111/horizon/issues/new">GitHub issue</a></p>
|
||||
</article>
|
||||
<article class="highlight">
|
||||
<h3>Take a task</h3>
|
||||
<p>Pick a good first task or an open issue. On Discord, <code>/claim 1234</code> tells everyone you are on issue 1234, so nobody starts the same work; <code>/unclaim</code> frees it.</p>
|
||||
<p class="hub-actions"><a class="button secondary small" href="https://github.com/ludovic111/horizon/issues">Open issues</a></p>
|
||||
</article>
|
||||
<article class="highlight">
|
||||
<h3>Bring your AI agent</h3>
|
||||
<p>On Discord, <code>/agent connect</code> gives your coding agent a personal token for Kira's MCP server: it reads the work board, claims tasks and posts its progress in your name.</p>
|
||||
<p class="hub-actions"><a class="button secondary small" href="{{DISCORD}}">Join the Discord</a></p>
|
||||
</article>
|
||||
<article class="highlight">
|
||||
<h3>Benchmark your computer</h3>
|
||||
<p>Run the built-in benchmark and share the report: every new machine makes the performance work more accurate. No coding needed.</p>
|
||||
<p class="hub-actions"><a class="button secondary small" href="/docs/performance">How to</a></p>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
<section class="hub-block" aria-labelledby="h-rules">
|
||||
<h2 class="title" id="h-rules">The rules</h2>
|
||||
<ol class="hub-rules">
|
||||
<li><strong>Vanilla is the specification.</strong> Wherever Minecraft 26.3 has the feature, Horizon does exactly what it does: read vanilla's code, then match it.</li>
|
||||
<li><strong>Small pull requests, proven.</strong> One change each, under about 500 lines, with the block <code>python3 tools/pr_ready.py</code> prints: formatting, Clippy, tests and the harnesses your change can affect.</li>
|
||||
<li><strong>Say who wrote it.</strong> If an AI agent wrote or posts it, the pull request says so, and commits keep its co-author line.</li>
|
||||
<li><strong>Never commit Mojang's files.</strong> No game jars, assets, decompiled code or prepared resources, and nothing taken from other mods' code.</li>
|
||||
</ol>
|
||||
<p class="hub-actions"><a class="button primary" href="/docs/contributing">The contributing guide</a><a class="button secondary" href="https://github.com/ludovic111/horizon/blob/main/CONTRIBUTING.md">CONTRIBUTING.md</a></p>
|
||||
</section>
|
||||
</div>
|
||||
<p class="disclaimer">Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.</p>
|
||||
</div>
|
||||
</main>
|
||||
{{SITE_FOOTER}}
|
||||
<script type="application/json" id="hub-data">{{HUB_DATA}}</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,175 @@
|
||||
// The hub (/hub): the roadmap from website/data/roadmap.json (generated from roadmap/roadmap.toml by
|
||||
// tools/roadmap.py), with each item's issues and pull requests in their live GitHub state. Shared by build.mjs
|
||||
// (baked into the page) and hub-page.js (refreshed from GitHub in the browser). Every item says the same thing
|
||||
// twice: `plain` (.hub-plain) for players and `dev` (.hub-dev) for contributors; the page's Simple / Technical
|
||||
// switch shows one of them.
|
||||
import { escape, inline } from "./markdown.js";
|
||||
|
||||
export const REPO = "ludovic111/horizon";
|
||||
const issueUrl = (n) => `https://github.com/${REPO}/issues/${n}`;
|
||||
const fileUrl = (path) => `https://github.com/${REPO}/blob/main/${path}`;
|
||||
|
||||
// The issues a pull request closes when merged: "Fixes #12", "closes #3, resolves #4" (as Kira's board reads them).
|
||||
export function fixesIn(text) {
|
||||
const out = new Set();
|
||||
for (const m of String(text ?? "").matchAll(/\b(?:fix(?:e[sd])?|close[sd]?|resolve[sd]?)\s*:?\s+((?:#\d+(?:\s*(?:,|and)\s*)?)+)/gi)) {
|
||||
for (const n of m[1].matchAll(/#(\d+)/g)) out.add(Number(n[1]));
|
||||
}
|
||||
return [...out].sort((a, b) => a - b);
|
||||
}
|
||||
|
||||
// A GitHub issue or pull request (from /issues, which lists both) reduced to what the hub shows.
|
||||
export function slimIssue(raw) {
|
||||
const pr = Boolean(raw.pull_request);
|
||||
const merged = pr && raw.pull_request.merged_at;
|
||||
return {
|
||||
n: raw.number,
|
||||
title: String(raw.title || ""),
|
||||
kind: pr ? "pr" : "issue",
|
||||
state: merged ? "merged" : raw.state === "open" ? "open" : raw.state_reason === "not_planned" ? "dropped" : "closed",
|
||||
draft: Boolean(raw.draft),
|
||||
user: raw.user?.login || "",
|
||||
labels: (raw.labels || []).map((l) => (typeof l === "string" ? l : l.name)).filter(Boolean),
|
||||
assigned: (raw.assignees || []).length > 0,
|
||||
fixes: pr ? fixesIn(raw.body) : [],
|
||||
at: merged || raw.closed_at || raw.updated_at || "",
|
||||
url: raw.html_url || issueUrl(raw.number),
|
||||
};
|
||||
}
|
||||
|
||||
const number = (link) => Number((String(link).match(/^#(\d+)$/) || [])[1]) || null;
|
||||
|
||||
// "#12 in review", "#13 merged": a link's state, when GitHub told us.
|
||||
function linkState(issue) {
|
||||
if (!issue) return null;
|
||||
if (issue.kind === "pr") return issue.state === "open" ? (issue.draft ? "in progress" : "in review") : issue.state;
|
||||
return issue.state === "open" ? "open" : "closed";
|
||||
}
|
||||
|
||||
function linkHtml(link, live) {
|
||||
const n = number(link);
|
||||
if (!n) {
|
||||
const url = link.startsWith("https://") ? link : fileUrl(link);
|
||||
return `<a class="hub-link" href="${escape(url)}">${escape(link.replace(/^https:\/\//, ""))}</a>`;
|
||||
}
|
||||
const issue = live.get(n);
|
||||
const state = linkState(issue);
|
||||
const label = issue ? `${issue.kind === "pr" ? "Pull request" : "Issue"} #${n}: ${issue.title}` : `#${n}`;
|
||||
return `<a class="hub-link${state ? ` is-${state.replace(" ", "-")}` : ""}" href="${issueUrl(n)}" title="${escape(label)}">#${n}${state ? ` <span>${state}</span>` : ""}</a>`;
|
||||
}
|
||||
|
||||
// The technical text with its #N and the item's own paths as links.
|
||||
function devHtml(item) {
|
||||
let text = item.dev.replace(/(^|[^\w[/`])#(\d+)\b/g, (_, before, n) => `${before}[#${n}](${issueUrl(n)})`);
|
||||
for (const link of item.links || []) {
|
||||
if (!number(link) && !link.startsWith("https://")) text = text.replace(link, `[${link}](${fileUrl(link)})`);
|
||||
}
|
||||
return inline(text);
|
||||
}
|
||||
|
||||
// "2 pull requests in review · 3 merged · 1 issue open", from the item's links.
|
||||
export function progress(item, live) {
|
||||
const known = (item.links || []).map(number).filter(Boolean).map((n) => live.get(n)).filter(Boolean);
|
||||
const pulls = known.filter((i) => i.kind === "pr");
|
||||
const count = (list, word) => (list.length ? `${list.length} ${word}` : "");
|
||||
const parts = [
|
||||
count(pulls.filter((p) => p.state === "open" && !p.draft), pulls.filter((p) => p.state === "open" && !p.draft).length === 1 ? "pull request in review" : "pull requests in review"),
|
||||
count(pulls.filter((p) => p.state === "open" && p.draft), "in progress"),
|
||||
count(pulls.filter((p) => p.state === "merged"), "merged"),
|
||||
count(known.filter((i) => i.kind === "issue" && i.state === "open"), known.filter((i) => i.kind === "issue" && i.state === "open").length === 1 ? "issue open" : "issues open"),
|
||||
].filter(Boolean);
|
||||
return parts.join(" · ");
|
||||
}
|
||||
|
||||
const areaName = (roadmap, id) => roadmap.areas.find((a) => a.id === id)?.name || id;
|
||||
|
||||
export function itemHtml(item, roadmap, live) {
|
||||
const done = item.status === "shipped";
|
||||
const state = done ? "" : progress(item, live);
|
||||
return `<article class="hub-item" id="item-${escape(item.id)}" data-area="${escape(item.area)}" data-item="${escape(item.id)}">
|
||||
<p class="hub-item-meta"><span class="badge">${escape(areaName(roadmap, item.area))}</span>${done ? `<span class="badge badge-game">${escape(item.shipped_in)}</span>` : ""}${item.ongoing ? `<span class="hub-ongoing">Ongoing</span>` : ""}</p>
|
||||
<h3 class="hub-item-title">${escape(item.title)}</h3>
|
||||
<p class="hub-plain">${inline(item.plain)}</p>
|
||||
<p class="hub-dev">${devHtml(item)}</p>
|
||||
${state ? `<p class="hub-progress" data-progress>${escape(state)}</p>` : ""}
|
||||
<p class="hub-links">${(item.links || []).map((l) => linkHtml(l, live)).join("")}</p>
|
||||
</article>`;
|
||||
}
|
||||
|
||||
const SECTION_LEDE = {
|
||||
now: "Being worked on, with pull requests open or just merged.",
|
||||
next: "Decided, and up after what is being done now.",
|
||||
later: "Decided, further out.",
|
||||
"help-wanted": "Good first contributions: a clear vanilla behaviour, an issue with the steps, a place to start.",
|
||||
shipped: "Out in a release. The journal has every change.",
|
||||
};
|
||||
|
||||
// The Roadmap tab: one section per status, the items in the file's order (areas by priority).
|
||||
export function roadmapHtml(roadmap, live = new Map()) {
|
||||
const order = new Map(roadmap.areas.map((a, i) => [a.id, i]));
|
||||
return roadmap.statuses
|
||||
.map(({ id, name }) => {
|
||||
const items = roadmap.items.filter((i) => i.status === id);
|
||||
if (!items.length) return "";
|
||||
// Shipped stays newest first; the others go by the areas' priority.
|
||||
if (id !== "shipped") items.sort((a, b) => order.get(a.area) - order.get(b.area));
|
||||
return `<section class="hub-section" id="${id}" data-status="${id}" aria-labelledby="h-${id}">
|
||||
<div class="hub-section-head"><h2 class="title" id="h-${id}">${escape(name)}</h2><p class="meta">${escape(SECTION_LEDE[id] || "")}</p></div>
|
||||
<div class="hub-items">
|
||||
${items.map((item) => itemHtml(item, roadmap, live)).join("\n")}
|
||||
</div>
|
||||
</section>`;
|
||||
})
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
// The area filter's buttons: every area that has an item.
|
||||
export function areaFilterHtml(roadmap) {
|
||||
const used = roadmap.areas.filter((a) => roadmap.items.some((i) => i.area === a.id));
|
||||
return [`<button type="button" class="button secondary small" data-area-filter="all" aria-pressed="true">All</button>`]
|
||||
.concat(used.map((a) => `<button type="button" class="button secondary small" data-area-filter="${escape(a.id)}" aria-pressed="false">${escape(a.name)}</button>`))
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
// The Overview tab: where Horizon is, the 3 to 5 things in focus, what is next, what shipped last, how to help.
|
||||
export function overviewHtml(roadmap, live = new Map()) {
|
||||
const o = roadmap.overview;
|
||||
const focus = roadmap.items.filter((i) => i.focus);
|
||||
const next = roadmap.items.filter((i) => i.status === "next");
|
||||
const shipped = roadmap.items.filter((i) => i.status === "shipped").slice(0, 3);
|
||||
const row = (item, i, meta) => `<li class="row"><a href="#item-${escape(item.id)}" data-goto="roadmap"><span class="row-index">${String(i + 1).padStart(2, "0")}</span><span class="hub-row-body"><span class="hub-row-title">${escape(item.title)}</span><span class="hub-plain">${inline(item.plain)}</span><span class="hub-dev">${inline(item.dev)}</span></span><span class="row-meta">${escape(meta(item))}</span></a></li>`;
|
||||
return `<div class="hub-today">
|
||||
<p class="hub-plain hub-lead">${inline(o.today_plain)}</p>
|
||||
<p class="hub-dev hub-lead">${inline(o.today_dev)}</p>
|
||||
</div>
|
||||
<section class="hub-block" aria-labelledby="h-focus">
|
||||
<h2 class="title" id="h-focus">Being done now</h2>
|
||||
<ol class="index hub-rows">${focus.map((item, i) => row(item, i, (x) => progress(x, live))).join("")}</ol>
|
||||
</section>
|
||||
<section class="hub-block" aria-labelledby="h-next">
|
||||
<h2 class="title" id="h-next">Next</h2>
|
||||
<ol class="index hub-rows">${next.map((item, i) => row(item, i, (x) => areaName(roadmap, x.area))).join("")}</ol>
|
||||
</section>
|
||||
<section class="hub-block" aria-labelledby="h-shipped">
|
||||
<h2 class="title" id="h-shipped">Recently shipped</h2>
|
||||
<ol class="index hub-rows">${shipped.map((item, i) => row(item, i, (x) => `In ${x.shipped_in}`)).join("")}</ol>
|
||||
</section>
|
||||
<section class="hub-block hub-help" aria-labelledby="h-help">
|
||||
<h2 class="title" id="h-help">How to help</h2>
|
||||
<p class="hub-plain">${inline(o.help_plain)}</p>
|
||||
<p class="hub-dev">${inline(o.help_dev)}</p>
|
||||
<p class="hub-actions"><a class="button primary" href="#contribute" data-goto="contribute">Contribute</a><a class="button secondary" href="#help-wanted" data-goto="roadmap">Help wanted</a></p>
|
||||
</section>`;
|
||||
}
|
||||
|
||||
// The Contribute tab's list of good first tasks.
|
||||
export function helpWantedHtml(roadmap) {
|
||||
return roadmap.items
|
||||
.filter((i) => i.status === "help-wanted")
|
||||
.map((item, i) => {
|
||||
const first = (item.links || []).map(number).find(Boolean);
|
||||
const href = first ? issueUrl(first) : `#item-${item.id}`;
|
||||
return `<li class="row"><a href="${escape(href)}"><span class="row-index">${String(i + 1).padStart(2, "0")}</span><span class="hub-row-body"><span class="hub-row-title">${escape(item.title)}</span><span class="hub-plain">${inline(item.plain)}</span><span class="hub-dev">${inline(item.dev)}</span></span><span class="row-meta">${first ? `#${first}` : ""}</span></a></li>`;
|
||||
})
|
||||
.join("");
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fixesIn, overviewHtml, progress, roadmapHtml, slimIssue } from "./hub.js";
|
||||
|
||||
const roadmap = JSON.parse(readFileSync(new URL("../data/roadmap.json", import.meta.url), "utf8"));
|
||||
|
||||
const pr = (number, extra = {}) => ({ number, title: `PR ${number}`, state: "open", pull_request: { merged_at: null }, user: { login: "a" }, labels: [], assignees: [], body: "", ...extra });
|
||||
const issue = (number, extra = {}) => ({ number, title: `Issue ${number}`, state: "open", user: { login: "b" }, labels: [{ name: "bug" }], assignees: [], ...extra });
|
||||
|
||||
test("pull requests and issues reduce to their hub state", () => {
|
||||
assert.deepEqual(fixesIn("Fixes #12, #13 and closes #4. Mentions #9."), [4, 12, 13]);
|
||||
const merged = slimIssue(pr(5, { state: "closed", pull_request: { merged_at: "2030-01-01T00:00:00Z" }, body: "Fixes #3" }));
|
||||
assert.equal(merged.kind, "pr");
|
||||
assert.equal(merged.state, "merged");
|
||||
assert.deepEqual(merged.fixes, [3]);
|
||||
assert.equal(slimIssue(issue(6, { state: "closed", state_reason: "not_planned" })).state, "dropped");
|
||||
assert.deepEqual(slimIssue(issue(7)).labels, ["bug"]);
|
||||
});
|
||||
|
||||
test("an item's progress counts its pull requests and issues", () => {
|
||||
const live = new Map([
|
||||
[1, slimIssue(pr(1))],
|
||||
[2, slimIssue(pr(2, { draft: true }))],
|
||||
[3, slimIssue(pr(3, { state: "closed", pull_request: { merged_at: "2030-01-01T00:00:00Z" } }))],
|
||||
[4, slimIssue(issue(4))],
|
||||
]);
|
||||
const item = { links: ["#1", "#2", "#3", "#4", "#99", "docs/x.md"] };
|
||||
assert.equal(progress(item, live), "1 pull request in review · 1 in progress · 1 merged · 1 issue open");
|
||||
assert.equal(progress(item, new Map()), "");
|
||||
});
|
||||
|
||||
test("the roadmap renders every item once, with both texts, in its status's section", () => {
|
||||
const html = roadmapHtml(roadmap);
|
||||
for (const item of roadmap.items) {
|
||||
assert.equal(html.split(`id="item-${item.id}"`).length, 2, item.id);
|
||||
}
|
||||
assert.ok(html.indexOf('id="now"') < html.indexOf('id="next"'));
|
||||
assert.ok(html.includes('class="hub-plain"') && html.includes('class="hub-dev"'));
|
||||
// Shipped items say which release had them.
|
||||
assert.ok(html.includes(`>${roadmap.items.find((i) => i.status === "shipped").shipped_in}<`));
|
||||
});
|
||||
|
||||
test("the overview lists the focus items and never nests links", () => {
|
||||
const html = overviewHtml(roadmap);
|
||||
for (const item of roadmap.items.filter((i) => i.focus)) assert.ok(html.includes(`href="#item-${item.id}"`), item.id);
|
||||
for (const row of html.match(/<li class="row">[\s\S]*?<\/li>/g)) assert.equal(row.split("<a ").length, 2, row);
|
||||
});
|
||||
+62
-1
@@ -645,7 +645,7 @@ code { border-radius: 0; background: var(--well); box-shadow: 0 0 0 1px var(--ou
|
||||
|
||||
/* Releases: a filter, then every release as a panel that opens. */
|
||||
.release-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
|
||||
.release-filter .button[aria-pressed="true"] { background: var(--face); color: var(--on-face); box-shadow: inset 0 var(--block-bevel) 0 var(--face-bevel), inset 0 calc(-1 * var(--block-lip)) 0 var(--face-lip); }
|
||||
.release-filter .button[aria-pressed="true"], .hub-detail .button[aria-pressed="true"] { background: var(--face); color: var(--on-face); box-shadow: inset 0 var(--block-bevel) 0 var(--face-bevel), inset 0 calc(-1 * var(--block-lip)) 0 var(--face-lip); }
|
||||
.release-count { margin: 16px 0 12px; }
|
||||
.release-list { display: grid; gap: 8px; }
|
||||
.release-list .release + .release { margin-top: 0; }
|
||||
@@ -726,3 +726,64 @@ code { border-radius: 0; background: var(--well); box-shadow: 0 0 0 1px var(--ou
|
||||
.release-detail { padding-left: 0; margin-left: 0; }
|
||||
.machine { padding: 16px; }
|
||||
}
|
||||
|
||||
/* --- The hub (/hub): tabs, the Simple / Technical switch, roadmap items as panels ------------------- */
|
||||
|
||||
.hub-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 32px; }
|
||||
.hub-tabs { margin-bottom: 0; }
|
||||
.hub-detail { display: flex; gap: 8px; }
|
||||
/* A link to a tab (/hub#roadmap) lands with the tabs in view under the top bar. */
|
||||
.hub-panel { margin-top: 40px; scroll-margin-top: calc(var(--nav) + 120px); }
|
||||
.js .hub-panel:not(.is-active) { display: none; }
|
||||
/* Simple shows `plain`, Technical shows `dev`; without the switch (no JavaScript) Simple reads. */
|
||||
.hub .hub-dev { display: none; }
|
||||
:root[data-detail="dev"] .hub .hub-dev { display: block; }
|
||||
:root[data-detail="dev"] .hub .hub-plain { display: none; }
|
||||
.hub-lead { max-width: 60ch; font-size: var(--text-heading); line-height: var(--text-heading-line); color: var(--ink); }
|
||||
.hub-block { margin-top: 56px; }
|
||||
.hub-block > .title { margin-bottom: 16px; }
|
||||
.hub-intro { margin-bottom: 16px; color: var(--ink-soft); max-width: var(--measure); }
|
||||
.hub-rows .row > a { grid-template-columns: var(--index) minmax(0, 1fr) auto; align-items: baseline; }
|
||||
.hub-row-body { display: grid; gap: 4px; min-width: 0; }
|
||||
.hub-row-title { font-size: clamp(18px, 1.8vw, 22px); font-weight: 500; color: var(--ink); }
|
||||
.hub-row-body .hub-plain, .hub-row-body .hub-dev { color: var(--ink-soft); font-size: var(--text-ui); max-width: 80ch; }
|
||||
.hub-rows .row-meta { max-width: 16rem; }
|
||||
.hub-section { margin-top: 48px; }
|
||||
.hub-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; }
|
||||
.hub-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 8px; margin-top: 16px; }
|
||||
.hub-item {
|
||||
display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; scroll-margin-top: calc(var(--nav) + 24px);
|
||||
background: var(--panel); border: var(--block-outline) solid var(--outline); box-shadow: var(--panel-edges);
|
||||
}
|
||||
.hub-item:target { box-shadow: var(--panel-edges), 0 0 0 3px var(--accent); }
|
||||
.hub-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
||||
.hub-item-meta .badge { margin-right: 0; }
|
||||
.hub-ongoing { font: var(--text-micro) / 1 var(--mono); letter-spacing: var(--text-micro-tracking); color: var(--muted); }
|
||||
.hub-item-title { font-size: var(--text-heading); line-height: var(--text-heading-line); }
|
||||
.hub-item .hub-plain, .hub-item .hub-dev { font-size: var(--text-ui); color: var(--ink-soft); }
|
||||
.hub-progress { font: var(--text-micro) / 1.4 var(--mono); letter-spacing: var(--text-micro-tracking); color: var(--ink); }
|
||||
.hub-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
|
||||
.hub-link {
|
||||
display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 7px; font: var(--text-micro) / 1.3 var(--mono);
|
||||
color: var(--ink-soft); background: var(--well); box-shadow: 0 0 0 var(--block-outline) var(--outline);
|
||||
}
|
||||
.hub-link span { color: var(--muted); }
|
||||
.hub-link:hover { color: var(--accent); }
|
||||
.hub-link.is-merged { background: color-mix(in srgb, var(--success) 18%, var(--well)); }
|
||||
.hub-link.is-in-review { background: color-mix(in srgb, var(--accent) 18%, var(--well)); }
|
||||
.hub-link.is-in-progress { background: color-mix(in srgb, var(--warn) 22%, var(--well)); }
|
||||
.hub-link.is-merged span, .hub-link.is-in-review span, .hub-link.is-in-progress span { color: var(--ink); }
|
||||
.hub-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px; }
|
||||
.hub-cards .highlight { justify-content: flex-start; }
|
||||
.hub-cards h3 { font-size: var(--text-heading); line-height: var(--text-heading-line); }
|
||||
.hub-cards p { color: var(--ink-soft); font-size: var(--text-ui); }
|
||||
.hub-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
|
||||
.hub-cards .hub-actions { margin-top: auto; }
|
||||
.hub-rules { list-style: decimal; padding-left: 20px; max-width: var(--measure); }
|
||||
.hub-rules li + li { margin-top: 10px; }
|
||||
.hub-rules li::marker { color: var(--muted); font-family: var(--mono); }
|
||||
.hub-source { margin-top: 40px; max-width: var(--measure); }
|
||||
@media (max-width: 720px) {
|
||||
.hub-rows .row > a { grid-template-columns: var(--index) minmax(0, 1fr); }
|
||||
.hub-rows .row-meta { grid-column: 2; text-align: left; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user