summaryrefslogtreecommitdiff
path: root/apps/web/src/app/changelog/utils.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-03-29 14:10:57 +0200
committerMaze Winther <mazewinther@gmail.com>2026-03-29 15:58:46 +0200
commit585e28d49b853155c34a3eba03388722e2049cb7 (patch)
tree92efed21fe58b812de7c7f83dc373d9594e1734c /apps/web/src/app/changelog/utils.ts
parent1261e663e1bbb950e4efc8927ca4b068e0946bae (diff)
downloadopencut-585e28d49b853155c34a3eba03388722e2049cb7.tar.gz
feat: add published status to changelog entries
Diffstat (limited to 'apps/web/src/app/changelog/utils.ts')
-rw-r--r--apps/web/src/app/changelog/utils.ts18
1 files changed, 14 insertions, 4 deletions
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<string, string> = {
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);
}