-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSidebar.vue
More file actions
273 lines (257 loc) · 11.3 KB
/
Copy pathSidebar.vue
File metadata and controls
273 lines (257 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<script setup lang="ts">
import { ref } from 'vue'
const openOffcanvas = ref(true)
const openIcon = ref(true)
const openNone = ref(true)
const navItems = [
{ label: 'Jobs', icon: 'i-material-symbols-work-outline', badge: { label: '12', color: 'primary' as const, variant: 'soft' as const } },
{ label: 'Agents', icon: 'i-material-symbols-smart-toy-outline' },
{ label: 'Sessions', icon: 'i-material-symbols-terminal-outline' },
{ label: 'Runtimes', icon: 'i-material-symbols-memory-outline' },
{ label: 'Traces', icon: 'i-material-symbols-timeline-outline' },
{ label: 'Events', icon: 'i-material-symbols-event-note-outline', badge: { label: '3', color: 'warning' as const, variant: 'soft' as const } },
]
const footerItems = [
{ label: 'Settings', icon: 'i-material-symbols-settings-outline' },
{ label: 'Help', icon: 'i-material-symbols-help-outline' },
]
</script>
<template>
<div class="flex flex-col gap-8">
<!-- Collapsible: offcanvas (default) -->
<GallerySection title="Collapsible: offcanvas (default)">
<div class="w-full overflow-hidden rounded-lg border border-[var(--ui-border)] bg-[var(--ui-bg)]" style="height: 340px; display: flex; position: relative;">
<USidebar
v-model:open="openOffcanvas"
collapsible="offcanvas"
title="ARCP Console"
description="Agent Runtime Control"
:close="true"
style="position: relative;"
>
<div class="flex flex-col gap-1 p-2">
<UButton
v-for="item in navItems"
:key="item.label"
:icon="item.icon"
variant="ghost"
color="neutral"
size="sm"
class="justify-start w-full"
>
<span class="flex-1 text-left">{{ item.label }}</span>
<UBadge
v-if="item.badge"
:color="item.badge.color"
:variant="item.badge.variant"
:label="item.badge.label"
size="xs"
/>
</UButton>
</div>
<template #footer>
<div class="flex items-center gap-2 p-3 border-t border-[var(--ui-border)]">
<UAvatar icon="i-material-symbols-person-outline" size="xs" color="neutral" variant="soft" />
<span class="text-xs text-[var(--ui-text-muted)] truncate">agent@arcp.io</span>
</div>
</template>
</USidebar>
<div class="flex flex-1 flex-col gap-3 p-5 overflow-auto">
<UButton
:icon="openOffcanvas ? 'i-material-symbols-menu-open' : 'i-material-symbols-menu'"
variant="ghost"
color="neutral"
size="sm"
class="self-start"
@click="openOffcanvas = !openOffcanvas"
>
{{ openOffcanvas ? 'Close sidebar' : 'Open sidebar' }}
</UButton>
<UAlert
color="info"
variant="soft"
title="Job j-9f3a running"
description="Agent session active — lease valid for 42 s."
icon="i-material-symbols-pending-outline"
/>
<UAlert
color="success"
variant="soft"
title="Job j-7c2b completed"
description="Runtime processed 840 events in 1.9 s."
icon="i-material-symbols-check-circle-outline"
/>
</div>
</div>
</GallerySection>
<!-- Collapsible: icon -->
<GallerySection title="Collapsible: icon (shrinks to icon-only)">
<div class="w-full overflow-hidden rounded-lg border border-[var(--ui-border)] bg-[var(--ui-bg)]" style="height: 340px; display: flex; position: relative;">
<USidebar
v-model:open="openIcon"
collapsible="icon"
:rail="true"
style="position: relative;"
>
<template #default="{ state }">
<div class="flex flex-col gap-1 p-2">
<UButton
v-for="item in navItems"
:key="item.label"
:icon="item.icon"
variant="ghost"
color="neutral"
size="sm"
:class="state === 'collapsed' ? 'justify-center' : 'justify-start w-full'"
>
<span v-if="state === 'expanded'" class="flex-1 text-left">{{ item.label }}</span>
</UButton>
</div>
</template>
<template #footer="{ state }">
<div
class="flex items-center gap-2 p-3 border-t border-[var(--ui-border)]"
:class="state === 'collapsed' ? 'justify-center' : ''"
>
<UAvatar icon="i-material-symbols-person-outline" size="xs" color="neutral" variant="soft" />
<span v-if="state === 'expanded'" class="text-xs text-[var(--ui-text-muted)] truncate">agent@arcp.io</span>
</div>
</template>
</USidebar>
<div class="flex flex-1 flex-col gap-3 p-5 overflow-auto">
<UButton
:icon="openIcon ? 'i-material-symbols-menu-open' : 'i-material-symbols-menu'"
variant="ghost"
color="neutral"
size="sm"
class="self-start"
@click="openIcon = !openIcon"
>
{{ openIcon ? 'Collapse' : 'Expand' }}
</UButton>
<p class="text-sm text-[var(--ui-text-muted)]">
Click the rail handle or button to toggle icon-only mode. Navigation labels hide when collapsed.
</p>
<UBadge color="primary" variant="soft" icon="i-material-symbols-bolt">
3 runtimes active
</UBadge>
</div>
</div>
</GallerySection>
<!-- Collapsible: none (always visible) -->
<GallerySection title="Collapsible: none (always visible)">
<div class="w-full overflow-hidden rounded-lg border border-[var(--ui-border)] bg-[var(--ui-bg)]" style="height: 300px; display: flex; position: relative;">
<USidebar
collapsible="none"
title="Control Plane"
style="position: relative; width: 200px; flex-shrink: 0;"
>
<div class="flex flex-col gap-1 p-2">
<UButton
v-for="item in navItems.slice(0, 4)"
:key="item.label"
:icon="item.icon"
variant="ghost"
color="neutral"
size="sm"
class="justify-start w-full"
>
{{ item.label }}
</UButton>
</div>
</USidebar>
<div class="flex flex-1 flex-col gap-3 p-5 overflow-auto">
<p class="text-sm text-[var(--ui-text-muted)]">
Non-collapsible sidebar — always rendered inline with no toggle.
</p>
<div class="flex flex-col gap-2">
<div v-for="item in footerItems" :key="item.label" class="flex items-center gap-2 text-sm text-[var(--ui-text-muted)]">
<UIcon :name="item.icon" class="h-4 w-4" />
{{ item.label }}
</div>
</div>
</div>
</div>
</GallerySection>
<!-- Right-side sidebar -->
<GallerySection title="Side: right">
<div class="w-full overflow-hidden rounded-lg border border-[var(--ui-border)] bg-[var(--ui-bg)]" style="height: 280px; display: flex; position: relative;">
<div class="flex flex-1 flex-col gap-3 p-5 overflow-auto">
<p class="text-sm font-medium text-[var(--ui-text)]">Job trace viewer</p>
<div class="flex flex-col gap-2">
<div v-for="(span, i) in [
{ name: 'session.start', dur: '12ms', color: 'primary' },
{ name: 'lease.acquire', dur: '3ms', color: 'info' },
{ name: 'agent.execute', dur: '840ms', color: 'success' },
{ name: 'runtime.flush', dur: '8ms', color: 'neutral' },
]" :key="i" class="flex items-center gap-3 text-xs">
<UBadge :color="span.color" variant="soft" size="xs">{{ span.name }}</UBadge>
<span class="text-[var(--ui-text-muted)]">{{ span.dur }}</span>
</div>
</div>
</div>
<USidebar
collapsible="none"
side="right"
title="Details"
style="position: relative; width: 180px; flex-shrink: 0; border-left: 1px solid var(--ui-border);"
>
<div class="flex flex-col gap-2 p-3 text-xs">
<div class="flex flex-col gap-1">
<span class="text-[var(--ui-text-muted)] uppercase tracking-wide text-[10px]">Job ID</span>
<span class="font-mono text-[var(--ui-text)]">j-9f3a2c</span>
</div>
<div class="flex flex-col gap-1">
<span class="text-[var(--ui-text-muted)] uppercase tracking-wide text-[10px]">Status</span>
<UBadge color="success" variant="soft" size="xs">completed</UBadge>
</div>
<div class="flex flex-col gap-1">
<span class="text-[var(--ui-text-muted)] uppercase tracking-wide text-[10px]">Runtime</span>
<span class="text-[var(--ui-text)]">arcp-v2</span>
</div>
<div class="flex flex-col gap-1">
<span class="text-[var(--ui-text-muted)] uppercase tracking-wide text-[10px]">Duration</span>
<span class="text-[var(--ui-text)]">863ms</span>
</div>
</div>
</USidebar>
</div>
</GallerySection>
<!-- With close button prop -->
<GallerySection title="With close button + actions slot">
<div class="w-full overflow-hidden rounded-lg border border-[var(--ui-border)] bg-[var(--ui-bg)]" style="height: 280px; display: flex; position: relative;">
<USidebar
collapsible="offcanvas"
title="Agent Sessions"
description="Active leases"
:close="{ color: 'neutral', variant: 'ghost', size: 'xs' }"
close-icon="i-material-symbols-close"
style="position: relative;"
>
<template #actions>
<UButton icon="i-material-symbols-add" color="primary" variant="ghost" size="xs" />
</template>
<div class="flex flex-col gap-2 p-3">
<div v-for="session in [
{ id: 'sess-a1', agent: 'agent-v2', lease: '58s', status: 'success' },
{ id: 'sess-b3', agent: 'agent-v2', lease: '12s', status: 'warning' },
{ id: 'sess-c7', agent: 'agent-v1', lease: 'expired', status: 'error' },
]" :key="session.id" class="flex items-center gap-2 rounded-md p-2 hover:bg-[var(--ui-bg-elevated)] text-xs">
<UIcon name="i-material-symbols-terminal-outline" :class="`text-${session.status} h-4 w-4 shrink-0`" />
<div class="flex-1 min-w-0">
<p class="font-medium text-[var(--ui-text)] truncate">{{ session.id }}</p>
<p class="text-[var(--ui-text-muted)] truncate">{{ session.agent }} · {{ session.lease }}</p>
</div>
<UBadge :color="session.status" variant="soft" size="xs">{{ session.lease === 'expired' ? 'expired' : 'active' }}</UBadge>
</div>
</div>
</USidebar>
<div class="flex flex-1 flex-col gap-3 p-5 overflow-auto">
<p class="text-sm text-[var(--ui-text-muted)]">
Sidebar with a styled close button and an actions slot button. Use the X to dismiss on desktop.
</p>
</div>
</div>
</GallerySection>
</div>
</template>