Skip to content

Commit

Permalink
feat: no tables found component
Browse files Browse the repository at this point in the history
  • Loading branch information
frectonz committed Jul 3, 2024
1 parent a9f478e commit 261d259
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion ui/src/routes/tables.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
import { CodeBlock, irBlack as CodeDarkTheme } from "react-code-blocks";

import { cn } from "@/lib/utils";
import { Card } from "@/components/ui/card";
import {
Card,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
import { useTheme } from "@/provider/theme.provider";
import { fetchTable, fetchTableData, fetchTables } from "@/api";
Expand All @@ -31,6 +36,17 @@ function Tables() {
const data = Route.useLoaderData();
const { table } = Route.useSearch();

if (data.tables.length === 0)
return (
<Card>
<CardHeader className="flex items-center">
<TableIcon className="mb-4 h-12 w-12 text-muted-foreground" />
<CardTitle>No Tables Found</CardTitle>
<CardDescription>The database has no tables.</CardDescription>
</CardHeader>
</Card>
);

const tab = table
? data.tables.findIndex(({ name }) => name === table).toString()
: "0";
Expand Down

0 comments on commit 261d259

Please sign in to comment.