@@ -2,6 +2,7 @@ import { TextField } from "@opencode-ai/ui/text-field"
22import { Logo } from "@opencode-ai/ui/logo"
33import { Button } from "@opencode-ai/ui/button"
44import { Component , Show } from "solid-js"
5+ import { createStore } from "solid-js/store"
56import { usePlatform } from "@/context/platform"
67import { Icon } from "@opencode-ai/ui/icon"
78
@@ -181,6 +182,25 @@ interface ErrorPageProps {
181182
182183export const ErrorPage : Component < ErrorPageProps > = ( props ) => {
183184 const platform = usePlatform ( )
185+ const [ store , setStore ] = createStore ( {
186+ checking : false ,
187+ version : undefined as string | undefined ,
188+ } )
189+
190+ async function checkForUpdates ( ) {
191+ if ( ! platform . checkUpdate ) return
192+ setStore ( "checking" , true )
193+ const result = await platform . checkUpdate ( )
194+ setStore ( "checking" , false )
195+ if ( result . updateAvailable && result . version ) setStore ( "version" , result . version )
196+ }
197+
198+ async function installUpdate ( ) {
199+ if ( ! platform . update || ! platform . restart ) return
200+ await platform . update ( )
201+ await platform . restart ( )
202+ }
203+
184204 return (
185205 < div class = "relative flex-1 h-screen w-screen min-h-0 flex flex-col items-center justify-center bg-background-base font-sans" >
186206 < div class = "w-2/3 max-w-3xl flex flex-col items-center justify-center gap-8" >
@@ -198,9 +218,25 @@ export const ErrorPage: Component<ErrorPageProps> = (props) => {
198218 label = "Error Details"
199219 hideLabel
200220 />
201- < Button size = "large" onClick = { platform . restart } >
202- Restart
203- </ Button >
221+ < div class = "flex items-center gap-3" >
222+ < Button size = "large" onClick = { platform . restart } >
223+ Restart
224+ </ Button >
225+ < Show when = { platform . checkUpdate } >
226+ < Show
227+ when = { store . version }
228+ fallback = {
229+ < Button size = "large" variant = "ghost" onClick = { checkForUpdates } disabled = { store . checking } >
230+ { store . checking ? "Checking..." : "Check for updates" }
231+ </ Button >
232+ }
233+ >
234+ < Button size = "large" onClick = { installUpdate } >
235+ Update to { store . version }
236+ </ Button >
237+ </ Show >
238+ </ Show >
239+ </ div >
204240 < div class = "flex flex-col items-center gap-2" >
205241 < div class = "flex items-center justify-center gap-1" >
206242 Please report this error to the OpenCode team
0 commit comments