Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

empty state

Guy Ben-Aharon7d82e75f7e45
diff --git a/src/assets/empty_state.png b/src/assets/empty_state.png
new file mode 100644
index 00000000..7d8153a1
Binary files /dev/null and b/src/assets/empty_state.png differ
diff --git a/src/components/empty-state/empty-state.tsx b/src/components/empty-state/empty-state.tsx
new file mode 100644
index 00000000..eca31325
--- /dev/null
+++ b/src/components/empty-state/empty-state.tsx
@@ -0,0 +1,27 @@
+import React, { forwardRef } from 'react';
+import EmptyStateImage from '@/assets/empty_state.png';
+import { Label } from '@/components/label/label';
+import { cn } from '@/lib/utils';
+
+export interface EmptyStateProps {
+ title: string;
+ description: string;
+}
+
+export const EmptyState = forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement> & EmptyStateProps
+>(({ title, description, className }) => (
+ <div
+ className={cn(
+ 'flex flex-col items-center justify-center space-y-1',
+ className
+ )}
+ >
+ <img src={EmptyStateImage} alt="Empty state" className="w-32" />
+ <Label className="text-md">{title}</Label>
+ <Label className="font-normal text-muted-foreground text-sm">
+ {description}
+ </Label>
+ </div>
+));
diff --git a/src/pages/editor-page/side-panel/relationships-section/relationships-section.tsx b/src/pages/editor-page/side-panel/relationships-section/relationships-section.tsx
index dbd0c586..e0b51b80 100644
--- a/src/pages/editor-page/side-panel/relationships-section/relationships-section.tsx
+++ b/src/pages/editor-page/side-panel/relationships-section/relationships-section.tsx
@@ -6,6 +6,7 @@ import { RelationshipList } from './relationship-list/relationship-list';
import { useChartDB } from '@/hooks/use-chartdb';
import { DBRelationship } from '@/lib/domain/db-relationship';
import { useLayout } from '@/hooks/use-layout';
+import { EmptyState } from '@/components/empty-state/empty-state';
export interface RelationshipsSectionProps {}
@@ -48,7 +49,15 @@ export const RelationshipsSection: React.FC<RelationshipsSectionProps> = () => {
</div>
<div className="flex flex-col flex-1 overflow-scroll">
{/* <ScrollArea className="h-full"> */}
- <RelationshipList relationships={filteredRelationships} />
+ {relationships.length === 0 ? (
+ <EmptyState
+ title="No relationships"
+ description="Create a relationship to connect tables"
+ className="mt-20"
+ />
+ ) : (
+ <RelationshipList relationships={filteredRelationships} />
+ )}
{/* </ScrollArea> */}
</div>
</section>
diff --git a/src/pages/editor-page/side-panel/tables-section/tables-section.tsx b/src/pages/editor-page/side-panel/tables-section/tables-section.tsx
index 48c9ada4..a5e9db90 100644
--- a/src/pages/editor-page/side-panel/tables-section/tables-section.tsx
+++ b/src/pages/editor-page/side-panel/tables-section/tables-section.tsx
@@ -7,6 +7,7 @@ import { Input } from '@/components/input/input';
import { DBTable } from '@/lib/domain/db-table';
import { useChartDB } from '@/hooks/use-chartdb';
import { useLayout } from '@/hooks/use-layout';
+import { EmptyState } from '@/components/empty-state/empty-state';
export interface TablesSectionProps {}
@@ -55,7 +56,15 @@ export const TablesSection: React.FC<TablesSectionProps> = () => {
</div>
<div className="flex flex-col flex-1 overflow-scroll">
{/* <ScrollArea className="h-full !max-w-full"> */}
- <TableList tables={filteredTables} />
+ {tables.length === 0 ? (
+ <EmptyState
+ title="No tables"
+ description="Create a table to get started"
+ className="mt-20"
+ />
+ ) : (
+ <TableList tables={filteredTables} />
+ )}
{/* </ScrollArea> */}
</div>
</section>
diff --git a/src/pages/editor-page/top-navbar/top-navbar.tsx b/src/pages/editor-page/top-navbar/top-navbar.tsx
index 2c399708..3b814bff 100644
--- a/src/pages/editor-page/top-navbar/top-navbar.tsx
+++ b/src/pages/editor-page/top-navbar/top-navbar.tsx
@@ -247,7 +247,6 @@ export const TopNavbar: React.FC<TopNavbarProps> = () => {
</MenubarSub>
<MenubarSeparator />
<MenubarItem
- className="!text-red-700"
onClick={() =>
showAlert({
title: 'Delete Diagram',