@@ -3,7 +3,16 @@ import ActionIconButton from '@antfu/design/components/Action/ActionIconButton.v
33import LayoutTabs from ' @antfu/design/components/Layout/LayoutTabs.vue'
44import LayoutToolbar from ' @antfu/design/components/Layout/LayoutToolbar.vue'
55import { computed , onMounted , ref } from ' vue'
6- import { connectionIndicator } from ' ../../../../design/design'
6+ import {
7+ button ,
8+ connectionBody ,
9+ connectionDetail ,
10+ connectionGlyph ,
11+ connectionIndicator ,
12+ connectionPanel ,
13+ connectionState ,
14+ connectionTitle ,
15+ } from ' ../../../../design/design'
716import AgentSmart from ' ./components/AgentSmart.vue'
817import FunctionsSmart from ' ./components/FunctionsSmart.vue'
918import HistorySmart from ' ./components/HistorySmart.vue'
@@ -20,6 +29,10 @@ const { refresh, loading } = useRefresh()
2029// connection is not live; when connected it renders nothing.
2130const conn = computed (() => connectionIndicator (connection .status ))
2231
32+ // The shared full-panel connection state takes over the body until the client
33+ // is connected.
34+ const connState = computed (() => connectionState (connection .status ))
35+
2336const tabs: { value: Tab , label: string , icon: string }[] = [
2437 { value: ' functions' , label: ' Functions' , icon: ' i-ph-function-duotone' },
2538 { value: ' state' , label: ' State' , icon: ' i-ph-database-duotone' },
@@ -67,32 +80,24 @@ function reload(): void {
6780 </LayoutToolbar >
6881
6982 <main class =" app-body" >
70- <div v-if =" connection.status === 'error'" class =" center error" >
71- <span class =" i-ph-warning-octagon-duotone state-glyph" />
72- <div >Failed to connect to the devframe backend.</div >
73- <code v-if =" connection.error" >{{ connection.error }}</code >
74- <button type =" button" class =" btn-action" @click =" reload" >
75- Reload
76- </button >
77- </div >
78- <div v-else-if =" connection.status === 'disconnected'" class =" center error" >
79- <span class =" i-ph-plugs-duotone state-glyph" />
80- <div >Disconnected from the devframe backend.</div >
81- <button type =" button" class =" btn-action" @click =" reload" >
83+ <div v-if =" connState" :class =" connectionPanel('h-full')" >
84+ <span :class =" [connState.icon, connectionGlyph(connState.spin)]" />
85+ <div class =" flex flex-col gap-1" >
86+ <p :class =" connectionTitle()" >
87+ {{ connState.title }}
88+ </p >
89+ <p :class =" connectionBody()" >
90+ {{ connState.body }}
91+ </p >
92+ <p v-if =" connection.error && connection.status === 'error'" :class =" connectionDetail()" >
93+ {{ connection.error }}
94+ </p >
95+ </div >
96+ <button v-if =" connState.reloadable" type =" button" :class =" button({ variant: 'primary', size: 'sm' })" @click =" reload" >
97+ <span class =" i-ph-arrow-clockwise" />
8298 Reload
8399 </button >
84100 </div >
85- <div v-else-if =" connection.status === 'unauthorized'" class =" center error" >
86- <span class =" i-ph-lock-key-duotone state-glyph" />
87- <div >Not authorized. Reopen the link printed by your dev server, then reload.</div >
88- <button type =" button" class =" btn-action" @click =" reload" >
89- Reload
90- </button >
91- </div >
92- <div v-else-if =" !connection.connected" class =" center" >
93- <span class =" i-ph-plugs-connected-duotone state-glyph" />
94- Connecting to devframe…
95- </div >
96101 <template v-else >
97102 <FunctionsSmart v-if =" tab === ' functions' " />
98103 <StateSmart v-else-if =" tab === ' state' " />
0 commit comments