From 672611357cc0721b757e26a3d0b4afa406866ad7 Mon Sep 17 00:00:00 2001 From: Ethan Knowlton Date: Thu, 2 Oct 2025 00:15:54 -0400 Subject: [PATCH] More fun autochangelog stuff --- .../Http/Middleware/HandleInertiaRequests.php | 2 + src/package.json | 5 ++ src/resources/js/components/app-sidebar.tsx | 8 ++ src/resources/js/pages/updates.tsx | 87 +++++++++++++++++++ src/resources/js/types/index.d.ts | 1 + 5 files changed, 103 insertions(+) create mode 100644 src/resources/js/pages/updates.tsx diff --git a/src/app/Http/Middleware/HandleInertiaRequests.php b/src/app/Http/Middleware/HandleInertiaRequests.php index df34d67..7f88f9e 100755 --- a/src/app/Http/Middleware/HandleInertiaRequests.php +++ b/src/app/Http/Middleware/HandleInertiaRequests.php @@ -66,6 +66,8 @@ public function share(Request $request): array 'sidebar_pen' => $sidebar_open, + 'changelog' => file_get_contents(base_path('CHANGELOG.md')), + ...($request->user() ? [ 'task_statuses' => TaskStatusData::collect(TaskStatus::cases()), diff --git a/src/package.json b/src/package.json index 0cfb67f..bfc33cf 100755 --- a/src/package.json +++ b/src/package.json @@ -8,7 +8,12 @@ "format": "prettier --write resources/", "format:check": "prettier --check resources/", "lint": "eslint . --fix", +<<<<<<< Updated upstream "types": "tsc --noEmit" +======= + "types": "tsc --noEmit", + "version": "auto-changelog -p --hide-credit && git add CHANGELOG.md" +>>>>>>> Stashed changes }, "devDependencies": { "@eslint/js": "^9.19.0", diff --git a/src/resources/js/components/app-sidebar.tsx b/src/resources/js/components/app-sidebar.tsx index 72263cb..02c5f6e 100755 --- a/src/resources/js/components/app-sidebar.tsx +++ b/src/resources/js/components/app-sidebar.tsx @@ -46,6 +46,14 @@ const footerNavItems: NavItem[] = [ href: 'mailto:eknowlton@gmail.com', icon: BookOpen, }, +<<<<<<< Updated upstream +======= + { + title: 'Changelog', + href: route('updates'), + icon: BookOpen, + } +>>>>>>> Stashed changes ]; export function AppSidebar() { diff --git a/src/resources/js/pages/updates.tsx b/src/resources/js/pages/updates.tsx new file mode 100644 index 0000000..0e60379 --- /dev/null +++ b/src/resources/js/pages/updates.tsx @@ -0,0 +1,87 @@ +import AppLayout from '@/layouts/app-layout'; +import { type SharedData } from '@/types'; +import { usePage } from '@inertiajs/react'; +import { useHighlights, useMarkdown } from '@/lib/markdown'; + +export default function UpdatesPage() { + const { props } = usePage(); + const changelog = props.changelog ?? ''; + + const highlights = useHighlights(changelog); + const rendered = useMarkdown(changelog); + + return ( + +
+ {/* Header */} +
+

Changelog

+

What’s new and improved in this release.

+
+ + {/* Highlights section */} +
+
+

New & Improved

+ {highlights.added.length ? ( +
    + {highlights.added.map((item, idx) => ( +
  • {item}
  • + ))} +
+ ) : ( +

No new features listed in the latest release.

+ )} +
+
+

Fixes

+ {highlights.fixed.length ? ( +
    + {highlights.fixed.map((item, idx) => ( +
  • {item}
  • + ))} +
+ ) : ( +

No fixes listed in the latest release.

+ )} +
+
+

Other Changes

+ {highlights.other.length ? ( +
    + {highlights.other.map((item, idx) => ( +
  • {item}
  • + ))} +
+ ) : ( +

No other changes listed.

+ )} +
+
+ + {/* Divider */} +
+ + {/* Full Changelog section */} +
+
+

Full Changelog

+ + View raw file + +
+
+ {rendered.length ? rendered : ( +

No changelog available.

+ )} +
+
+
+ + ); +} diff --git a/src/resources/js/types/index.d.ts b/src/resources/js/types/index.d.ts index 2989559..b59ad93 100755 --- a/src/resources/js/types/index.d.ts +++ b/src/resources/js/types/index.d.ts @@ -29,6 +29,7 @@ export interface SharedData { ziggy: Config & { location: string }; sidebar_open: boolean; [key: string]: unknown; + changelog: string; } export interface User {