wip: highlights

This commit is contained in:
adamelmore 2026-01-26 07:25:25 -06:00
commit 53ac394c68
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75

View file

@ -6,7 +6,7 @@ import { usePlatform } from "@/context/platform"
import { persisted } from "@/utils/persist"
import { DialogReleaseNotes, type Highlight } from "@/components/dialog-release-notes"
const CHANGELOG_URL = "https://opencode.ai/changelog.json"
const CHANGELOG_URL = "https://dev.opencode.ai/changelog.json"
type Store = {
version?: string
@ -81,6 +81,10 @@ function parseRelease(value: unknown): ParsedRelease | undefined {
}
function parseChangelog(value: unknown): ParsedRelease[] | undefined {
if (Array.isArray(value)) {
return value.map(parseRelease).filter((release): release is ParsedRelease => release !== undefined)
}
if (!isRecord(value)) return
if (!Array.isArray(value.releases)) return
@ -163,6 +167,7 @@ export const { use: useHighlights, provider: HighlightsProvider } = createSimple
if (!json) return
const releases = parseChangelog(json)
if (!releases) return
if (releases.length === 0) return
const highlights = sliceHighlights({
releases,
current: platform.version,