From 585e28d49b853155c34a3eba03388722e2049cb7 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 29 Mar 2026 14:10:57 +0200 Subject: feat: add published status to changelog entries --- apps/web/src/app/changelog/utils.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'apps/web/src/app/changelog/utils.ts') diff --git a/apps/web/src/app/changelog/utils.ts b/apps/web/src/app/changelog/utils.ts index d3405631..3f38ab6b 100644 --- a/apps/web/src/app/changelog/utils.ts +++ b/apps/web/src/app/changelog/utils.ts @@ -12,7 +12,7 @@ const knownSectionTitles: Record = { breaking: "Breaking Changes", }; -export function getSectionTitle(type: string): string { +export function getSectionTitle({ type }: { type: string }): string { return ( knownSectionTitles[type] ?? type.charAt(0).toUpperCase() + type.slice(1) ); @@ -36,8 +36,18 @@ export function groupAndOrderChanges({ changes }: { changes: Change[] }) { return { grouped, orderedTypes }; } +function isPublishedRelease({ published }: Release) { + return published !== false; +} + export function getSortedReleases() { - return [...allChangelogs].sort((a, b) => - b.version.localeCompare(a.version, undefined, { numeric: true }), - ); + return allChangelogs + .filter(isPublishedRelease) + .sort((a, b) => + b.version.localeCompare(a.version, undefined, { numeric: true }), + ); +} + +export function getReleaseByVersion({ version }: { version: string }) { + return getSortedReleases().find((release) => release.version === version); } -- cgit v1.3.1