11'use client'
22
3- import { ExternalLink } from 'lucide-react'
4- import { InstanceTerminalWorkspace } from '@/components/instances/instance-terminal-workspace '
3+ import { ExternalLink , LoaderCircle } from 'lucide-react'
4+ import { useState } from 'react '
55import { buttonVariants } from '@/components/ui/button'
66import type { Instance } from '@/types/instance'
77
@@ -13,21 +13,52 @@ export function InstanceDashboard({ instance }: { instance: Instance }) {
1313 : baseUrl
1414 : null
1515
16- return (
17- < section className = "flex flex-col gap-4" >
18- < InstanceTerminalWorkspace instance = { instance } />
16+ const [ loaded , setLoaded ] = useState ( false )
17+
18+ if ( ! dashboardUrl ) {
19+ return (
20+ < div className = "flex min-h-[28rem] items-center justify-center rounded-xl border bg-card p-8 text-center" >
21+ < div className = "max-w-sm space-y-3" >
22+ < h2 className = "text-base font-semibold" > Dashboard not available</ h2 >
23+ < p className = "text-sm text-muted-foreground" >
24+ This instance doesn't have a reachable dashboard URL yet. Wait for provisioning to complete, then refresh.
25+ </ p >
26+ </ div >
27+ </ div >
28+ )
29+ }
1930
20- { dashboardUrl && (
31+ return (
32+ < div className = "flex flex-col gap-3" >
33+ < div className = "flex items-center justify-end" >
2134 < a
2235 href = { dashboardUrl }
2336 target = "_blank"
2437 rel = "noopener noreferrer"
25- className = { buttonVariants ( { variant : 'outline' , size : 'sm' , className : 'w-fit' } ) }
38+ className = { buttonVariants ( { variant : 'outline' , size : 'sm' } ) }
2639 >
2740 < ExternalLink className = "h-4 w-4" />
28- Open Control UI
41+ Open in new tab
2942 </ a >
30- ) }
31- </ section >
43+ </ div >
44+
45+ < div className = "relative overflow-hidden rounded-xl border bg-card" >
46+ { ! loaded && (
47+ < div className = "absolute inset-0 z-10 flex items-center justify-center bg-card" >
48+ < div className = "flex items-center gap-2 text-sm text-muted-foreground" >
49+ < LoaderCircle className = "h-4 w-4 animate-spin" />
50+ Loading dashboard...
51+ </ div >
52+ </ div >
53+ ) }
54+ < iframe
55+ src = { dashboardUrl }
56+ className = "h-[calc(100dvh-14rem)] w-full bg-background"
57+ title = "OpenClaw Dashboard"
58+ allow = "clipboard-read; clipboard-write"
59+ onLoad = { ( ) => setLoaded ( true ) }
60+ />
61+ </ div >
62+ </ div >
3263 )
3364}
0 commit comments