Skip to content

Open source alternative to Semrush and Ahrefs

Put the reports table and remaining tables in the shared table card (EVE-366) (#776)

Carter Smith9b75e6c23730
diff --git a/src/client/components/table/DataTable.tsx b/src/client/components/table/DataTable.tsx
index 597eb879..417b6d34 100644
--- a/src/client/components/table/DataTable.tsx
+++ b/src/client/components/table/DataTable.tsx
@@ -24,6 +24,7 @@ import { Skeleton } from "@/client/components/ui/skeleton";
import {
Table,
TableBody,
+ TableCard,
TableCell,
TableHead,
TableHeader,
@@ -180,7 +181,7 @@ export function DataTable<TData>({
const rows = table.getRowModel().rows;
return (
- <div className="overflow-hidden rounded-xl border border-border bg-card">
+ <TableCard>
{toolbar}
{error ? <div className="p-4">{error}</div> : null}
{error && !isLoading && rows.length === 0 ? null : (
@@ -191,7 +192,7 @@ export function DataTable<TData>({
}
>
{table.getHeaderGroups().map((headerGroup) => (
- <TableRow key={headerGroup.id} className="hover:bg-transparent">
+ <TableRow key={headerGroup.id}>
{headerGroup.headers.map((header) => (
<TableHead
key={header.id}
@@ -287,6 +288,6 @@ export function DataTable<TData>({
</Table>
)}
{footer}
- </div>
+ </TableCard>
);
}
diff --git a/src/client/components/ui/table.tsx b/src/client/components/ui/table.tsx
index 5ebd4b5b..77bdb94e 100644
--- a/src/client/components/ui/table.tsx
+++ b/src/client/components/ui/table.tsx
@@ -5,6 +5,20 @@ import { cn } from "cn";
// page background in the light theme, so it would not show on a card.
// Cells wrap, because tables hold long URLs and titles.
+/** The card around a table and its toolbar or footer. The table runs edge to edge. */
+function TableCard({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="table-card"
+ className={cn(
+ "overflow-hidden rounded-xl border border-border bg-card",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
function Table({
className,
containerClassName,
@@ -28,7 +42,10 @@ function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
return (
<thead
data-slot="table-header"
- className={cn("[&_tr]:border-b [&_tr]:border-border", className)}
+ className={cn(
+ "[&_tr]:border-b [&_tr]:border-border [&_tr]:hover:bg-transparent",
+ className,
+ )}
{...props}
/>
);
@@ -111,6 +128,7 @@ function TableCaption({
export {
Table,
+ TableCard,
TableHeader,
TableBody,
TableFooter,
diff --git a/src/client/features/audit/launch/AuditHistorySection.tsx b/src/client/features/audit/launch/AuditHistorySection.tsx
index f37b64c6..454a486e 100644
--- a/src/client/features/audit/launch/AuditHistorySection.tsx
+++ b/src/client/features/audit/launch/AuditHistorySection.tsx
@@ -5,18 +5,14 @@ import type { getAuditHistory } from "@/serverFunctions/audit";
import { EmptyState } from "@/client/components/EmptyState";
import { QueryState } from "@/client/components/QueryState";
import { RowActionsMenu } from "@/client/components/RowActionsMenu";
+import { DataTableToolbar } from "@/client/components/table/DataTableToolbar";
import { Badge } from "@/client/components/ui/badge";
import { Button } from "@/client/components/ui/button";
-import {
- Card,
- CardContent,
- CardHeader,
- CardTitle,
-} from "@/client/components/ui/card";
import { DropdownMenuItem } from "@/client/components/ui/dropdown-menu";
import {
Table,
TableBody,
+ TableCard,
TableCell,
TableHead,
TableHeader,
@@ -65,57 +61,53 @@ function AuditHistoryTable({
}
return (
- <Card>
- <CardHeader>
- <CardTitle>
- <h2>Previous Audits</h2>
- </CardTitle>
- </CardHeader>
- <CardContent>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Date</TableHead>
- <TableHead>URL</TableHead>
- <TableHead>Status</TableHead>
- <TableHead>Pages</TableHead>
- <TableHead>Lighthouse</TableHead>
- <TableHead />
+ <TableCard>
+ <DataTableToolbar>
+ <h2 className="text-sm font-semibold">Previous Audits</h2>
+ </DataTableToolbar>
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Date</TableHead>
+ <TableHead>URL</TableHead>
+ <TableHead>Status</TableHead>
+ <TableHead>Pages</TableHead>
+ <TableHead>Lighthouse</TableHead>
+ <TableHead />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {history.map((audit) => (
+ <TableRow key={audit.id} className="group">
+ <TableCell className="text-xs text-muted-foreground">
+ {formatDate(audit.startedAt)}
+ </TableCell>
+ <TableCell className="max-w-[220px] truncate">
+ {audit.startUrl}
+ </TableCell>
+ <TableCell>
+ <StatusBadge status={audit.status} />
+ </TableCell>
+ <TableCell>{audit.pagesTotal || audit.pagesCrawled}</TableCell>
+ <TableCell>
+ {audit.ranLighthouse ? (
+ <Badge variant="outline" size="sm">
+ Yes
+ </Badge>
+ ) : null}
+ </TableCell>
+ <TableCell>
+ <HistoryActions
+ projectId={projectId}
+ auditId={audit.id}
+ onDelete={onDelete}
+ />
+ </TableCell>
</TableRow>
- </TableHeader>
- <TableBody>
- {history.map((audit) => (
- <TableRow key={audit.id} className="group">
- <TableCell className="text-xs text-muted-foreground">
- {formatDate(audit.startedAt)}
- </TableCell>
- <TableCell className="max-w-[220px] truncate">
- {audit.startUrl}
- </TableCell>
- <TableCell>
- <StatusBadge status={audit.status} />
- </TableCell>
- <TableCell>{audit.pagesTotal || audit.pagesCrawled}</TableCell>
- <TableCell>
- {audit.ranLighthouse ? (
- <Badge variant="outline" size="sm">
- Yes
- </Badge>
- ) : null}
- </TableCell>
- <TableCell>
- <HistoryActions
- projectId={projectId}
- auditId={audit.id}
- onDelete={onDelete}
- />
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- </CardContent>
- </Card>
+ ))}
+ </TableBody>
+ </Table>
+ </TableCard>
);
}
diff --git a/src/client/features/lighthouse/issues/LighthouseIssuesParts.tsx b/src/client/features/lighthouse/issues/LighthouseIssuesParts.tsx
index 691c9b7a..ffca4d5a 100644
--- a/src/client/features/lighthouse/issues/LighthouseIssuesParts.tsx
+++ b/src/client/features/lighthouse/issues/LighthouseIssuesParts.tsx
@@ -150,7 +150,7 @@ export function LighthouseIssuesToolbar({
];
return (
- <div className="sticky top-0 z-[2] -mx-2 px-2 py-2 bg-card/95 backdrop-blur-sm border-b border-border">
+ <div className="border-b border-border px-4 py-2">
<div className="flex flex-wrap items-center justify-between gap-3">
<CategoryTabs
category={category}
@@ -217,11 +217,11 @@ export function LighthouseIssueList({
emptyMessage?: string;
}) {
if (isLoading) {
- return <Spinner label="Loading issues..." />;
+ return <Spinner label="Loading issues..." className="p-4" />;
}
if (!issues.length) {
return (
- <p className="text-sm text-muted-foreground">
+ <p className="p-4 text-sm text-muted-foreground">
{emptyMessage ?? "No actionable issues for this category."}
</p>
);
@@ -229,7 +229,7 @@ export function LighthouseIssueList({
return (
<Table>
<TableHeader>
- <TableRow className="hover:bg-transparent">
+ <TableRow>
<TableHead className="w-8" />
<TableHead className="w-24">Severity</TableHead>
<TableHead>Issue</TableHead>
diff --git a/src/client/features/lighthouse/issues/LighthouseIssuesScreen.tsx b/src/client/features/lighthouse/issues/LighthouseIssuesScreen.tsx
index 0d10b485..c67cfed8 100644
--- a/src/client/features/lighthouse/issues/LighthouseIssuesScreen.tsx
+++ b/src/client/features/lighthouse/issues/LighthouseIssuesScreen.tsx
@@ -7,7 +7,7 @@ import {
} from "@/serverFunctions/lighthouse";
import { downloadFile } from "@/client/lib/download";
import { QueryError } from "@/client/components/QueryState";
-import { Card, CardContent } from "@/client/components/ui/card";
+import { TableCard } from "@/client/components/ui/table";
import { getErrorCode } from "@/client/lib/error-messages";
import { exportRows } from "@/client/lib/exportRows";
import type { CategoryTab, ExportPayload, LighthouseIssue } from "./types";
@@ -99,9 +99,9 @@ export function LighthouseIssuesScreen({
severityCounts={severityCounts}
/>
- <Card>
- <CardContent className="space-y-4">
- {issuesQuery.isError ? (
+ <TableCard>
+ {issuesQuery.isError ? (
+ <div className="p-4">
<QueryError
error={issuesQuery.error}
fallback="Failed to load Lighthouse issues."
@@ -113,36 +113,36 @@ export function LighthouseIssuesScreen({
}
isRetrying={issuesQuery.isFetching}
/>
- ) : null}
+ </div>
+ ) : null}
- <LighthouseIssuesToolbar
- category={category}
- categoryCounts={categoryCounts}
- selectedCategoryLabel={selectedCategoryLabel}
- isBusy={exportMutation.isPending}
- visibleIssues={visibleIssues}
- allIssues={allIssues}
- onCategoryChange={(next) =>
- void navigate({
- search: (prev) => ({ ...prev, category: next }),
- replace: true,
- })
- }
- onCopy={(data, message) => {
- void runCopy(data, message);
- }}
- onExport={(data) => {
- void runExport(data);
- }}
- onExportRows={runExportRows}
- />
- <LighthouseIssueList
- issues={visibleIssues}
- isLoading={issuesQuery.isLoading}
- emptyMessage={emptyMessage}
- />
- </CardContent>
- </Card>
+ <LighthouseIssuesToolbar
+ category={category}
+ categoryCounts={categoryCounts}
+ selectedCategoryLabel={selectedCategoryLabel}
+ isBusy={exportMutation.isPending}
+ visibleIssues={visibleIssues}
+ allIssues={allIssues}
+ onCategoryChange={(next) =>
+ void navigate({
+ search: (prev) => ({ ...prev, category: next }),
+ replace: true,
+ })
+ }
+ onCopy={(data, message) => {
+ void runCopy(data, message);
+ }}
+ onExport={(data) => {
+ void runExport(data);
+ }}
+ onExportRows={runExportRows}
+ />
+ <LighthouseIssueList
+ issues={visibleIssues}
+ isLoading={issuesQuery.isLoading}
+ emptyMessage={emptyMessage}
+ />
+ </TableCard>
</div>
</div>
);
diff --git a/src/client/features/rank-tracking/KeywordTrendModal.tsx b/src/client/features/rank-tracking/KeywordTrendModal.tsx
index a7486281..029f4865 100644
--- a/src/client/features/rank-tracking/KeywordTrendModal.tsx
+++ b/src/client/features/rank-tracking/KeywordTrendModal.tsx
@@ -225,7 +225,7 @@ export function KeywordTrendModal({
<div className="overflow-hidden rounded-lg border border-border">
<Table containerClassName="max-h-64">
<TableHeader className="sticky top-0 z-10 bg-popover">
- <TableRow className="hover:bg-transparent">
+ <TableRow>
<TableHead>Date</TableHead>
{devices.length > 1 && <TableHead>Device</TableHead>}
<TableHead>Position</TableHead>
diff --git a/src/client/features/rank-tracking/RankTrackingHistoryMatrix.tsx b/src/client/features/rank-tracking/RankTrackingHistoryMatrix.tsx
index eba20305..caa550fc 100644
--- a/src/client/features/rank-tracking/RankTrackingHistoryMatrix.tsx
+++ b/src/client/features/rank-tracking/RankTrackingHistoryMatrix.tsx
@@ -6,6 +6,7 @@ import { Button } from "@/client/components/ui/button";
import {
Table,
TableBody,
+ TableCard,
TableCell,
TableHead,
TableHeader,
@@ -46,10 +47,10 @@ export function RankTrackingHistoryMatrix({
}
return (
- <div className="overflow-hidden rounded-xl border border-border bg-card">
+ <TableCard>
<Table>
<TableHeader>
- <TableRow className="hover:bg-transparent">
+ <TableRow>
{/* Unconstrained keyword column absorbs the slack when only a few
check columns exist, so sparse history doesn't stretch oddly. */}
<TableHead className="sticky left-0 z-10 w-full bg-card">
@@ -85,7 +86,7 @@ export function RankTrackingHistoryMatrix({
})}
</TableBody>
</Table>
- </div>
+ </TableCard>
);
}
diff --git a/src/client/features/reports/ReportTemplatesList.tsx b/src/client/features/reports/ReportTemplatesList.tsx
index 16dca3ea..3b872f32 100644
--- a/src/client/features/reports/ReportTemplatesList.tsx
+++ b/src/client/features/reports/ReportTemplatesList.tsx
@@ -5,6 +5,7 @@ import { DropdownMenuItem } from "@/client/components/ui/dropdown-menu";
import {
Table,
TableBody,
+ TableCard,
TableCell,
TableHead,
TableHeader,
@@ -33,7 +34,7 @@ export function ReportTemplatesList({
}
return (
- <div className="rounded-lg border border-border">
+ <TableCard>
<Table>
<TableHeader>
<TableRow>
@@ -80,6 +81,6 @@ export function ReportTemplatesList({
))}
</TableBody>
</Table>
- </div>
+ </TableCard>
);
}
diff --git a/src/client/features/reports/ReportsList.tsx b/src/client/features/reports/ReportsList.tsx
index cb1bc99e..1a01fc25 100644
--- a/src/client/features/reports/ReportsList.tsx
+++ b/src/client/features/reports/ReportsList.tsx
@@ -6,6 +6,7 @@ import { DropdownMenuItem } from "@/client/components/ui/dropdown-menu";
import {
Table,
TableBody,
+ TableCard,
TableCell,
TableHead,
TableHeader,
@@ -37,7 +38,7 @@ export function ReportsList({
return (
<div className="space-y-3">
- <div className="rounded-lg border border-border">
+ <TableCard>
<Table>
<TableHeader>
<TableRow>
@@ -87,7 +88,7 @@ export function ReportsList({
))}
</TableBody>
</Table>
- </div>
+ </TableCard>
{reports.length === REPORT_APP_LIST_LIMIT ? (
<p className="text-xs text-muted-foreground">
Showing the {REPORT_APP_LIST_LIMIT} most recent reports.
diff --git a/src/client/features/settings/ApiKeySettings.tsx b/src/client/features/settings/ApiKeySettings.tsx
index 28b1d2fe..6550d994 100644
--- a/src/client/features/settings/ApiKeySettings.tsx
+++ b/src/client/features/settings/ApiKeySettings.tsx
@@ -22,6 +22,7 @@ import { DropdownMenuItem } from "@/client/components/ui/dropdown-menu";
import {
Table,
TableBody,
+ TableCard,
TableCell,
TableHead,
TableHeader,
@@ -149,7 +150,7 @@ export function ApiKeySettings() {
apiKeys.length === 0 ? (
<p className="text-sm text-muted-foreground">No API keys yet.</p>
) : (
- <div className="rounded-lg border border-border bg-card">
+ <TableCard>
<Table>
<TableHeader>
<TableRow>
@@ -202,7 +203,7 @@ export function ApiKeySettings() {
))}
</TableBody>
</Table>
- </div>
+ </TableCard>
)
}
</QueryState>
diff --git a/src/client/features/settings/CrawlerAccessSettings.tsx b/src/client/features/settings/CrawlerAccessSettings.tsx
index 3bb69b3c..886d67e6 100644
--- a/src/client/features/settings/CrawlerAccessSettings.tsx
+++ b/src/client/features/settings/CrawlerAccessSettings.tsx
@@ -15,6 +15,7 @@ import { Button } from "@/client/components/ui/button";
import {
Table,
TableBody,
+ TableCard,
TableCell,
TableHead,
TableHeader,
@@ -87,7 +88,7 @@ export function CrawlerAccessSettings({ projectId }: { projectId: string }) {
We couldn't load your crawler access.
</p>
) : credentials.length > 0 ? (
- <div className="overflow-hidden rounded-lg border border-border bg-card">
+ <TableCard>
<Table>
<TableHeader>
<TableRow>
@@ -131,7 +132,7 @@ export function CrawlerAccessSettings({ projectId }: { projectId: string }) {
))}
</TableBody>
</Table>
- </div>
+ </TableCard>
) : null}
</section>
);
diff --git a/src/client/features/team/TeamSettings.tsx b/src/client/features/team/TeamSettings.tsx
index 8ef274d2..3a88ae55 100644
--- a/src/client/features/team/TeamSettings.tsx
+++ b/src/client/features/team/TeamSettings.tsx
@@ -14,6 +14,7 @@ import { Button } from "@/client/components/ui/button";
import {
Table,
TableBody,
+ TableCard,
TableHead,
TableHeader,
TableRow,
@@ -171,7 +172,7 @@ export function TeamSettings() {
{teamQuery.isPending ? (
<PageLoading />
) : (
- <div className="rounded-lg border border-border bg-card">
+ <TableCard>
<Table>
<TableHeader>
<TableRow>
@@ -209,7 +210,7 @@ export function TeamSettings() {
))}
</TableBody>
</Table>
- </div>
+ </TableCard>
)}
{transferTarget ? (