Skip to content

Commit 89f70b2

Browse files
feat(devtools): add EmptyState component for table/list empty states
Create reusable EmptyState component with icon, title, and message props. Replace inline empty state divs across 6 pages (batches, groups, index, jobs, queues) with the component. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 325fb94 commit 89f70b2

6 files changed

Lines changed: 59 additions & 9 deletions

File tree

packages/devtools/pages/batches.stx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@
102102
</div>
103103

104104
<!-- Empty state -->
105-
<div @show='!loading() && !errorMessage() && batches().length === 0' class='text-center py-12 text-zinc-500 text-[0.8125rem] bg-[#141419] border border-zinc-800 rounded-lg'>
106-
No batches found. Create a batch to see it here.
105+
<div @show='!loading() && !errorMessage() && batches().length === 0'>
106+
<EmptyState icon="layers" title="No batches found" message="Create a batch to see it here." />
107107
</div>
108108

109109
<!-- Batch cards grid -->
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<script>
2+
const icon: string = 'inbox'
3+
const title: string = 'No data found'
4+
const message: string = ''
5+
</script>
6+
7+
<div class="flex flex-col items-center justify-center py-16 px-6 text-center">
8+
@if(icon === 'inbox')
9+
<svg class="w-12 h-12 text-zinc-700 mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
10+
<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/>
11+
<path d="M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>
12+
</svg>
13+
@elseif(icon === 'search')
14+
<svg class="w-12 h-12 text-zinc-700 mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
15+
<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
16+
</svg>
17+
@elseif(icon === 'layers')
18+
<svg class="w-12 h-12 text-zinc-700 mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
19+
<polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/>
20+
</svg>
21+
@elseif(icon === 'users')
22+
<svg class="w-12 h-12 text-zinc-700 mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
23+
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>
24+
</svg>
25+
@elseif(icon === 'activity')
26+
<svg class="w-12 h-12 text-zinc-700 mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
27+
<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>
28+
</svg>
29+
@elseif(icon === 'git-branch')
30+
<svg class="w-12 h-12 text-zinc-700 mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
31+
<line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>
32+
</svg>
33+
@else
34+
<svg class="w-12 h-12 text-zinc-700 mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
35+
<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/>
36+
<path d="M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>
37+
</svg>
38+
@endif
39+
40+
<h3 class="text-sm font-medium text-zinc-400 mb-1">{{ title }}</h3>
41+
@if(message)
42+
<p class="text-xs text-zinc-600 max-w-[280px]">{{ message }}</p>
43+
@endif
44+
</div>

packages/devtools/pages/groups.stx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@
8989
</div>
9090

9191
<!-- Empty state -->
92-
<div @show='!loading() && !errorMessage() && filteredGroups().length === 0' class='text-center py-12 text-zinc-500 text-[0.8125rem]'>
93-
No groups found. Jobs assigned to groups will appear here.
92+
<div @show='!loading() && !errorMessage() && filteredGroups().length === 0'>
93+
<EmptyState icon="users" title="No groups found" message="Jobs assigned to groups will appear here." />
9494
</div>
9595

9696
<!-- Group cards grid -->

packages/devtools/pages/index.stx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@
269269
<div @show='loading()' class='text-center py-8 text-zinc-500 text-sm'>Loading recent jobs...</div>
270270

271271
<!-- Empty state -->
272-
<div @show='!loading() && recentJobs().length === 0' class='text-center py-8 text-zinc-500 text-sm'>No recent jobs to display.</div>
272+
<div @show='!loading() && recentJobs().length === 0'>
273+
<EmptyState icon="inbox" title="No recent jobs" message="Jobs will appear here once dispatched." />
274+
</div>
273275

274276
<!-- Jobs table -->
275277
<table @show='!loading() && recentJobs().length > 0' class='w-full border-collapse'>
@@ -307,7 +309,9 @@
307309
<div @show='loading()' class='text-center py-8 text-zinc-500 text-sm'>Loading queues...</div>
308310

309311
<!-- Empty state -->
310-
<div @show='!loading() && queues().length === 0' class='text-center py-8 text-zinc-500 text-sm'>No queues found.</div>
312+
<div @show='!loading() && queues().length === 0'>
313+
<EmptyState icon="layers" title="No queues found" message="Start a queue worker to see queues here." />
314+
</div>
311315

312316
<!-- Queue cards -->
313317
<div @show='!loading() && queues().length > 0' class='flex flex-col gap-3'>

packages/devtools/pages/jobs.stx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@
187187
<div :if='loading()' class='text-center py-12 text-zinc-500 text-sm'>Loading jobs...</div>
188188

189189
<!-- Empty state -->
190-
<div :if='!loading() && filteredJobs().length === 0' class='text-center py-12 text-zinc-500 text-sm'>No jobs found matching the current filters.</div>
190+
<div :if='!loading() && filteredJobs().length === 0'>
191+
<EmptyState icon="search" title="No jobs found" message="Try adjusting your search or filters." />
192+
</div>
191193

192194
<!-- Table -->
193195
<table :if='!loading() && filteredJobs().length > 0' class='w-full border-collapse'>

packages/devtools/pages/queues.stx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090
</div>
9191

9292
<!-- Empty state -->
93-
<div @show='!loading() && !errorMessage() && filteredQueues().length === 0' class='text-center py-12 text-zinc-500 text-sm bg-[#141419] border border-zinc-800 rounded-lg'>
94-
No queues found matching your search.
93+
<div @show='!loading() && !errorMessage() && filteredQueues().length === 0'>
94+
<EmptyState icon="search" title="No queues found" message="Try adjusting your search criteria." />
9595
</div>
9696

9797
<!-- Queue cards grid -->

0 commit comments

Comments
 (0)