Open source alternative to Semrush and Ahrefs
TypeScript backlink-analysisgoogle-search-console-mcpkeyword-researchmcpseoseo-agentseo-auditseo-automationseo-skillsseo-toolssite-audit
Style the shadcn Dialog, DropdownMenu, Tabs and ToggleGroup for OpenSEO and add ConfirmDialog, ExportMenu and HelpLabel (EVE-294) (#731)
Carter Smithbed12dff951b
diff --git a/src/client/components/ConfirmDeleteModal.tsx b/src/client/components/ConfirmDeleteModal.tsxdeleted file mode 100644index f52b0033..00000000--- a/src/client/components/ConfirmDeleteModal.tsx+++ /dev/null@@ -1,46 +0,0 @@-import { Loader2 } from "lucide-react";-import { Modal } from "@/client/components/Modal";--/** Confirm-by-name modal for a delete with no undo. */-export function ConfirmDeleteModal({- title,- detail,- confirmLabel,- isPending,- onClose,- onConfirm,-}: {- title: string;- detail: string;- confirmLabel: string;- isPending: boolean;- onClose: () => void;- onConfirm: () => void;-}) {- return (- <Modal onClose={onClose} labelledBy="confirm-delete-title">- <h3 id="confirm-delete-title" className="text-lg font-semibold">- {title}- </h3>- <p className="text-sm text-base-content/70">{detail}</p>- <div className="flex justify-end gap-2">- <button- type="button"- className="btn btn-ghost btn-sm"- onClick={onClose}- >- Cancel- </button>- <button- type="button"- className="btn btn-error btn-sm gap-1"- onClick={onConfirm}- disabled={isPending}- >- {isPending ? <Loader2 className="size-3 animate-spin" /> : null}- {confirmLabel}- </button>- </div>- </Modal>- );-}diff --git a/src/client/components/ConfirmDialog.tsx b/src/client/components/ConfirmDialog.tsxindex c07a4481..1241cd29 100644--- a/src/client/components/ConfirmDialog.tsx+++ b/src/client/components/ConfirmDialog.tsx@@ -1,47 +1,61 @@import type { ReactNode } from "react";-import { FormDialog } from "@/client/components/FormDialog";+import {+ AlertDialog,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+} from "@/client/components/ui/alert-dialog";+import { Button } from "@/client/components/ui/button";-/** Asks before an action that cannot be undone, such as one that spends credits. */+/**+ * Asks before an action that cannot be undone: a delete, or one that spends+ * credits. Render it only while it is open. `onConfirm` does not close it, so+ * the caller closes it right away or when the mutation settles. While+ * `pending`, Cancel and Escape do nothing.+ */export function ConfirmDialog({title,confirmLabel,onConfirm,onClose,+ pending = false,+ destructive = false,children,}: {title: string;confirmLabel: string;onConfirm: () => void;onClose: () => void;+ pending?: boolean;+ destructive?: boolean;children: ReactNode;}) {return (- <FormDialog- title={title}- onClose={onClose}- actions={- <>- <button- type="button"- className="btn btn-ghost btn-sm"- onClick={onClose}- >- Cancel- </button>- <button- type="button"- className="btn btn-primary btn-sm"- onClick={() => {- onClose();- onConfirm();- }}+ <AlertDialog+ open+ onOpenChange={(open) => {+ if (!open && !pending) onClose();+ }}+ >+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>{title}</AlertDialogTitle>+ <AlertDialogDescription>{children}</AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel disabled={pending}>Cancel</AlertDialogCancel>+ <Button+ variant={destructive ? "destructive" : "default"}+ pending={pending}+ onClick={onConfirm}>{confirmLabel}- </button>- </>- }- >- <p className="text-sm text-base-content/70">{children}</p>- </FormDialog>+ </Button>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>);}diff --git a/src/client/components/ExportMenu.tsx b/src/client/components/ExportMenu.tsxnew file mode 100644index 00000000..f06aa826--- /dev/null+++ b/src/client/components/ExportMenu.tsx@@ -0,0 +1,100 @@+import { Fragment, type ReactNode } from "react";+import {+ ChevronDown,+ Copy,+ Download,+ FileDown,+ FileJson,+ FileSpreadsheet,+ List,+ Sheet,+} from "lucide-react";+import { Button } from "@/client/components/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuItem,+ DropdownMenuLabel,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@/client/components/ui/dropdown-menu";+import type { ExportFormat } from "@/client/lib/exportRows";++/** Every `exportRows()` format, plus a plain list copy (one item per line). */+type ExportAction = ExportFormat | "copy-list";++const ACTION_ITEMS: Record<ExportAction, { label: string; icon: ReactNode }> = {+ sheets: { label: "Export to Sheets", icon: <Sheet /> },+ csv: { label: "Export CSV", icon: <FileDown /> },+ excel: { label: "Export Excel", icon: <FileSpreadsheet /> },+ json: { label: "Download JSON", icon: <FileJson /> },+ "copy-json": { label: "Copy JSON", icon: <Copy /> },+ "copy-list": { label: "Copy list", icon: <List /> },+};++/**+ * The toolbar Export button. The caller runs each action through+ * `exportRows()`, so every format shares the empty check and the analytics+ * event. With `scopes`, each scope is a labelled section with the same+ * actions, for example "Current category" and "All actionable".+ */+export function ExportMenu<A extends ExportAction>({+ actions,+ onExport,+ busy = false,+ disabled = false,+ copyListLabel,+ scopes,+}: {+ actions: A[];+ onExport: (action: A, scope?: string) => void;+ /** Shows a spinner on the trigger and disables it, for example while Sheets opens. */+ busy?: boolean;+ disabled?: boolean;+ /** Label for "copy-list", for example "Copy keywords". */+ copyListLabel?: string;+ scopes?: { id: string; label: string }[];+}) {+ const renderItems = (scope?: string) =>+ actions.map((action) => (+ <DropdownMenuItem key={action} onClick={() => onExport(action, scope)}>+ {ACTION_ITEMS[action].icon}+ {action === "copy-list" && copyListLabel+ ? copyListLabel+ : ACTION_ITEMS[action].label}+ </DropdownMenuItem>+ ));++ return (+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <Button+ variant="ghost"+ size="sm"+ pending={busy}+ disabled={disabled}+ />+ }+ >+ {busy ? null : <Download data-icon="inline-start" />}+ Export+ <ChevronDown data-icon="inline-end" className="opacity-60" />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="w-56">+ {scopes+ ? scopes.map((scope, index) => (+ <Fragment key={scope.id}>+ {index > 0 ? <DropdownMenuSeparator /> : null}+ <DropdownMenuGroup>+ <DropdownMenuLabel>{scope.label}</DropdownMenuLabel>+ {renderItems(scope.id)}+ </DropdownMenuGroup>+ </Fragment>+ ))+ : renderItems()}+ </DropdownMenuContent>+ </DropdownMenu>+ );+}diff --git a/src/client/components/FloatingTooltip.tsx b/src/client/components/FloatingTooltip.tsxdeleted file mode 100644index a6c3f3f6..00000000--- a/src/client/components/FloatingTooltip.tsx+++ /dev/null@@ -1,102 +0,0 @@-import type { ReactNode } from "react";-import { useEffect, useId, useRef, useState } from "react";--type Position = { top: number; left: number };--export function FloatingTooltip({- id,- position,- children,-}: {- id: string;- position: Position;- children: ReactNode;-}) {- return (- <span- id={id}- role="tooltip"- className="pointer-events-none fixed z-[1000] w-max max-w-64 -translate-x-1/2 -translate-y-full rounded-md border border-base-300 bg-base-100 px-2.5 py-2 text-[11px] font-normal normal-case leading-snug text-base-content shadow-md"- style={{ left: position.left, top: position.top }}- >- {children}- </span>- );-}--export function useFloatingTooltip<T extends HTMLElement>({- delayMs = 150,- enabled = true,-}: {- delayMs?: number;- enabled?: boolean;-} = {}) {- const tooltipId = useId();- const triggerRef = useRef<T | null>(null);- const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);- const [isOpen, setIsOpen] = useState(false);- const [position, setPosition] = useState<Position>({ top: 0, left: 0 });-- const updatePosition = () => {- const rect = triggerRef.current?.getBoundingClientRect();- if (!rect) return;- setPosition({- top: rect.top - 8,- left: rect.left + rect.width / 2,- });- };-- const clearOpenTimeout = () => {- if (timeoutRef.current) {- clearTimeout(timeoutRef.current);- timeoutRef.current = null;- }- };-- const open = () => {- if (!enabled) return;- updatePosition();- setIsOpen(true);- };-- const scheduleOpen = () => {- if (!enabled) return;- clearOpenTimeout();- timeoutRef.current = setTimeout(() => {- open();- timeoutRef.current = null;- }, delayMs);- };-- const close = () => {- clearOpenTimeout();- setIsOpen(false);- };-- useEffect(() => clearOpenTimeout, []);-- useEffect(() => {- if (!isOpen) return;-- updatePosition();-- const handleReposition = () => updatePosition();- window.addEventListener("resize", handleReposition);- window.addEventListener("scroll", handleReposition, true);-- return () => {- window.removeEventListener("resize", handleReposition);- window.removeEventListener("scroll", handleReposition, true);- };- }, [isOpen]);-- return {- close,- isOpen,- open,- position,- scheduleOpen,- tooltipId,- triggerRef,- };-}diff --git a/src/client/components/FormDialog.tsx b/src/client/components/FormDialog.tsxindex 1a09d5ae..babe68d2 100644--- a/src/client/components/FormDialog.tsx+++ b/src/client/components/FormDialog.tsx@@ -1,7 +1,17 @@-import { useId, type ReactNode } from "react";-import { Modal } from "@/client/components/Modal";+import type { ReactNode } from "react";+import {+ Dialog,+ DialogContent,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from "@/client/components/ui/dialog";-/** A small settings-style dialog: title, labelled rows, right-aligned actions. */+/**+ * A small settings-style dialog: title, labelled rows, right-aligned actions.+ * Render it only while it is open. Escape, the close button and a backdrop+ * click call `onClose`.+ */export function FormDialog({title,onClose,@@ -9,18 +19,24 @@ export function FormDialog({children,}: {title: string;- onClose?: () => void;+ onClose: () => void;actions: ReactNode;children: ReactNode;}) {- const titleId = useId();return (- <Modal maxWidth="max-w-md" onClose={onClose} labelledBy={titleId}>- <h3 id={titleId} className="text-lg font-semibold">- {title}- </h3>- {children}- <div className="flex justify-end gap-2 pt-2">{actions}</div>- </Modal>+ <Dialog+ open+ onOpenChange={(open) => {+ if (!open) onClose();+ }}+ >+ <DialogContent className="sm:max-w-md">+ <DialogHeader>+ <DialogTitle>{title}</DialogTitle>+ </DialogHeader>+ {children}+ <DialogFooter>{actions}</DialogFooter>+ </DialogContent>+ </Dialog>);}diff --git a/src/client/components/HelpLabel.tsx b/src/client/components/HelpLabel.tsxnew file mode 100644index 00000000..6004df03--- /dev/null+++ b/src/client/components/HelpLabel.tsx@@ -0,0 +1,26 @@+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/client/components/ui/tooltip";++/**+ * A label with a help tooltip, for table headers and stat labels. The trigger+ * is a span, so it can sit inside a sort button.+ */+export function HelpLabel({+ label,+ helpText,+}: {+ label: string;+ helpText: string;+}) {+ return (+ <Tooltip>+ <TooltipTrigger delay={150} render={<span />}>+ {label}+ </TooltipTrigger>+ <TooltipContent>{helpText}</TooltipContent>+ </Tooltip>+ );+}diff --git a/src/client/components/InlineConfirm.tsx b/src/client/components/InlineConfirm.tsxnew file mode 100644index 00000000..ee8d7c4f--- /dev/null+++ b/src/client/components/InlineConfirm.tsx@@ -0,0 +1,55 @@+import { useState } from "react";+import { Trash2 } from "lucide-react";+import { Button } from "@/client/components/ui/button";++/**+ * Two-step delete for a list row: the trash icon swaps to an explicit+ * Remove/Cancel pair, so a stray click can't destroy anything and no dialog+ * is needed.+ */+export function InlineConfirm({+ label,+ pending,+ onConfirm,+}: {+ /** Accessible name of the trash button, for example "Remove openseo.so". */+ label: string;+ pending: boolean;+ onConfirm: () => void;+}) {+ const [confirming, setConfirming] = useState(false);++ if (confirming) {+ return (+ <>+ <Button+ variant="destructive"+ size="xs"+ disabled={pending}+ onClick={() => {+ setConfirming(false);+ onConfirm();+ }}+ >+ Remove+ </Button>+ <Button variant="ghost" size="xs" onClick={() => setConfirming(false)}>+ Cancel+ </Button>+ </>+ );+ }++ return (+ <Button+ variant="ghost"+ size="icon-xs"+ className="text-destructive hover:text-destructive"+ aria-label={label}+ disabled={pending}+ onClick={() => setConfirming(true)}+ >+ <Trash2 className="size-3.5" />+ </Button>+ );+}diff --git a/src/client/components/NavTabs.tsx b/src/client/components/NavTabs.tsxnew file mode 100644index 00000000..f765f22f--- /dev/null+++ b/src/client/components/NavTabs.tsx@@ -0,0 +1,35 @@+import type { ComponentProps, ReactNode } from "react";+import { createLink } from "@tanstack/react-router";+import { cn } from "cn";++/** A strip of router links styled as tabs, for pages with their own URL. */+export function NavTabs({+ label,+ children,+}: {+ label: string;+ children: ReactNode;+}) {+ return (+ <nav aria-label={label} className="flex gap-1 border-b border-border">+ {children}+ </nav>+ );+}++// The router sets `data-status="active"` and `aria-current="page"` on the+// link that matches the current URL.+function NavTabAnchor({ className, ...props }: ComponentProps<"a">) {+ return (+ <a+ className={cn(+ "relative inline-flex h-9 items-center px-3 text-sm font-medium text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:rounded-md focus-visible:ring-3 focus-visible:ring-ring/50 data-[status=active]:text-foreground",+ "after:absolute after:inset-x-0 after:-bottom-px after:h-0.5 after:bg-foreground after:opacity-0 data-[status=active]:after:opacity-100",+ className,+ )}+ {...props}+ />+ );+}++export const NavTab = createLink(NavTabAnchor);diff --git a/src/client/components/RowActionsMenu.tsx b/src/client/components/RowActionsMenu.tsxnew file mode 100644index 00000000..aa5e9ecf--- /dev/null+++ b/src/client/components/RowActionsMenu.tsx@@ -0,0 +1,31 @@+import type { ReactNode } from "react";+import { MoreHorizontal } from "lucide-react";+import { Button } from "@/client/components/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuTrigger,+} from "@/client/components/ui/dropdown-menu";++/** The kebab menu at the end of a table row. Children are `DropdownMenuItem`s. */+export function RowActionsMenu({+ label,+ children,+}: {+ /** Accessible name of the trigger, for example "Actions for Monthly check-in". */+ label: string;+ children: ReactNode;+}) {+ return (+ <DropdownMenu>+ <DropdownMenuTrigger+ render={<Button variant="ghost" size="icon-xs" aria-label={label} />}+ >+ <MoreHorizontal />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="w-40">+ {children}+ </DropdownMenuContent>+ </DropdownMenu>+ );+}diff --git a/src/client/components/SegmentedToggle.tsx b/src/client/components/SegmentedToggle.tsxindex 9bec6646..f30849c2 100644--- a/src/client/components/SegmentedToggle.tsx+++ b/src/client/components/SegmentedToggle.tsx@@ -1,4 +1,8 @@import type { ReactNode } from "react";+import {+ ToggleGroup,+ ToggleGroupItem,+} from "@/client/components/ui/toggle-group";interface SegmentedToggleItem<T extends string> {value: T;@@ -6,6 +10,7 @@ interface SegmentedToggleItem<T extends string> {label: string;}+/** A single-choice segmented control. Each item is a toggle with `aria-pressed`. */export function SegmentedToggle<T extends string>({items,value,@@ -18,20 +23,29 @@ export function SegmentedToggle<T extends string>({showLabels?: boolean;}) {return (- <div className="inline-flex rounded-lg bg-base-300 p-0.5">+ <ToggleGroup+ size="sm"+ spacing={0.5}+ value={[value]}+ onValueChange={(next) => {+ // A press on the active item empties the group. Keep one item on.+ const picked = items.find((item) => item.value === next[0]);+ if (picked) onChange(picked.value);+ }}+ className="rounded-lg bg-muted p-0.5 ring-1 ring-border ring-inset"+ >{items.map((item) => (- <button+ <ToggleGroupItemkey={item.value}- type="button"- aria-pressed={value === item.value}- className={`btn btn-xs gap-1.5 px-2 ${value === item.value ? "bg-primary/20 text-primary shadow-sm" : "btn-ghost text-base-content/40"}`}- onClick={() => onChange(item.value)}+ value={item.value}+ aria-label={showLabels ? undefined : item.label}title={item.label}+ className="h-6 text-muted-foreground aria-pressed:bg-primary/15 aria-pressed:text-primary aria-pressed:shadow-sm">{item.icon}{showLabels && item.label}- </button>+ </ToggleGroupItem>))}- </div>+ </ToggleGroup>);}diff --git a/src/client/components/table/HeaderHelpLabel.tsx b/src/client/components/table/HeaderHelpLabel.tsxdeleted file mode 100644index 56b69758..00000000--- a/src/client/components/table/HeaderHelpLabel.tsx+++ /dev/null@@ -1,42 +0,0 @@-import { createPortal } from "react-dom";-import {- FloatingTooltip,- useFloatingTooltip,-} from "@/client/components/FloatingTooltip";--export function HeaderHelpLabel({- label,- helpText,- delayMs = 150,-}: {- label: string;- helpText: string;- delayMs?: number;-}) {- const tooltip = useFloatingTooltip<HTMLSpanElement>({ delayMs });-- return (- <span- ref={tooltip.triggerRef}- className="relative inline-flex items-center"- onMouseEnter={tooltip.scheduleOpen}- onMouseLeave={tooltip.close}- onFocus={tooltip.scheduleOpen}- onBlur={tooltip.close}- onKeyDown={(e) => {- if (e.key === "Escape") tooltip.close();- }}- aria-describedby={tooltip.isOpen ? tooltip.tooltipId : undefined}- >- <span>{label}</span>- {tooltip.isOpen && typeof document !== "undefined"- ? createPortal(- <FloatingTooltip id={tooltip.tooltipId} position={tooltip.position}>- {helpText}- </FloatingTooltip>,- document.body,- )- : null}- </span>- );-}diff --git a/src/client/components/table/SortableHeader.tsx b/src/client/components/table/SortableHeader.tsxindex 58ac1b99..c30f179a 100644--- a/src/client/components/table/SortableHeader.tsx+++ b/src/client/components/table/SortableHeader.tsx@@ -1,5 +1,5 @@import { ArrowDown, ArrowUp } from "lucide-react";-import { HeaderHelpLabel } from "./HeaderHelpLabel";+import { HelpLabel } from "@/client/components/HelpLabel";type SortableColumn = {getIsSorted: () => false | "asc" | "desc";@@ -32,7 +32,7 @@ export function SortableHeader({aria-label={`Sort by ${label}`}aria-pressed={!!sorted}>- {helpText ? <HeaderHelpLabel label={label} helpText={helpText} /> : label}+ {helpText ? <HelpLabel label={label} helpText={helpText} /> : label}{sorted === "asc" ? (<ArrowUp className="size-3 shrink-0" />) : sorted === "desc" ? (diff --git a/src/client/components/ui/alert-dialog.tsx b/src/client/components/ui/alert-dialog.tsxindex e45ff056..dc63698a 100644--- a/src/client/components/ui/alert-dialog.tsx+++ b/src/client/components/ui/alert-dialog.tsx@@ -28,7 +28,7 @@ function AlertDialogOverlay({<AlertDialogPrimitive.Backdropdata-slot="alert-dialog-overlay"className={cn(- "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",+ "fixed inset-0 isolate z-50 bg-black/50 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",className,)}{...props}@@ -50,7 +50,7 @@ function AlertDialogContent({data-slot="alert-dialog-content"data-size={size}className={cn(- "group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",+ "group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground border border-border shadow-xl duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",className,)}{...props}@@ -83,7 +83,7 @@ function AlertDialogFooter({<divdata-slot="alert-dialog-footer"className={cn(- "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",+ "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-border bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",className,)}{...props}@@ -115,7 +115,7 @@ function AlertDialogTitle({<AlertDialogPrimitive.Titledata-slot="alert-dialog-title"className={cn(- "text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",+ "text-base font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",className,)}{...props}diff --git a/src/client/components/ui/dialog.tsx b/src/client/components/ui/dialog.tsxindex a43cddb7..9301e2ff 100644--- a/src/client/components/ui/dialog.tsx+++ b/src/client/components/ui/dialog.tsx@@ -31,7 +31,7 @@ function DialogOverlay({<DialogPrimitive.Backdropdata-slot="dialog-overlay"className={cn(- "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",+ "fixed inset-0 isolate z-50 bg-black/50 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",className,)}{...props}@@ -53,7 +53,7 @@ function DialogContent({<DialogPrimitive.Popupdata-slot="dialog-content"className={cn(- "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",+ "fixed top-1/2 left-1/2 z-50 grid w-full max-h-[calc(100%-2rem)] max-w-[calc(100%-2rem)] -translate-x-1/2 overflow-y-auto -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground border border-border shadow-xl duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",className,)}{...props}@@ -101,7 +101,7 @@ function DialogFooter({<divdata-slot="dialog-footer"className={cn(- "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",+ "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-border bg-muted/50 p-4 sm:flex-row sm:justify-end",className,)}{...props}@@ -120,7 +120,7 @@ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {return (<DialogPrimitive.Titledata-slot="dialog-title"- className={cn("text-base leading-none font-medium", className)}+ className={cn("text-base leading-none font-semibold", className)}{...props}/>);diff --git a/src/client/components/ui/dropdown-menu.tsx b/src/client/components/ui/dropdown-menu.tsxindex 3b0050b0..5c1d78da 100644--- a/src/client/components/ui/dropdown-menu.tsx+++ b/src/client/components/ui/dropdown-menu.tsx@@ -39,7 +39,7 @@ function DropdownMenuContent({<MenuPrimitive.Popupdata-slot="dropdown-menu-content"className={cn(- "z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",+ "z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md border border-border duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",className,)}{...props}@@ -136,7 +136,7 @@ function DropdownMenuSubContent({<DropdownMenuContentdata-slot="dropdown-menu-sub-content"className={cn(- "w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",+ "w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg border border-border duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",className,)}align={align}diff --git a/src/client/features/ai-search/components/BrandLookupCitationTables.tsx b/src/client/features/ai-search/components/BrandLookupCitationTables.tsxindex db86075e..f6e14890 100644--- a/src/client/features/ai-search/components/BrandLookupCitationTables.tsx+++ b/src/client/features/ai-search/components/BrandLookupCitationTables.tsx@@ -4,7 +4,7 @@ import { Link } from "@tanstack/react-router";import { ExternalLink, Sparkles } from "lucide-react";import { AppDataTable } from "@/client/components/table/AppDataTable";import { SortableHeader } from "@/client/components/table/SortableHeader";-import { HeaderHelpLabel } from "@/client/components/table/HeaderHelpLabel";+import { HelpLabel } from "@/client/components/HelpLabel";import { numericNullsLast } from "@/client/components/table/nullSafeSort";import {formatCount,@@ -28,7 +28,7 @@ function HeaderWithHelp({}) {return (<span className="uppercase tracking-wider">- <HeaderHelpLabel label={label} helpText={helpText} />+ <HelpLabel label={label} helpText={helpText} /></span>);}diff --git a/src/client/features/backlinks/BacklinksOverviewPanels.tsx b/src/client/features/backlinks/BacklinksOverviewPanels.tsxindex cfb7b352..01ff04e9 100644--- a/src/client/features/backlinks/BacklinksOverviewPanels.tsx+++ b/src/client/features/backlinks/BacklinksOverviewPanels.tsx@@ -1,7 +1,7 @@import { Link } from "@tanstack/react-router";import { RecentSearchesBackLink } from "@/client/components/RecentSearches";import { RESEARCH_SCOPE_LABELS } from "@/shared/researchScope";-import { HeaderHelpLabel } from "@/client/components/table/HeaderHelpLabel";+import { HelpLabel } from "@/client/components/HelpLabel";import {BacklinksNewLostChart,BacklinksTrendChart,@@ -113,10 +113,7 @@ function SummaryStatsGrid({{summaryStats.map((item) => (<div key={item.label}><div className="text-xs uppercase tracking-wide text-base-content/55">- <HeaderHelpLabel- label={item.label}- helpText={item.description}- />+ <HelpLabel label={item.label} helpText={item.description} /></div><p className="text-2xl font-semibold">{item.value}</p></div>diff --git a/src/client/features/backlinks/BacklinksTableColumns.tsx b/src/client/features/backlinks/BacklinksTableColumns.tsxindex 2bc2ab57..96be3362 100644--- a/src/client/features/backlinks/BacklinksTableColumns.tsx+++ b/src/client/features/backlinks/BacklinksTableColumns.tsx@@ -1,7 +1,7 @@import type { ColumnDef } from "@tanstack/react-table";import { ChevronRight } from "lucide-react";import { SortableHeader } from "@/client/components/table/SortableHeader";-import { HeaderHelpLabel } from "@/client/components/table/HeaderHelpLabel";+import { HelpLabel } from "@/client/components/HelpLabel";import { SafeExternalLink } from "@/client/components/SafeExternalLink";import type { BacklinksRow } from "./backlinksPageTypes";import type { BacklinksRowsSortField } from "@/types/schemas/backlinks";@@ -156,9 +156,7 @@ function buildBaseColumns({id: "source",enableSorting: false,- header: () => (- <HeaderHelpLabel label="Source" helpText="Page linking to you" />- ),+ header: () => <HelpLabel label="Source" helpText="Page linking to you" />,size: 250,minSize: 180,cell: ({ row }) => (@@ -169,7 +167,7 @@ function buildBaseColumns(id: "target",enableSorting: false,header: () => (- <HeaderHelpLabel label="Target" helpText="Destination on your site" />+ <HelpLabel label="Target" helpText="Destination on your site" />),size: 220,minSize: 150,@@ -187,7 +185,7 @@ function buildBaseColumns(id: "anchor",enableSorting: false,header: () => (- <HeaderHelpLabel label="Anchor" helpText="Text or format of the link" />+ <HelpLabel label="Anchor" helpText="Text or format of the link" />),size: 150,minSize: 100,@@ -204,7 +202,7 @@ function buildBaseColumns(id: "flags",enableSorting: false,header: () => (- <HeaderHelpLabel+ <HelpLabellabel="Flags"helpText="Special backlink attributes, such as lost, broken, nofollow, or multiple links from the same source."/>@@ -330,7 +328,7 @@ export function buildBacklinksColumns(enableSorting: false,header: () => (<span className="flex w-full justify-end">- <HeaderHelpLabel+ <HelpLabellabel="Ahrefs DR"helpText="Ahrefs Domain Rating (0-100) for the linking domain."/>diff --git a/src/client/features/backlinks/BacklinksToolbarMenus.tsx b/src/client/features/backlinks/BacklinksToolbarMenus.tsxindex a6803d75..03e2658f 100644--- a/src/client/features/backlinks/BacklinksToolbarMenus.tsx+++ b/src/client/features/backlinks/BacklinksToolbarMenus.tsx@@ -1,11 +1,6 @@import { useState } from "react";-import {- ChevronDown,- Download,- Gauge,- MoreHorizontal,- Sheet,-} from "lucide-react";+import { Gauge, MoreHorizontal } from "lucide-react";+import { ExportMenu } from "@/client/components/ExportMenu";import type { CsvValue } from "@/client/lib/csv";import { exportRows } from "@/client/lib/exportRows";import type { BacklinksSearchState } from "./backlinksPageTypes";@@ -23,71 +18,30 @@ export function BacklinksExportMenu({rows: CsvValue[][];}) {const [isExportingSheets, setIsExportingSheets] = useState(false);- const canExport = rows.length > 0 && !isExportingSheets;- const runExport = (format: "csv" | "sheets") =>- exportRows({- format,- feature: `backlinks_${activeTab}`,- headers,- rows,- filename: buildBacklinksTabFilename(activeTab, exportTarget),- });-- const handleExportToSheets = async () => {- if (!canExport) return;- setIsExportingSheets(true);+ const runExport = async (format: "csv" | "sheets") => {+ setIsExportingSheets(format === "sheets");try {- await runExport("sheets");+ await exportRows({+ format,+ feature: `backlinks_${activeTab}`,+ headers,+ rows,+ filename: buildBacklinksTabFilename(activeTab, exportTarget),+ });} finally {setIsExportingSheets(false);}};return (- <div className="dropdown dropdown-end">- <div- tabIndex={0}- role="button"- className={`btn btn-sm btn-ghost gap-1 ${rows.length === 0 ? "btn-disabled" : ""}`}- aria-label="Export backlinks table"- >- <Download className="size-4" />- Export- <ChevronDown className="size-3 opacity-60" />- </div>- <ul- tabIndex={0}- role="menu"- className="dropdown-content z-10 menu p-2 shadow-lg bg-base-100 border border-base-300 rounded-box w-56"- >- <li className="menu-title text-xs">Current page · selected view</li>- <li>- <button- type="button"- onClick={() => void handleExportToSheets()}- disabled={!canExport}- >- {isExportingSheets ? (- <span className="loading loading-spinner loading-xs" />- ) : (- <Sheet className="size-4" />- )}- Export to Sheets- </button>- </li>- <li>- <button- type="button"- onClick={() => void runExport("csv")}- disabled={rows.length === 0}- >- <Download className="size-4" />- Export CSV- </button>- </li>- </ul>- </div>+ <ExportMenu+ actions={["sheets", "csv"]}+ scopes={[{ id: "page", label: "Current page · selected view" }]}+ busy={isExportingSheets}+ disabled={rows.length === 0}+ onExport={(action) => void runExport(action)}+ />);}diff --git a/src/client/features/backlinks/ReferringDomainsTable.tsx b/src/client/features/backlinks/ReferringDomainsTable.tsxindex 17e9e8c3..01013d1e 100644--- a/src/client/features/backlinks/ReferringDomainsTable.tsx+++ b/src/client/features/backlinks/ReferringDomainsTable.tsx@@ -7,7 +7,7 @@ import {useAppTable,} from "@/client/components/table/AppDataTable";import { SortableHeader } from "@/client/components/table/SortableHeader";-import { HeaderHelpLabel } from "@/client/components/table/HeaderHelpLabel";+import { HelpLabel } from "@/client/components/HelpLabel";import { EmptyTableState } from "./BacklinksPageStates";import type { ReferringDomainRow } from "./backlinksPageTypes";import type { ReferringDomainsSortField } from "@/types/schemas/backlinks";@@ -138,7 +138,7 @@ function buildReferringDomainColumns(domainRatings: DomainRatings | null) {const drColumn = columnHelper.display({id: "ahrefsDr",header: () => (- <HeaderHelpLabel+ <HelpLabellabel="Ahrefs DR"helpText="Ahrefs Domain Rating (0-100) for this referring domain."/>diff --git a/src/client/features/backlinks/TopPagesTable.tsx b/src/client/features/backlinks/TopPagesTable.tsxindex e4ed9fd5..e5ca2422 100644--- a/src/client/features/backlinks/TopPagesTable.tsx+++ b/src/client/features/backlinks/TopPagesTable.tsx@@ -6,7 +6,7 @@ import {useAppTable,} from "@/client/components/table/AppDataTable";import { SortableHeader } from "@/client/components/table/SortableHeader";-import { HeaderHelpLabel } from "@/client/components/table/HeaderHelpLabel";+import { HelpLabel } from "@/client/components/HelpLabel";import { EmptyTableState } from "./BacklinksPageStates";import type { TopPageRow } from "./backlinksPageTypes";import type { TopPagesSortField } from "@/types/schemas/backlinks";@@ -21,7 +21,7 @@ const columns = [id: "page",enableSorting: false,header: () => (- <HeaderHelpLabel+ <HelpLabellabel="Page"helpText="Page on the target site receiving backlinks."/>diff --git a/src/client/features/keywords/components/DisplayPrimitives.tsx b/src/client/features/keywords/components/DisplayPrimitives.tsxindex ee7a20de..9a586fcf 100644--- a/src/client/features/keywords/components/DisplayPrimitives.tsx+++ b/src/client/features/keywords/components/DisplayPrimitives.tsx@@ -1,5 +1,4 @@import { ChevronDown, ChevronUp } from "lucide-react";-import { createPortal } from "react-dom";import { Area, AreaChart } from "recharts";import {ChartGrid,@@ -19,9 +18,10 @@ import {MONTH_SHORT_LABELS,} from "../utils";import {- FloatingTooltip,- useFloatingTooltip,-} from "@/client/components/FloatingTooltip";+ Tooltip as HelpTooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/client/components/ui/tooltip";export type SortField =| "keyword"@@ -110,26 +110,8 @@ export function SortHeader({className?: string;}) {const isActive = field === current;- const tooltip = useFloatingTooltip<HTMLButtonElement>({- enabled: !!helpText,- });-- return (- <button- ref={tooltip.triggerRef}- className={`inline-flex items-center gap-0.5 hover:text-primary transition-colors cursor-pointer select-none ${className ?? ""}`}- onClick={() => onToggle(field)}- onMouseEnter={tooltip.scheduleOpen}- onMouseLeave={tooltip.close}- onFocus={tooltip.scheduleOpen}- onBlur={tooltip.close}- onKeyDown={(e) => {- if (e.key === "Escape") tooltip.close();- }}- aria-describedby={- tooltip.isOpen && helpText ? tooltip.tooltipId : undefined- }- >+ const content = (+ <>{label}{isActive &&(dir === "asc" ? (@@ -137,14 +119,27 @@ export function SortHeader({) : (<ChevronDown className="size-3" />))}- {tooltip.isOpen && helpText && typeof document !== "undefined"- ? createPortal(- <FloatingTooltip id={tooltip.tooltipId} position={tooltip.position}>- {helpText}- </FloatingTooltip>,- document.body,- )- : null}- </button>+ </>+ );+ const buttonClassName = `inline-flex items-center gap-0.5 hover:text-primary transition-colors cursor-pointer select-none ${className ?? ""}`;++ if (!helpText) {+ return (+ <button className={buttonClassName} onClick={() => onToggle(field)}>+ {content}+ </button>+ );+ }+ return (+ <HelpTooltip>+ <TooltipTrigger+ delay={150}+ className={buttonClassName}+ onClick={() => onToggle(field)}+ >+ {content}+ </TooltipTrigger>+ <TooltipContent>{helpText}</TooltipContent>+ </HelpTooltip>);}diff --git a/src/client/features/keywords/components/IntentBadge.tsx b/src/client/features/keywords/components/IntentBadge.tsxindex e345c0b5..180b5ddc 100644--- a/src/client/features/keywords/components/IntentBadge.tsx+++ b/src/client/features/keywords/components/IntentBadge.tsx@@ -1,9 +1,9 @@-import { createPortal } from "react-dom";import type { KeywordIntent } from "@/types/keywords";import {- FloatingTooltip,- useFloatingTooltip,-} from "@/client/components/FloatingTooltip";+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/client/components/ui/tooltip";const COLORS: Record<KeywordIntent, string> = {informational: "border-info/30 bg-info/15 text-info",@@ -62,34 +62,22 @@ const DESCRIPTIONS: Record<};export function IntentBadge({ intent }: { intent: KeywordIntent }) {- const tooltip = useFloatingTooltip<HTMLSpanElement>({ delayMs: 0 });const details = DESCRIPTIONS[intent];return (- <span- ref={tooltip.triggerRef}- className={`inline-flex h-6 min-w-11 cursor-help items-center justify-center rounded-full border px-2 text-xs font-semibold leading-none ${COLORS[intent]}`}- tabIndex={0}- aria-label={`${details.label} search intent`}- aria-describedby={tooltip.isOpen ? tooltip.tooltipId : undefined}- onMouseEnter={tooltip.open}- onMouseLeave={tooltip.close}- onFocus={tooltip.open}- onBlur={tooltip.close}- onKeyDown={(e) => {- if (e.key === "Escape") tooltip.close();- }}- >- {SHORT_LABELS[intent]}- {tooltip.isOpen && typeof document !== "undefined"- ? createPortal(- <FloatingTooltip id={tooltip.tooltipId} position={tooltip.position}>- <span className="block font-semibold">{details.label}</span>- <span className="mt-1 block">{details.description}</span>- </FloatingTooltip>,- document.body,- )- : null}- </span>+ <Tooltip>+ <TooltipTrigger+ delay={0}+ render={<span tabIndex={0} />}+ className={`inline-flex h-6 min-w-11 cursor-help items-center justify-center rounded-full border px-2 text-xs font-semibold leading-none ${COLORS[intent]}`}+ aria-label={`${details.label} search intent`}+ >+ {SHORT_LABELS[intent]}+ </TooltipTrigger>+ <TooltipContent className="flex-col items-start gap-1">+ <span className="font-semibold">{details.label}</span>+ <span>{details.description}</span>+ </TooltipContent>+ </Tooltip>);}diff --git a/src/client/features/keywords/page/KeywordSearchOptions.tsx b/src/client/features/keywords/page/KeywordSearchOptions.tsxindex 5dd14969..c581eb26 100644--- a/src/client/features/keywords/page/KeywordSearchOptions.tsx+++ b/src/client/features/keywords/page/KeywordSearchOptions.tsx@@ -1,6 +1,7 @@import { useId, useState } from "react";import { SlidersHorizontal } from "lucide-react";import { FormDialog } from "@/client/components/FormDialog";+import { Button } from "@/client/components/ui/button";import {Field,FieldContent,@@ -66,15 +67,7 @@ export function KeywordSearchOptions({ controller }: Props) {<FormDialogtitle="Search options"onClose={() => setOpen(false)}- actions={- <button- type="button"- className="btn btn-primary btn-sm"- onClick={() => setOpen(false)}- >- Done- </button>- }+ actions={<Button onClick={() => setOpen(false)}>Done</Button>}><controlsForm.AppField name="resultLimit">{(field) => (diff --git a/src/client/features/projects/project-context/CompetitorsSection.tsx b/src/client/features/projects/project-context/CompetitorsSection.tsxindex 5ddfaf55..f60a6d0e 100644--- a/src/client/features/projects/project-context/CompetitorsSection.tsx+++ b/src/client/features/projects/project-context/CompetitorsSection.tsx@@ -1,8 +1,8 @@import * as React from "react";+import { InlineConfirm } from "@/client/components/InlineConfirm";import { Pencil, Plus } from "lucide-react";import type { ProjectContextUpdate } from "@/types/schemas/projectContext";import {- ConfirmDeleteButton,EmptyState,FormActions,listClass,@@ -132,7 +132,7 @@ export function CompetitorsSection({><Pencil className="size-3.5" /></button>- <ConfirmDeleteButton+ <InlineConfirmlabel={`Remove ${competitor.domain}`}pending={update.isPending}onConfirm={() =>diff --git a/src/client/features/projects/project-context/KeyPagesSection.tsx b/src/client/features/projects/project-context/KeyPagesSection.tsxindex c064180f..74d364a4 100644--- a/src/client/features/projects/project-context/KeyPagesSection.tsx+++ b/src/client/features/projects/project-context/KeyPagesSection.tsx@@ -1,4 +1,5 @@import * as React from "react";+import { InlineConfirm } from "@/client/components/InlineConfirm";import { Pencil, Plus } from "lucide-react";import {KEY_PAGE_ROLES,@@ -6,7 +7,6 @@ import {type ProjectContextUpdate,} from "@/types/schemas/projectContext";import {- ConfirmDeleteButton,EmptyState,FormActions,listClass,@@ -142,7 +142,7 @@ export function KeyPagesSection({><Pencil className="size-3.5" /></button>- <ConfirmDeleteButton+ <InlineConfirmlabel={`Remove ${page.url}`}pending={update.isPending}onConfirm={() =>diff --git a/src/client/features/projects/project-context/ProjectContextPage.tsx b/src/client/features/projects/project-context/ProjectContextPage.tsxindex 9fe311bc..8f1dfa0e 100644--- a/src/client/features/projects/project-context/ProjectContextPage.tsx+++ b/src/client/features/projects/project-context/ProjectContextPage.tsx@@ -1,4 +1,5 @@import * as React from "react";+import { InlineConfirm } from "@/client/components/InlineConfirm";import { useQuery } from "@tanstack/react-query";import { Pencil } from "lucide-react";import { QueryState } from "@/client/components/QueryState";@@ -12,7 +13,6 @@ import {import { CompetitorsSection } from "./CompetitorsSection";import { KeyPagesSection } from "./KeyPagesSection";import {- ConfirmDeleteButton,EmptyState,FormActions,listClass,@@ -269,7 +269,7 @@ function CustomSections({><Pencil className="size-3.5" /></button>- <ConfirmDeleteButton+ <InlineConfirmlabel={`Delete ${custom.title ?? custom.slug}`}pending={update.isPending}onConfirm={() =>@@ -374,7 +374,7 @@ function ResearchLog({</div></div><RowActions>- <ConfirmDeleteButton+ <InlineConfirmlabel={`Delete log entry from ${entry.entryDate}`}pending={update.isPending}onConfirm={() =>diff --git a/src/client/features/projects/project-context/shared.tsx b/src/client/features/projects/project-context/shared.tsxindex 33e5196f..8ac70c6c 100644--- a/src/client/features/projects/project-context/shared.tsx+++ b/src/client/features/projects/project-context/shared.tsx@@ -1,7 +1,6 @@import { formatRelativeTime } from "@/client/lib/relative-time";-import { useState, type ReactNode } from "react";+import type { ReactNode } from "react";import { useMutation, useQueryClient } from "@tanstack/react-query";-import { Trash2 } from "lucide-react";import { toast } from "sonner";import { updateProjectContext } from "@/serverFunctions/projectContext";import type { getProjectContext } from "@/serverFunctions/projectContext";@@ -98,59 +97,6 @@ export function RowActions({ children }: { children: ReactNode }) {return <div className="flex shrink-0 items-center gap-1">{children}</div>;}-/**- * Two-step delete: the trash icon swaps to an explicit Remove/Cancel pair, so- * a stray click can't destroy anything and no native confirm dialog is needed.- */-export function ConfirmDeleteButton({- label,- pending,- onConfirm,-}: {- label: string;- pending: boolean;- onConfirm: () => void;-}) {- const [confirming, setConfirming] = useState(false);-- if (confirming) {- return (- <>- <button- type="button"- className="btn btn-error btn-xs"- disabled={pending}- onClick={() => {- setConfirming(false);- onConfirm();- }}- >- Remove- </button>- <button- type="button"- className="btn btn-ghost btn-xs"- onClick={() => setConfirming(false)}- >- Cancel- </button>- </>- );- }-- return (- <button- type="button"- className="btn btn-ghost btn-xs text-error"- aria-label={label}- disabled={pending}- onClick={() => setConfirming(true)}- >- <Trash2 className="size-3.5" />- </button>- );-}-export function FormActions({pending,disabled,diff --git a/src/client/features/rank-tracking/RankTrackingDomainDetail.tsx b/src/client/features/rank-tracking/RankTrackingDomainDetail.tsxindex e3dcf46c..1d98a3f2 100644--- a/src/client/features/rank-tracking/RankTrackingDomainDetail.tsx+++ b/src/client/features/rank-tracking/RankTrackingDomainDetail.tsx@@ -325,9 +325,8 @@ export function RankTrackingDomainDetail({onSearchChange({ view: view === "history" ? view : undefined })}historyAvailable={historyAvailable}- onExport={() => exportFiltered("csv")}- onExportToSheets={() => exportFiltered("sheets")}- onCopyKeywords={() => {+ onExport={(action) => {+ if (action !== "copy-list") return exportFiltered(action);void navigator.clipboard.writeText(filtered.map((r) => r.keyword).join("\n"),);diff --git a/src/client/features/rank-tracking/RankTrackingTableToolbar.tsx b/src/client/features/rank-tracking/RankTrackingTableToolbar.tsxindex 27e8bc4e..97131411 100644--- a/src/client/features/rank-tracking/RankTrackingTableToolbar.tsx+++ b/src/client/features/rank-tracking/RankTrackingTableToolbar.tsx@@ -1,6 +1,7 @@import { CalendarDays, Loader2, SlidersHorizontal, Table } from "lucide-react";import { SegmentedToggle } from "@/client/components/SegmentedToggle";-import { ExportMenu, MoreMenu } from "./ToolbarMenus";+import { ExportMenu } from "@/client/components/ExportMenu";+import { MoreMenu } from "./ToolbarMenus";export function RankTrackingTableToolbar({showFilters,@@ -13,8 +14,6 @@ export function RankTrackingTableToolbar({onViewModeChange,historyAvailable,onExport,- onExportToSheets,- onCopyKeywords,onCheckNow,onRefreshMetrics,metricsRefreshing,@@ -35,9 +34,7 @@ export function RankTrackingTableToolbar({viewMode: "table" | "history";onViewModeChange: (v: "table" | "history") => void;historyAvailable: boolean;- onExport: () => void;- onExportToSheets: () => void;- onCopyKeywords: () => void;+ onExport: (action: "sheets" | "csv" | "copy-list") => void;onCheckNow: () => void;onRefreshMetrics: () => void;metricsRefreshing: boolean;@@ -110,10 +107,10 @@ export function RankTrackingTableToolbar({<div className="flex-1" /><ExportMenu+ actions={["sheets", "csv", "copy-list"]}+ copyListLabel="Copy keywords"onExport={onExport}- onExportToSheets={onExportToSheets}- onCopyKeywords={onCopyKeywords}- hasData={hasData}+ disabled={!hasData}/>{/* Both actions need a paid plan; free users get the page's upgradediff --git a/src/client/features/rank-tracking/ToolbarMenus.tsx b/src/client/features/rank-tracking/ToolbarMenus.tsxindex 0a5fb292..f9cf7516 100644--- a/src/client/features/rank-tracking/ToolbarMenus.tsx+++ b/src/client/features/rank-tracking/ToolbarMenus.tsx@@ -1,88 +1,26 @@-import { useState, type ReactNode } from "react";-import {- ChevronDown,- Copy,- Download,- FileDown,- MoreHorizontal,- Play,- RefreshCw,- Sheet,-} from "lucide-react";+import { useState } from "react";+import { MoreHorizontal, Play, RefreshCw } from "lucide-react";import { ConfirmDialog } from "@/client/components/ConfirmDialog";+import { Button } from "@/client/components/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+} from "@/client/components/ui/dropdown-menu";-function ToolbarMenu({- label,- icon,- title,- children,-}: {- label?: string;- icon?: ReactNode;- title?: string;- children: ReactNode;-}) {- const [open, setOpen] = useState(false);- return (- <div className="relative">- <button- type="button"- className={`btn btn-ghost btn-sm ${label ? "gap-1" : "btn-square"}`}- onClick={() => setOpen((c) => !c)}- title={title}- aria-label={title ?? label}- aria-haspopup="menu"- aria-expanded={open}- >- {icon}- {label}- {label && <ChevronDown className="size-3.5 opacity-60" />}- </button>- {open && (- <>- <div className="fixed inset-0 z-40" onClick={() => setOpen(false)} />- <div- role="menu"- className="absolute right-0 top-full mt-1 z-50 rounded-lg border border-base-300 bg-base-100 shadow-lg py-1 min-w-[230px]"- onClick={() => setOpen(false)}- >- {children}- </div>- </>- )}- </div>- );-}--function MenuItem({- icon,+function ItemText({label,description,- onClick,- disabled,}: {- icon: ReactNode;label: string;- description?: string;- onClick: () => void;- disabled?: boolean;+ description: string;}) {return (- <button- type="button"- role="menuitem"- className="flex w-full items-start gap-2 px-3 py-2 text-sm hover:bg-base-200 disabled:opacity-50"- onClick={onClick}- disabled={disabled}- >- <span className="mt-0.5 shrink-0">{icon}</span>- <span className="flex flex-col items-start text-left">- <span>{label}</span>- {description && (- <span className="text-xs text-base-content/50">{description}</span>- )}- </span>- </button>+ <span className="flex flex-col">+ <span>{label}</span>+ <span className="text-xs text-muted-foreground">{description}</span>+ </span>);}@@ -104,34 +42,49 @@ export function MoreMenu({const [confirmingRefresh, setConfirmingRefresh] = useState(false);return (<>- <ToolbarMenu- icon={<MoreHorizontal className="size-4" />}- title="More actions"- >- <MenuItem- icon={<Play className="size-3.5" />}- label={checkBusy ? "Running..." : "Check rankings"}- description="Fetch current Google positions"- onClick={onCheckNow}- disabled={checkBusy}- />- <MenuItem- icon={- <RefreshCw- className={`size-3.5 ${metricsRefreshing ? "animate-spin" : ""}`}+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <Button+ variant="ghost"+ size="icon-sm"+ aria-label="More actions"+ title="More actions"/>}- label={metricsRefreshing ? "Refreshing..." : "Update keyword stats"}- description="Volume, difficulty & CPC — not rankings"- onClick={() => setConfirmingRefresh(true)}- disabled={metricsRefreshing || !hasData}- />- </ToolbarMenu>+ >+ <MoreHorizontal />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="w-60">+ <DropdownMenuItem onClick={onCheckNow} disabled={checkBusy}>+ <Play />+ <ItemText+ label={checkBusy ? "Running..." : "Check rankings"}+ description="Fetch current Google positions"+ />+ </DropdownMenuItem>+ <DropdownMenuItem+ onClick={() => setConfirmingRefresh(true)}+ disabled={metricsRefreshing || !hasData}+ >+ <RefreshCw className={metricsRefreshing ? "animate-spin" : ""} />+ <ItemText+ label={+ metricsRefreshing ? "Refreshing..." : "Update keyword stats"+ }+ description="Volume, difficulty & CPC — not rankings"+ />+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>{confirmingRefresh ? (<ConfirmDialogtitle="Update keyword stats?"confirmLabel="Update stats"- onConfirm={onRefreshMetrics}+ onConfirm={() => {+ setConfirmingRefresh(false);+ onRefreshMetrics();+ }}onClose={() => setConfirmingRefresh(false)}>This fetches new volume, difficulty, and CPC for all{" "}@@ -143,38 +96,3 @@ export function MoreMenu({</>);}--export function ExportMenu({- onExport,- onExportToSheets,- onCopyKeywords,- hasData,-}: {- onExport: () => void;- onExportToSheets: () => void;- onCopyKeywords: () => void;- hasData: boolean;-}) {- return (- <ToolbarMenu label="Export" icon={<Download className="size-3.5" />}>- <MenuItem- icon={<Sheet className="size-3.5" />}- label="Export to Sheets"- onClick={onExportToSheets}- disabled={!hasData}- />- <MenuItem- icon={<FileDown className="size-3.5" />}- label="Export CSV"- onClick={onExport}- disabled={!hasData}- />- <MenuItem- icon={<Copy className="size-3.5" />}- label="Copy keywords"- onClick={onCopyKeywords}- disabled={!hasData}- />- </ToolbarMenu>- );-}diff --git a/src/client/features/reports/ReportTemplatesList.tsx b/src/client/features/reports/ReportTemplatesList.tsxindex 3e6bf9bc..ddc32e69 100644--- a/src/client/features/reports/ReportTemplatesList.tsx+++ b/src/client/features/reports/ReportTemplatesList.tsx@@ -1,5 +1,6 @@import { Pencil, Trash2 } from "lucide-react";-import { PortalMenu } from "@/client/components/PortalMenu";+import { RowActionsMenu } from "@/client/components/RowActionsMenu";+import { DropdownMenuItem } from "@/client/components/ui/dropdown-menu";import { formatRelativeTime } from "@/client/lib/relative-time";import type { ReportTemplate } from "@/types/schemas/report-templates";@@ -51,35 +52,19 @@ export function ReportTemplatesList({{formatRelativeTime(template.updatedAt)}</td><td className="w-10 text-right">- <PortalMenu ariaLabel={`Actions for ${template.name}`}>- {(close) => (- <>- <li>- <button- onClick={() => {- close();- onEdit(template);- }}- >- <Pencil className="size-3.5" />- Edit- </button>- </li>- <li>- <button- className="text-error"- onClick={() => {- close();- onDelete(template);- }}- >- <Trash2 className="size-3.5" />- Delete- </button>- </li>- </>- )}- </PortalMenu>+ <RowActionsMenu label={`Actions for ${template.name}`}>+ <DropdownMenuItem onClick={() => onEdit(template)}>+ <Pencil />+ Edit+ </DropdownMenuItem>+ <DropdownMenuItem+ variant="destructive"+ onClick={() => onDelete(template)}+ >+ <Trash2 />+ Delete+ </DropdownMenuItem>+ </RowActionsMenu></td></tr>))}diff --git a/src/client/features/reports/shared.tsx b/src/client/features/reports/shared.tsxindex 8eaf4c20..7eb6de2a 100644--- a/src/client/features/reports/shared.tsx+++ b/src/client/features/reports/shared.tsx@@ -2,7 +2,7 @@ import { formatRelativeTime } from "@/client/lib/relative-time";import { useMutation, useQueryClient } from "@tanstack/react-query";import { Copy, ExternalLink, X } from "lucide-react";import { toast } from "sonner";-import { ConfirmDeleteModal } from "@/client/components/ConfirmDeleteModal";+import { ConfirmDialog } from "@/client/components/ConfirmDialog";import { Modal } from "@/client/components/Modal";import { getStandardErrorMessage } from "@/client/lib/error-messages";import { captureClientEvent } from "@/client/lib/posthog";@@ -78,14 +78,16 @@ export function DeleteReportModal({onConfirm: () => void;}) {return (- <ConfirmDeleteModal+ <ConfirmDialogtitle={`Delete \u201c${title}\u201d?`}- detail="This cannot be undone."confirmLabel="Delete report"- isPending={isPending}+ destructive+ pending={isPending}onClose={onClose}onConfirm={onConfirm}- />+ >+ This cannot be undone.+ </ConfirmDialog>);}diff --git a/src/client/features/saved-keywords/SavedKeywordsHeader.tsx b/src/client/features/saved-keywords/SavedKeywordsHeader.tsxindex b7e8f47e..14de7b3e 100644--- a/src/client/features/saved-keywords/SavedKeywordsHeader.tsx+++ b/src/client/features/saved-keywords/SavedKeywordsHeader.tsx@@ -1,14 +1,14 @@import { useState } from "react";-import {- ChevronDown,- Download,- FileDown,- Loader2,- RefreshCw,- Sheet,-} from "lucide-react";+import { ChevronDown, RefreshCw } from "lucide-react";import { ConfirmDialog } from "@/client/components/ConfirmDialog";-import { closeDropdown } from "@/client/lib/dropdown";+import { ExportMenu } from "@/client/components/ExportMenu";+import { Button } from "@/client/components/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+} from "@/client/components/ui/dropdown-menu";export function SavedKeywordsHeader({totalCount,@@ -39,92 +39,54 @@ export function SavedKeywordsHeader({</div><div className="flex items-center gap-2">- <div className="dropdown dropdown-end">- <button- type="button"- tabIndex={0}- disabled={disabled || metricsRefreshing}- aria-haspopup="menu"- className={`btn btn-ghost btn-sm gap-1.5 ${disabled || metricsRefreshing ? "btn-disabled" : ""}`}+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <Button+ variant="ghost"+ size="sm"+ disabled={disabled || metricsRefreshing}+ />+ }><RefreshCw- className={`size-4 ${metricsRefreshing ? "animate-spin" : ""}`}+ data-icon="inline-start"+ className={metricsRefreshing ? "animate-spin" : ""}/>{metricsRefreshing ? "Updating..." : "Actions"}- <ChevronDown className="size-3 opacity-60" />- </button>- <ul- tabIndex={0}- role="menu"- className="dropdown-content menu z-10 w-64 rounded-box border border-base-300 bg-base-100 p-2 shadow-lg"- >- <li>- <button- type="button"- onClick={() => {- closeDropdown();- setConfirmingRefresh(true);- }}- disabled={disabled || metricsRefreshing}- >- <RefreshCw className="size-4" />- <span className="flex flex-col items-start">- <span>Update keyword stats</span>- <span className="text-xs text-base-content/50">- Volume, difficulty & CPC- </span>+ <ChevronDown data-icon="inline-end" className="opacity-60" />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="w-64">+ <DropdownMenuItem onClick={() => setConfirmingRefresh(true)}>+ <RefreshCw />+ <span className="flex flex-col">+ <span>Update keyword stats</span>+ <span className="text-xs text-muted-foreground">+ Volume, difficulty & CPC</span>- </button>- </li>- </ul>- </div>+ </span>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>- <div className="dropdown dropdown-end">- <button- type="button"- tabIndex={0}- disabled={disabled}- aria-haspopup="menu"- className={`btn btn-ghost btn-sm gap-1.5 ${disabled ? "btn-disabled" : ""}`}- >- {exporting != null ? (- <Loader2 className="size-4 animate-spin" />- ) : (- <Download className="size-4" />- )}- Export- <ChevronDown className="size-3 opacity-60" />- </button>- <ul- tabIndex={0}- role="menu"- className="dropdown-content menu z-10 w-56 rounded-box border border-base-300 bg-base-100 p-2 shadow-lg"- >- <li>- <button- type="button"- onClick={onExportSheets}- disabled={disabled}- >- <Sheet className="size-4" />- Export to Sheets- </button>- </li>- <li>- <button type="button" onClick={onExportCsv} disabled={disabled}>- <FileDown className="size-4" />- Export CSV- </button>- </li>- </ul>- </div>+ <ExportMenu+ actions={["sheets", "csv"]}+ busy={exporting != null}+ disabled={disabled}+ onExport={(action) =>+ action === "sheets" ? onExportSheets() : onExportCsv()+ }+ /></div>{confirmingRefresh ? (<ConfirmDialogtitle="Update keyword stats?"confirmLabel="Update stats"- onConfirm={onRefreshMetrics}+ onConfirm={() => {+ setConfirmingRefresh(false);+ onRefreshMetrics();+ }}onClose={() => setConfirmingRefresh(false)}>This fetches new volume, difficulty, and CPC for every saved keyworddiff --git a/src/client/features/settings/ApiKeySettings.tsx b/src/client/features/settings/ApiKeySettings.tsxindex 34e11146..90541798 100644--- a/src/client/features/settings/ApiKeySettings.tsx+++ b/src/client/features/settings/ApiKeySettings.tsx@@ -3,7 +3,18 @@ import { QueryState } from "@/client/components/QueryState";import { Trash2 } from "lucide-react";import { useState } from "react";import { toast } from "sonner";-import { PortalMenu } from "@/client/components/PortalMenu";+import { ConfirmDialog } from "@/client/components/ConfirmDialog";+import { Button } from "@/client/components/ui/button";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from "@/client/components/ui/dialog";+import { RowActionsMenu } from "@/client/components/RowActionsMenu";+import { DropdownMenuItem } from "@/client/components/ui/dropdown-menu";import { CopyButton } from "@/client/features/ai-mcp/SetupControls";import { captureClientEvent } from "@/client/lib/posthog";import { authClient } from "@/lib/auth-client";@@ -16,6 +27,9 @@ export function ApiKeySettings() {const [isCreateOpen, setIsCreateOpen] = useState(false);const [name, setName] = useState("");const [createdKey, setCreatedKey] = useState<string | null>(null);+ const [revoking, setRevoking] = useState<{ id: string; name: string } | null>(+ null,+ );const mcpUrl =typeof window === "undefined"@@ -65,6 +79,7 @@ export function ApiKeySettings() {onSuccess: () => {captureClientEvent("mcp:api_key_revoked");toast.success("API key revoked");+ setRevoking(null);void queryClient.invalidateQueries({ queryKey: ["apiKeys"] });},});@@ -147,34 +162,22 @@ export function ApiKeySettings() {: "Never"}</td><td>- <PortalMenu- ariaLabel={`Actions for ${key.name || "API key"}`}+ <RowActionsMenu+ label={`Actions for ${key.name || "API key"}`}>- {(close) => (- <li>- <button- className="text-error"- disabled={- revokeMutation.isPending &&- revokeMutation.variables === key.id- }- onClick={() => {- close();- if (- window.confirm(- `Revoke "${key.name || "Unnamed key"}"? Clients using it will stop working.`,- )- ) {- revokeMutation.mutate(key.id);- }- }}- >- <Trash2 className="size-3.5" />- Revoke key- </button>- </li>- )}- </PortalMenu>+ <DropdownMenuItem+ variant="destructive"+ onClick={() =>+ setRevoking({+ id: key.id,+ name: key.name || "Unnamed key",+ })+ }+ >+ <Trash2 />+ Revoke key+ </DropdownMenuItem>+ </RowActionsMenu></td></tr>))}@@ -185,91 +188,98 @@ export function ApiKeySettings() {}</QueryState>- {isCreateOpen ? (- <div className="modal modal-open">- <div className="modal-box max-w-md">- {createdKey ? (- <>- <h3 className="text-lg font-bold">Copy your new API key</h3>- <p className="mt-2 text-sm text-base-content/60">+ {revoking ? (+ <ConfirmDialog+ title={`Revoke \u201c${revoking.name}\u201d?`}+ confirmLabel="Revoke key"+ destructive+ pending={revokeMutation.isPending}+ onClose={() => setRevoking(null)}+ onConfirm={() => revokeMutation.mutate(revoking.id)}+ >+ Clients using it will stop working.+ </ConfirmDialog>+ ) : null}++ <Dialog+ open={isCreateOpen}+ // The key is shown once, so only Done closes the reveal step. Escape+ // and an outside click close the name step.+ onOpenChange={(open) => {+ if (!open && createdKey == null) closeCreateModal();+ }}+ >+ <DialogContent showCloseButton={false} className="sm:max-w-md">+ {createdKey ? (+ <>+ <DialogHeader>+ <DialogTitle>Copy your new API key</DialogTitle>+ <DialogDescription>It won't be shown again. Send it as{" "}<span className="font-mono text-xs">Authorization: Bearer</span>{" "}to <span className="font-mono text-xs">{mcpUrl}</span>.- </p>- <div className="mt-4 flex items-center gap-2">- <code- className="min-w-0 flex-1 overflow-x-auto rounded bg-base-200 px-2.5 py-2 font-mono text-xs"- data-ph-mask- >- {createdKey}- </code>- <CopyButton- value={createdKey}- successMessage="API key copied"- iconOnly- />- </div>- <div className="modal-action">- <button- type="button"- className="btn btn-primary btn-sm"- onClick={closeCreateModal}- >- Done- </button>- </div>- </>- ) : (- <form- onSubmit={(event) => {- event.preventDefault();- if (name.trim()) createMutation.mutate(name.trim());- }}- >- <h3 className="text-lg font-bold">Create API key</h3>- <label className="form-control mt-4 w-full">- <span className="label-text pb-1 text-xs text-base-content/60">- Name- </span>- <input- className="input input-sm input-bordered w-full"- placeholder="Claude Code on laptop"- value={name}- maxLength={MAX_KEY_NAME_LENGTH}- onChange={(event) => setName(event.currentTarget.value)}- required- autoFocus- />- </label>- <div className="modal-action">- <button- type="button"- className="btn btn-ghost btn-sm"- onClick={closeCreateModal}- >- Cancel- </button>- <button- type="submit"- className="btn btn-primary btn-sm"- disabled={createMutation.isPending || !name.trim()}- >- {createMutation.isPending ? "Creating…" : "Create"}- </button>- </div>- </form>- )}- </div>- {/* No backdrop close on the reveal step: the key is shown once. */}- {createdKey ? (- <div className="modal-backdrop" />+ </DialogDescription>+ </DialogHeader>+ <div className="flex items-center gap-2">+ <code+ className="min-w-0 flex-1 overflow-x-auto rounded bg-base-200 px-2.5 py-2 font-mono text-xs"+ data-ph-mask+ >+ {createdKey}+ </code>+ <CopyButton+ value={createdKey}+ successMessage="API key copied"+ iconOnly+ />+ </div>+ <DialogFooter>+ <Button onClick={closeCreateModal}>Done</Button>+ </DialogFooter>+ </>) : (- <div className="modal-backdrop" onClick={closeCreateModal} />+ <form+ className="grid gap-4"+ onSubmit={(event) => {+ event.preventDefault();+ if (name.trim()) createMutation.mutate(name.trim());+ }}+ >+ <DialogHeader>+ <DialogTitle>Create API key</DialogTitle>+ </DialogHeader>+ <label className="form-control w-full">+ <span className="label-text pb-1 text-xs text-base-content/60">+ Name+ </span>+ <input+ className="input input-sm input-bordered w-full"+ placeholder="Claude Code on laptop"+ value={name}+ maxLength={MAX_KEY_NAME_LENGTH}+ onChange={(event) => setName(event.currentTarget.value)}+ required+ autoFocus+ />+ </label>+ <DialogFooter>+ <Button variant="ghost" onClick={closeCreateModal}>+ Cancel+ </Button>+ <Button+ type="submit"+ pending={createMutation.isPending}+ disabled={!name.trim()}+ >+ Create+ </Button>+ </DialogFooter>+ </form>)}- </div>- ) : null}+ </DialogContent>+ </Dialog></section>);}diff --git a/src/routes/_app/ai.tsx b/src/routes/_app/ai.tsxindex deb94679..945be7c1 100644--- a/src/routes/_app/ai.tsx+++ b/src/routes/_app/ai.tsx@@ -1,5 +1,10 @@import { createFileRoute } from "@tanstack/react-router";-import { useState } from "react";+import {+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+} from "@/client/components/ui/tabs";import { ArrowUpRight, ShieldAlert } from "lucide-react";import { getAuthMode } from "@/lib/auth-mode";import { captureClientEvent } from "@/client/lib/posthog";@@ -42,7 +47,6 @@ function AiPage() {const origin = window.location.origin;const mcpUrl = `${origin}/mcp`;const prompt = getAgentSetupPrompt(origin);- const [tab, setTab] = useState<"setup" | "skills">("setup");return (<div className="h-full overflow-auto bg-base-100 px-4 py-12 md:px-6 md:py-16 pb-24 md:pb-12">@@ -53,28 +57,12 @@ function AiPage() {already use. Set it up once, then ask it anything.</p>- <div role="tablist" className="tabs tabs-border mt-8 w-fit">- {(- [- ["setup", "Set up your agent"],- ["skills", "Skills"],- ] as const- ).map(([id, label]) => (- <button- key={id}- type="button"- role="tab"- aria-selected={tab === id}- className={`tab ${tab === id ? "tab-active" : ""}`}- onClick={() => setTab(id)}- >- {label}- </button>- ))}- </div>-- {tab === "setup" ? (- <>+ <Tabs defaultValue="setup" className="mt-8">+ <TabsList variant="line">+ <TabsTrigger value="setup">Set up your agent</TabsTrigger>+ <TabsTrigger value="skills">Skills</TabsTrigger>+ </TabsList>+ <TabsContent value="setup"><div className="mt-6 space-y-5"><section className="rounded-xl border border-base-300 p-5 sm:p-6"><h2 className="text-base font-semibold">Set up your agent</h2>@@ -174,33 +162,34 @@ function AiPage() {onCopy={() => captureClientEvent("mcp:setup_url_copy")}/></div>- </>- ) : (- <section className="mt-6">- <p className="text-sm text-base-content/60">- The setup prompt installs these. Run one by name when you want a- full report instead of a quick answer.- </p>- <ul className="mt-5 space-y-3 text-sm sm:space-y-2">- {SKILLS.map(([name, blurb]) => (- <li- key={name}- className="flex flex-col gap-0.5 sm:flex-row sm:gap-3"- >- <a- href={`https://openseo.so/docs/skills/${name}`}- target="_blank"- rel="noreferrer"- className="shrink-0 font-mono text-[13px] text-base-content underline decoration-base-content/25 underline-offset-4 hover:decoration-base-content sm:w-48"+ </TabsContent>+ <TabsContent value="skills">+ <section className="mt-6">+ <p className="text-sm text-base-content/60">+ The setup prompt installs these. Run one by name when you want a+ full report instead of a quick answer.+ </p>+ <ul className="mt-5 space-y-3 text-sm sm:space-y-2">+ {SKILLS.map(([name, blurb]) => (+ <li+ key={name}+ className="flex flex-col gap-0.5 sm:flex-row sm:gap-3">- /{name}- </a>- <span className="text-base-content/60">{blurb}</span>- </li>- ))}- </ul>- </section>- )}+ <a+ href={`https://openseo.so/docs/skills/${name}`}+ target="_blank"+ rel="noreferrer"+ className="shrink-0 font-mono text-[13px] text-base-content underline decoration-base-content/25 underline-offset-4 hover:decoration-base-content sm:w-48"+ >+ /{name}+ </a>+ <span className="text-base-content/60">{blurb}</span>+ </li>+ ))}+ </ul>+ </section>+ </TabsContent>+ </Tabs></div></div>);diff --git a/src/routes/_app/p/$projectId/reports/templates.tsx b/src/routes/_app/p/$projectId/reports/templates.tsxindex 9b99ffc3..98f5554a 100644--- a/src/routes/_app/p/$projectId/reports/templates.tsx+++ b/src/routes/_app/p/$projectId/reports/templates.tsx@@ -3,7 +3,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";import { useState } from "react";import { ChevronLeft, Plus } from "lucide-react";import { toast } from "sonner";-import { ConfirmDeleteModal } from "@/client/components/ConfirmDeleteModal";+import { ConfirmDialog } from "@/client/components/ConfirmDialog";import { QueryState } from "@/client/components/QueryState";import { ReportTemplateForm } from "@/client/features/reports/ReportTemplateForm";import { ReportTemplatesList } from "@/client/features/reports/ReportTemplatesList";@@ -118,14 +118,16 @@ function ReportTemplatesPage() {) : null}{pendingDelete ? (- <ConfirmDeleteModal+ <ConfirmDialogtitle={`Delete \u201c${pendingDelete.name}\u201d?`}- detail="Reports already written from it are not affected."confirmLabel="Delete template"- isPending={deleteMutation.isPending}+ destructive+ pending={deleteMutation.isPending}onClose={() => setPendingDelete(null)}onConfirm={() => deleteMutation.mutate(pendingDelete.id)}- />+ >+ Reports already written from it are not affected.+ </ConfirmDialog>) : null}</div>);diff --git a/src/routes/_app/p/$projectId/settings.tsx b/src/routes/_app/p/$projectId/settings.tsxindex d96f0fac..1aba97ab 100644--- a/src/routes/_app/p/$projectId/settings.tsx+++ b/src/routes/_app/p/$projectId/settings.tsx@@ -1,4 +1,5 @@import { createFileRoute, Link, Outlet } from "@tanstack/react-router";+import { NavTab, NavTabs } from "@/client/components/NavTabs";import { projectsQueryOptions } from "@/client/features/projects/projectQueries";import { useQuery } from "@tanstack/react-query";import { ChevronLeft } from "lucide-react";@@ -36,25 +37,18 @@ function ProjectSettingsLayout() {{project?.name ?? " "}</p></div>- <div role="tablist" className="tabs tabs-border">+ <NavTabs label="Project settings sections">{tabs.map((tab) => (- <Link+ <NavTabkey={tab.to}- role="tab"to={tab.to}params={{ projectId }}activeOptions={{ exact: tab.exact ?? false }}- className="tab"- activeProps={{- className: "tab-active",- "aria-selected": true,- }}- inactiveProps={{ "aria-selected": false }}>{tab.label}- </Link>+ </NavTab>))}- </div>+ </NavTabs></div><Outlet />diff --git a/src/routes/_app/settings.tsx b/src/routes/_app/settings.tsxindex 33fa486b..64a8095f 100644--- a/src/routes/_app/settings.tsx+++ b/src/routes/_app/settings.tsx@@ -1,4 +1,5 @@-import { createFileRoute, Link, Outlet } from "@tanstack/react-router";+import { createFileRoute, Outlet } from "@tanstack/react-router";+import { NavTab, NavTabs } from "@/client/components/NavTabs";import { isHostedClientAuthMode } from "@/lib/auth-mode";export const Route = createFileRoute("/_app/settings")({@@ -22,24 +23,17 @@ function SettingsLayout() {<div className="mx-auto w-full max-w-4xl space-y-8 p-4 py-8 pb-24 sm:p-6 md:py-12 md:pb-12"><div className="space-y-4"><h1 className="text-2xl font-bold tracking-tight">Settings</h1>- <div role="tablist" className="tabs tabs-border">+ <NavTabs label="Settings sections">{tabs.map((tab) => (- <Link+ <NavTabkey={tab.to}- role="tab"to={tab.to}activeOptions={{ exact: tab.exact ?? false }}- className="tab"- activeProps={{- className: "tab-active",- "aria-selected": true,- }}- inactiveProps={{ "aria-selected": false }}>{tab.label}- </Link>+ </NavTab>))}- </div>+ </NavTabs></div><Outlet />