Skip to content

Commit 3077d81

Browse files
committed
feat: unified empty state
1 parent 5fe1dc1 commit 3077d81

File tree

11 files changed

+392
-366
lines changed

11 files changed

+392
-366
lines changed

apps/dashboard/app/(main)/observability/database/[id]/plugins/_components/extension-empty-state.tsx

Lines changed: 0 additions & 109 deletions
This file was deleted.

apps/dashboard/app/(main)/observability/database/[id]/plugins/_components/extension-tabs.tsx

Lines changed: 95 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
'use client';
22

3+
import { DatabaseIcon, MagnifyingGlassIcon } from '@phosphor-icons/react';
4+
import { EmptyState } from '@/components/empty-state';
35
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
46
import { ExtensionCard } from './extension-card';
5-
import { ExtensionEmptyState } from './extension-empty-state';
67

78
interface Extension {
89
name: string;
@@ -77,13 +78,56 @@ export function ExtensionTabs({
7778
value="installed"
7879
>
7980
{installedExtensions.length === 0 ? (
80-
<ExtensionEmptyState
81-
canManage={canManage}
82-
onClearSearch={onClearSearch}
83-
onInstallExtension={onInstallExtension}
84-
searchTerm={searchTerm}
85-
type={hasSearchTerm ? 'search' : 'installed'}
86-
/>
81+
hasSearchTerm ? (
82+
<EmptyState
83+
action={
84+
onClearSearch
85+
? {
86+
label: 'Clear Search',
87+
onClick: onClearSearch,
88+
variant: 'outline',
89+
}
90+
: undefined
91+
}
92+
description={
93+
searchTerm
94+
? `No extensions match "${searchTerm}". Try adjusting your search terms.`
95+
: 'No extensions match your search criteria.'
96+
}
97+
icon={
98+
<MagnifyingGlassIcon
99+
className="h-12 w-12 text-muted-foreground"
100+
size={16}
101+
weight="duotone"
102+
/>
103+
}
104+
showPlusBadge={false}
105+
title="No Extensions Found"
106+
variant="simple"
107+
/>
108+
) : (
109+
<EmptyState
110+
action={
111+
canManage && onInstallExtension
112+
? {
113+
label: 'Install Extension',
114+
onClick: onInstallExtension,
115+
}
116+
: undefined
117+
}
118+
description="Get started by installing your first PostgreSQL extension to enhance your database capabilities."
119+
icon={
120+
<DatabaseIcon
121+
className="h-12 w-12 text-muted-foreground"
122+
size={16}
123+
weight="duotone"
124+
/>
125+
}
126+
showPlusBadge={false}
127+
title="No Extensions Installed"
128+
variant="simple"
129+
/>
130+
)
87131
) : (
88132
<div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
89133
{installedExtensions.map((ext) => (
@@ -109,12 +153,49 @@ export function ExtensionTabs({
109153
value="available"
110154
>
111155
{availableExtensions.length === 0 ? (
112-
<ExtensionEmptyState
113-
canManage={canManage}
114-
onClearSearch={onClearSearch}
115-
searchTerm={searchTerm}
116-
type={hasSearchTerm ? 'search' : 'available'}
117-
/>
156+
hasSearchTerm ? (
157+
<EmptyState
158+
action={
159+
onClearSearch
160+
? {
161+
label: 'Clear Search',
162+
onClick: onClearSearch,
163+
variant: 'outline',
164+
}
165+
: undefined
166+
}
167+
description={
168+
searchTerm
169+
? `No extensions match "${searchTerm}". Try adjusting your search terms.`
170+
: 'No extensions match your search criteria.'
171+
}
172+
icon={
173+
<MagnifyingGlassIcon
174+
className="h-12 w-12 text-muted-foreground"
175+
size={16}
176+
weight="duotone"
177+
/>
178+
}
179+
showPlusBadge={false}
180+
title="No Extensions Found"
181+
variant="simple"
182+
/>
183+
) : (
184+
<EmptyState
185+
action={undefined}
186+
description="All available extensions have been installed or there are no extensions available for installation."
187+
icon={
188+
<DatabaseIcon
189+
className="h-12 w-12 text-muted-foreground"
190+
size={16}
191+
weight="duotone"
192+
/>
193+
}
194+
showPlusBadge={false}
195+
title="No Available Extensions"
196+
variant="simple"
197+
/>
198+
)
118199
) : (
119200
<div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
120201
{availableExtensions.map((ext) => (

apps/dashboard/app/(main)/observability/database/_components/connections-list.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
'use client';
22

3+
import { DatabaseIcon } from '@phosphor-icons/react';
4+
import { EmptyState } from '@/components/empty-state';
35
import type { DbConnection } from '@/hooks/use-db-connections';
46
import { ConnectionCard } from './connection-card';
5-
import { EmptyState } from './empty-state';
67

78
interface ConnectionsListProps {
89
connections: DbConnection[];
@@ -24,7 +25,24 @@ export function ConnectionsList({
2425
}
2526

2627
if (connections.length === 0) {
27-
return <EmptyState onCreateConnection={onCreate} />;
28+
return (
29+
<EmptyState
30+
action={{
31+
label: 'Create Your First Connection',
32+
onClick: onCreate,
33+
}}
34+
description="Connect your databases to start monitoring performance, tracking queries, and gaining insights into your database health across all environments."
35+
icon={
36+
<DatabaseIcon
37+
className="h-16 w-16 text-primary"
38+
size={16}
39+
weight="duotone"
40+
/>
41+
}
42+
title="No connections yet"
43+
variant="default"
44+
/>
45+
);
2846
}
2947

3048
return (

apps/dashboard/app/(main)/observability/database/_components/empty-state.tsx

Lines changed: 0 additions & 61 deletions
This file was deleted.

apps/dashboard/app/(main)/websites/[id]/flags/_components/empty-state.tsx

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)