- Political map country names were invisible because the label SVG had a zero-sized viewport, which some browsers never paint; size it to the world and guard it with a test. - Added a Devlog button showing the ten latest commits, generated into client/js/devlog_data.js by scripts/generate-devlog.js and refreshed by the pre-commit hook. - Worked through FIXME.md: the city button and a unit double-click now open the city, and the stat tooltip escapes the HUD so the unit panel cannot cover it. - The server creates its game at startup and clients only join it; the Create game screen and the configure_game path are gone, and testing is a --testing server flag. - A page on a loopback host signs in as adrien, claims France and gets the free, instant testing buttons, while the server grants free orders only to a loopback socket whose Origin is also loopback.
49 lines
2.1 KiB
JavaScript
49 lines
2.1 KiB
JavaScript
// The devlog opened from the main menu: the most recent repository commits,
|
|
// generated into ./devlog_data.js by scripts/generate-devlog.js. Every commit
|
|
// shows its date and header; clicking a header expands the full message. The
|
|
// renderer takes its list as an argument so it stays free of the generated
|
|
// data and can be tested with a fixture.
|
|
|
|
const MONTHS = [
|
|
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
|
];
|
|
|
|
// `2026-09-21` -> `21 Sep 2026`, so the date reads without consulting a locale
|
|
// (which would differ between the server and a test runner).
|
|
export function formatCommitDate(iso) {
|
|
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso || "");
|
|
if (!match) return iso || "";
|
|
const [, year, month, day] = match;
|
|
const name = MONTHS[Number(month) - 1];
|
|
return name ? `${Number(day)} ${name} ${year}` : iso;
|
|
}
|
|
|
|
// Renders one collapsible entry per commit into the modal's list element.
|
|
export function renderDevlog($list, commits) {
|
|
$list.empty();
|
|
for (const commit of commits || []) {
|
|
const $entry = $("<div class='devlog-entry'></div>");
|
|
const $header = $("<button type='button' class='devlog-header'></button>");
|
|
$header.attr("aria-expanded", "false");
|
|
$header.append($("<span class='devlog-date'></span>").text(formatCommitDate(commit.date)));
|
|
$header.append($("<span class='devlog-subject'></span>").text(commit.subject || ""));
|
|
$header.append($("<span class='devlog-toggle' aria-hidden='true'></span>").text("+"));
|
|
const $body = $("<div class='devlog-body hidden'></div>");
|
|
if (commit.body) {
|
|
$body.append($("<p class='devlog-message'></p>").text(commit.body));
|
|
}
|
|
$body.append($("<span class='devlog-hash'></span>").text(commit.hash || ""));
|
|
$header.on("click", () => {
|
|
const opening = $body.hasClass("hidden");
|
|
$body.toggleClass("hidden", !opening);
|
|
$header.toggleClass("open", opening);
|
|
$header.attr("aria-expanded", opening ? "true" : "false");
|
|
$header.find(".devlog-toggle").text(opening ? "-" : "+");
|
|
});
|
|
$entry.append($header);
|
|
$entry.append($body);
|
|
$list.append($entry);
|
|
}
|
|
}
|