Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(frontend): move add-change action onto the changes tab strip (#20710)

boojack63da5bffd081
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.test.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.test.tsx
index 0ae8c5292a..df2a414682 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.test.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.test.tsx
@@ -464,14 +464,17 @@ vi.mock("./PlanDetailTabStrip", () => ({
}) => <button onClick={onSelect}>{children}</button>,
PlanDetailTabStrip: ({
action,
+ trailing,
children,
}: {
action?: ReactNode;
+ trailing?: ReactNode;
children: ReactNode;
}) => (
<div>
{action}
{children}
+ {trailing}
</div>
),
}));
@@ -765,7 +768,7 @@ describe("PlanDetailChangesBranch", () => {
renderHarness(0);
const addChangeButton = [...container.querySelectorAll("button")].find(
- (button) => button.textContent === "plan.add-spec"
+ (button) => button.getAttribute("aria-label") === "plan.add-spec"
);
expect(addChangeButton).toBeTruthy();
@@ -806,7 +809,7 @@ describe("PlanDetailChangesBranch", () => {
});
const addChangeButton = [...container.querySelectorAll("button")].find(
- (button) => button.textContent === "plan.add-spec"
+ (button) => button.getAttribute("aria-label") === "plan.add-spec"
);
expect(addChangeButton).toBeTruthy();
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx
index c7a4aa7e67..bda2071cb5 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx
@@ -7,6 +7,7 @@ import {
FolderTree,
Loader2,
Pencil,
+ Plus,
XCircle,
} from "lucide-react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
@@ -152,6 +153,12 @@ const DEFAULT_VISIBLE_TARGETS = 20;
const DATABASE_GROUP_VISIBLE_DATABASES = 3;
const EMPTY_SELECT_VALUE = "__empty__";
+// Shared hover/focus recipe for the square icon buttons on the tab strip
+// (the per-tab actions menu and the add-change button). Callers append their
+// own size and corner radius.
+const ICON_ACTION_CLASS =
+ "inline-flex cursor-pointer items-center justify-center text-control-light outline-hidden transition-colors hover:bg-control-bg hover:text-control focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50";
+
const pushSpecDetailRoute = (
projectId: string,
planId: string,
@@ -530,21 +537,27 @@ export function PlanDetailChangesBranch({
return (
<div className="flex w-full flex-1 flex-col">
<PlanDetailTabStrip
- action={
+ trailing={
canModifySpecs ? (
<Tooltip
content={
- pendingNewSpec ? t("plan.add-spec-pending-draft") : undefined
+ pendingNewSpec
+ ? t("plan.add-spec-pending-draft")
+ : t("plan.add-spec")
}
>
- <Button
+ <button
+ aria-label={t("plan.add-spec")}
+ className={cn(
+ ICON_ACTION_CLASS,
+ "size-7 rounded-md [touch-action:manipulation]"
+ )}
disabled={Boolean(pendingNewSpec)}
onClick={() => setShowAddSpecSheet(true)}
- size="xs"
- variant="outline"
+ type="button"
>
- {t("plan.add-spec")}
- </Button>
+ <Plus aria-hidden="true" className="size-4" />
+ </button>
</Tooltip>
) : undefined
}
@@ -560,7 +573,8 @@ export function PlanDetailChangesBranch({
<DropdownMenu>
<DropdownMenuTrigger
className={cn(
- "mr-2 inline-flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-xs text-control-light outline-hidden transition-colors hover:bg-control-bg hover:text-control focus-visible:ring-2 focus-visible:ring-accent"
+ ICON_ACTION_CLASS,
+ "mr-2 size-6 shrink-0 rounded-xs"
)}
>
<EllipsisVertical className="size-3.5" />
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailTabStrip.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailTabStrip.tsx
index 8d6aca6743..2ff9809dac 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailTabStrip.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailTabStrip.tsx
@@ -3,17 +3,33 @@ import { cn } from "@/react/lib/utils";
export function PlanDetailTabStrip({
action,
+ trailing,
children,
}: {
action?: ReactNode;
+ trailing?: ReactNode;
children: ReactNode;
}) {
return (
<div className="relative bg-white pt-3">
<div className="absolute bottom-0 w-full border-b border-b-gray-200 leading-0" />
<div className="flex items-center justify-between gap-x-4">
- <div className="flex min-w-0 flex-1 items-center overflow-x-auto px-4">
+ <div
+ className={cn(
+ "flex min-w-0 items-center overflow-x-auto",
+ // With a trailing slot the container shrinks to its tabs so the
+ // sticky button sits right after the last tab (and pins to the
+ // edge on overflow); the occluder below supplies the right
+ // padding. Otherwise fill the row with symmetric padding.
+ trailing ? "pl-4" : "flex-1 px-4"
+ )}
+ >
{children}
+ {trailing && (
+ <div className="sticky right-0 ml-1 flex shrink-0 items-center self-stretch border-b border-b-gray-200 bg-white pr-4 pl-2">
+ {trailing}
+ </div>
+ )}
</div>
{action && <div className="shrink-0 px-4">{action}</div>}
</div>