import { createSignal, Index, Show } from "solid-js" import { Dialog } from "@opencode/ui/dialog" import { Button } from "@opencode/ui/button" import { useDialog } from "@opencode/ui/context/dialog" import { useLanguage } from "@/runtime/i18n/language" import { useSettings } from "@/settings/model" export type Highlight = { title: string description: string media?: { type: "image" | "video" src: string alt?: string } } export function DialogReleaseNotes(props: { highlights: Highlight[] }) { const dialog = useDialog() const language = useLanguage() const settings = useSettings() const [index, setIndex] = createSignal(0) const total = () => props.highlights.length const last = () => Math.max(0, total() - 1) const feature = () => props.highlights[index()] ?? props.highlights[last()] const isFirst = () => index() === 0 const isLast = () => index() >= last() const paged = () => total() > 1 function handleNext() { if (isLast()) return setIndex(index() + 1) } function handleClose() { dialog.close() } function handleDisable() { settings.general.setReleaseNotes(false) handleClose() } function handleKeyDown(e: KeyboardEvent) { if (e.key === "Escape") { e.preventDefault() handleClose() return } if (!paged()) return if (e.key === "ArrowLeft" && !isFirst()) { e.preventDefault() setIndex(index() - 1) } if (e.key === "ArrowRight" && !isLast()) { e.preventDefault() setIndex(index() + 1) } } return (
{/* Left side - Text content */}
{/* Top section - feature content (fixed position from top) */}

{feature()?.title ?? ""}

{feature()?.description ?? ""}

{/* Spacer to push buttons to bottom */}
{/* Bottom section - buttons and indicators (fixed position) */}
{language.t("dialog.releaseNotes.action.next")} } >
{(_, i) => ( )}
{/* Right side - Media content (edge to edge) */} {(media) => (
} > {media().alt
)}
) }