Skip to content

Open source alternative to Semrush and Ahrefs

Equal-height dashboard cards with right-aligned actions (EVE-367) (#777)

Carter Smithb02283eae2dc
diff --git a/src/client/components/CardShell.tsx b/src/client/components/CardShell.tsx
index bbacbfc7..e8fd81db 100644
--- a/src/client/components/CardShell.tsx
+++ b/src/client/components/CardShell.tsx
@@ -7,7 +7,11 @@ import {
CardTitle,
} from "@/client/components/ui/card";
-/** Card with a header row and a divided body: dashboard and connection cards. */
+/**
+ * Card with a header row and a divided body: dashboard and connection cards.
+ * It fills its grid cell, and the body grows so content marked `mt-auto`
+ * (action rows, the stamp) sits at the bottom of equal-height cards.
+ */
export function CardShell({
title,
icon,
@@ -22,7 +26,7 @@ export function CardShell({
children: ReactNode;
}) {
return (
- <Card size="lg">
+ <Card size="lg" className="h-full">
<CardHeader className="border-b">
<CardTitle className="flex min-w-0 items-center gap-2.5">
{icon ? (
@@ -36,10 +40,12 @@ export function CardShell({
<CardAction className="self-center">{action}</CardAction>
) : null}
</CardHeader>
- <CardContent>
+ <CardContent className="flex flex-1 flex-col">
{children}
{stamp ? (
- <p className="mt-4 text-[11px] text-muted-foreground">{stamp}</p>
+ <p className="mt-auto pt-4 text-[11px] text-muted-foreground">
+ {stamp}
+ </p>
) : null}
</CardContent>
</Card>
diff --git a/src/client/features/dashboard/DashboardPage.tsx b/src/client/features/dashboard/DashboardPage.tsx
index f2077683..3cd7bad2 100644
--- a/src/client/features/dashboard/DashboardPage.tsx
+++ b/src/client/features/dashboard/DashboardPage.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useRef } from "react";
+import { Fragment, useEffect, useRef } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { sort } from "remeda";
import { DashboardOnboarding } from "./DashboardOnboarding";
@@ -168,11 +168,12 @@ export function DashboardPage({ projectId }: { projectId: string }) {
) : null}
{/* Every card is half width on large screens (only the checklist spans).
- Cards with data render before setup pitches and empty states. */}
- <div className="grid items-start gap-5 lg:grid-cols-2">
+ Cards with data render before setup pitches and empty states. Cards in
+ a row stretch to the same height. */}
+ <div className="grid gap-5 lg:grid-cols-2">
{sort(cards, (a, b) => Number(b.hasData) - Number(a.hasData)).map(
(card) => (
- <div key={card.key}>{card.node}</div>
+ <Fragment key={card.key}>{card.node}</Fragment>
),
)}
</div>
diff --git a/src/client/features/dashboard/cardParts.tsx b/src/client/features/dashboard/cardParts.tsx
index 5b78ad0d..eff8dd91 100644
--- a/src/client/features/dashboard/cardParts.tsx
+++ b/src/client/features/dashboard/cardParts.tsx
@@ -24,9 +24,9 @@ export function EmptyCardBody({
cta: React.ReactNode;
}) {
return (
- <div className="flex flex-col items-start gap-3">
+ <div className="flex flex-1 flex-col gap-3">
<p className="text-sm text-muted-foreground">{message}</p>
- {cta}
+ <div className="mt-auto flex justify-end">{cta}</div>
</div>
);
}
diff --git a/src/client/features/integrations/GoogleConnectionCard.tsx b/src/client/features/integrations/GoogleConnectionCard.tsx
index 85e909a2..e7caaf1b 100644
--- a/src/client/features/integrations/GoogleConnectionCard.tsx
+++ b/src/client/features/integrations/GoogleConnectionCard.tsx
@@ -136,6 +136,7 @@ export function GoogleConnectionCard({
type="button"
variant="ghost"
size="sm"
+ className="text-muted-foreground"
onClick={onDismiss}
disabled={dismissing || changingConnection}
>
@@ -181,7 +182,7 @@ export function GoogleConnectionCard({
isRetrying={connectionQuery.isFetching}
/>
) : needsGoogleOAuthSetup ? (
- <div className="space-y-3">
+ <div className="flex flex-1 flex-col items-start justify-between gap-3">
<GoogleOAuthSetupWarning
integrationName={config.name}
docsUrl={config.docsUrl}
diff --git a/src/client/features/integrations/GoogleProjectEmptyState.tsx b/src/client/features/integrations/GoogleProjectEmptyState.tsx
index c6646bc6..3c3c204b 100644
--- a/src/client/features/integrations/GoogleProjectEmptyState.tsx
+++ b/src/client/features/integrations/GoogleProjectEmptyState.tsx
@@ -22,13 +22,16 @@ export function GoogleProjectEmptyState({
children?: ReactNode;
}) {
return (
- <div className="space-y-4">
+ <div className="flex flex-1 flex-col gap-4">
<p className="text-sm text-muted-foreground">
{hasGrant
? `Choose a ${name} property to finish connecting this project.`
: `Connect ${name} to see this project’s data.`}
</p>
- <div className="flex flex-wrap items-center gap-1">
+ {/* Actions sit bottom-right, with Dismiss (children) just left of the
+ connect action. */}
+ <div className="mt-auto flex flex-wrap items-center justify-end gap-1">
+ {children}
{canManage || hasGrant ? (
<Button
variant={prominent ? "default" : "outline"}
@@ -54,7 +57,6 @@ export function GoogleProjectEmptyState({
: "Manage Google accounts"}
</Button>
) : null}
- {children}
</div>
</div>
);