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
5 changes: 5 additions & 0 deletions src/lib/modules/store/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const t = dict(
version: "Version",
downloads: "Downloads",
details: "Details",
whatsNew: "What's new",
source: "Source",
draft: "Draft",
updated: (date: string) => `Updated ${date}`,
Expand Down Expand Up @@ -161,6 +162,7 @@ export const t = dict(
version: "Версия",
downloads: "Загрузки",
details: "Подробнее",
whatsNew: "Что нового",
source: "Исходники",
draft: "Черновик",
updated: (date) => `Обновлено ${date}`,
Expand Down Expand Up @@ -300,6 +302,7 @@ export const t = dict(
version: "Версія",
downloads: "Завантаження",
details: "Докладніше",
whatsNew: "Що нового",
source: "Код",
draft: "Чернетка",
updated: (date) => `Оновлено ${date}`,
Expand Down Expand Up @@ -439,6 +442,7 @@ export const t = dict(
version: "Versión",
downloads: "Descargas",
details: "Detalles",
whatsNew: "Novedades",
source: "Código",
draft: "Borrador",
updated: (date) => `Actualizado el ${date}`,
Expand Down Expand Up @@ -576,6 +580,7 @@ export const t = dict(
version: "वर्शन",
downloads: "डाउनलोड",
details: "विवरण",
whatsNew: "नया क्या है",
source: "सोर्स",
draft: "ड्राफ़्ट",
updated: (date) => `${date} को अपडेट हुआ`,
Expand Down
20 changes: 20 additions & 0 deletions src/lib/modules/store/lib/firmware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,23 @@ export const testedKey = (tested: unknown): "hardware" | "emulator" | null =>
*/
export const recordDevice = (device: unknown): string => String(device || DEFAULT_DEVICE);
export const flashable = (device: unknown) => Object.hasOwn(BOARDS, recordDevice(device));

export interface ReleaseNote {
/** "Stub 9" for the patched firmware, the App Loader's version otherwise. */
title: string;
/** Markdown. */
notes: string;
}

/**
* A record's `changelog` (`[{version, stub?, notes}]`, newest first; fmc_pocketbase
* 1755300000_firmware_changelog.js), the same list FMC Companion shows under What's new.
* Entries without notes are dropped; anything that isn't such a list reads as none.
*/
export const releaseNotes = (changelog: unknown): ReleaseNote[] =>
(Array.isArray(changelog) ? changelog : [])
.filter((e) => e && typeof e.notes === "string" && e.notes.trim())
.map((e) => ({
title: typeof e.stub === "number" && e.stub > 0 ? `Stub ${e.stub}` : String(e.version ?? ""),
notes: e.notes,
}));
25 changes: 25 additions & 0 deletions src/lib/modules/store/pages/firmware.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
flashable,
isLoader,
recordDevice,
releaseNotes,
testedKey,
testedOnHardware,
} from "../lib/firmware";
Expand Down Expand Up @@ -86,6 +87,7 @@
const deviceName = $derived(DEVICES.find((d) => d.value === device)?.label ?? device);
// another watch's image: FMC only downloads it, the Install button isn't there to press
const ota = $derived(flashable(device));
const notes = $derived(releaseNotes(fw?.changelog));
const stats = $derived(
fw
? [
Expand Down Expand Up @@ -233,6 +235,19 @@
</p>
</section>

{#if notes.length}
<!-- the record's changelog, newest first: what FMC Companion shows under What's new -->
<section class="whats-new">
<h2 class="type-heading">{$t.whatsNew}</h2>
{#each notes as note, i (i)}
<article>
<h3 class="type-subtitle">{note.title}</h3>
<Prose source={note.notes} />
</article>
{/each}
</section>
{/if}

<details class="more">
<summary class="type-subtitle">{$t.details}</summary>
<div class="more-body">
Expand Down Expand Up @@ -431,6 +446,16 @@
cursor: pointer;
}
}
.whats-new {
display: flex;
flex-direction: column;
gap: 0.875rem;

h2,
h3 {
margin: 0 0 0.25rem;
}
}
.more-body {
display: flex;
flex-direction: column;
Expand Down
21 changes: 21 additions & 0 deletions tests/firmware-release-notes.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// The firmware page's What's new: the record's changelog as FMC Companion reads it.
import { expect, test } from "vitest";
import { releaseNotes } from "$lib/modules/store/lib/firmware";

test("the patched firmware's entries are titled by stub, the loader's by version", () => {
expect(
releaseNotes([
{ version: "1.0.0.73-wp2.13", stub: 10, notes: "- Columns." },
{ version: "2026-11-23-cccaf79", notes: "- Icons." },
]),
).toEqual([
{ title: "Stub 10", notes: "- Columns." },
{ title: "2026-11-23-cccaf79", notes: "- Icons." },
]);
});

test("no list, or entries without notes, read as nothing", () => {
expect(releaseNotes(null)).toEqual([]);
expect(releaseNotes("x")).toEqual([]);
expect(releaseNotes([{ version: "v", notes: " " }, null, { version: "w" }])).toEqual([]);
});
Loading