Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

feat(action-center): move the drawer's copy and export buttons into its top row (#1146)

Cihanc2cb0bd01b62
diff --git a/web/messages/en.json b/web/messages/en.json
index 89c701c02..37ddc7d75 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -942,6 +942,7 @@
},
"export": {
"copyAll": "Copy Data",
+ "menu": "Export",
"csv": "Export CSV",
"excel": "Export Excel",
"copied": "Action {ref} copied: {entity, select, prompts {{affected, plural, one {# prompt} other {# prompts}}, } pages {{affected, plural, one {# page} other {# pages}}, } other {}}{tasks, plural, one {# task} other {# tasks}}, {signals, plural, one {# signal} other {# signals}}",
diff --git a/web/src/components/action-center/action-drawer.tsx b/web/src/components/action-center/action-drawer.tsx
index 0116525d4..d4527172e 100644
--- a/web/src/components/action-center/action-drawer.tsx
+++ b/web/src/components/action-center/action-drawer.tsx
@@ -240,7 +240,8 @@ export function ActionDrawer({
return (
<Sheet open={Boolean(action)} onOpenChange={onOpenChange}>
<SheetContent className="flex flex-col gap-0 p-0 data-[side=right]:w-full data-[side=right]:sm:max-w-xl">
- <SheetHeader className="border-b px-6 py-4 pr-12">
+ {/* pt-3: the top row's buttons line up with the sheet's close button. */}
+ <SheetHeader className="border-b px-6 pt-3 pb-4 pr-12">
<div className="flex flex-wrap items-center gap-2 text-xs">
<Badge variant="outline" className="text-[10px]">
{tCategories(action.category)}
@@ -248,9 +249,18 @@ export function ActionDrawer({
{action.priorityScore !== null && (
<PriorityBadge score={action.priorityScore} level={action.priorityLevel} />
)}
- <span className="ml-auto text-muted-foreground">
- {t('drawer.actionId')}: AC-{action.actionNo}
- </span>
+ <div className="ml-auto flex items-center gap-2">
+ <ActionExportButtons
+ action={action}
+ detail={ready ? detail : null}
+ affected={affected}
+ volumes={volumes}
+ story={story}
+ />
+ <span className="text-muted-foreground">
+ {t('drawer.actionId')}: AC-{action.actionNo}
+ </span>
+ </div>
</div>
<div className="flex items-start gap-3">
<div className="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-md border bg-muted/40">
@@ -285,13 +295,6 @@ export function ActionDrawer({
</Badge>
))}
</div>
- <ActionExportButtons
- action={action}
- detail={ready ? detail : null}
- affected={affected}
- volumes={volumes}
- story={story}
- />
</SheetHeader>
{/* Who has it, where it stands and by when: ahead of the tabs, so they
diff --git a/web/src/components/action-center/action-export-buttons.test.tsx b/web/src/components/action-center/action-export-buttons.test.tsx
index 6a8defa56..e4b109706 100644
--- a/web/src/components/action-center/action-export-buttons.test.tsx
+++ b/web/src/components/action-center/action-export-buttons.test.tsx
@@ -57,6 +57,18 @@ function render(node: React.ReactNode) {
const button = (name: string) =>
[...container.querySelectorAll('button')].find((b) => b.textContent === name)!;
+/** Opens the Export menu and picks one of its items. */
+async function exportAs(name: string) {
+ const trigger = button('Export');
+ await act(async () => {
+ trigger.dispatchEvent(new MouseEvent('pointerdown', { bubbles: true }));
+ trigger.click();
+ });
+ const items = [...document.querySelectorAll<HTMLElement>('[role="menuitem"]')];
+ expect(items.map((item) => item.textContent)).toEqual(['Export CSV', 'Export Excel']);
+ await act(async () => items.find((item) => item.textContent === name)!.click());
+}
+
const action = {
id: 'a1',
actionNo: 52,
@@ -148,9 +160,7 @@ afterEach(() => {
describe('ActionExportButtons', () => {
it('waits for the action to load', () => {
render(<ActionExportButtons action={action} detail={null} />);
- expect(
- ['Copy Data', 'Export CSV', 'Export Excel'].map((name) => button(name).disabled),
- ).toEqual([true, true, true]);
+ expect(['Copy Data', 'Export'].map((name) => button(name).disabled)).toEqual([true, true]);
});
const copyButton = () =>
@@ -318,7 +328,7 @@ describe('ActionExportButtons', () => {
saved[saved.length - 1].name = this.download;
});
render(<ActionExportButtons action={action} detail={detail} />);
- await act(async () => button('Export CSV').click());
+ await exportAs('Export CSV');
click.mockRestore();
expect(saved[0].name).toBe('action-AC-52.csv');
const bytes = await new Promise<Uint8Array>((resolve) => {
@@ -334,7 +344,7 @@ describe('ActionExportButtons', () => {
it('writes an Excel workbook with a sheet per tab', async () => {
render(<ActionExportButtons action={action} detail={detail} />);
- await act(async () => button('Export Excel').click());
+ await exportAs('Export Excel');
expect(written).toHaveLength(1);
expect(written[0].sheets.map((s) => s.sheet)).toEqual([
'Action',
diff --git a/web/src/components/action-center/action-export-buttons.tsx b/web/src/components/action-center/action-export-buttons.tsx
index 8e323c05b..6d4e79b6f 100644
--- a/web/src/components/action-center/action-export-buttons.tsx
+++ b/web/src/components/action-center/action-export-buttons.tsx
@@ -3,9 +3,15 @@
import { useRef, useState } from 'react';
import { useTranslations } from 'next-intl';
import { toast } from 'sonner';
-import { Check, Copy, FileDown, FileSpreadsheet } from 'lucide-react';
+import { Check, Copy, Download, FileDown, FileSpreadsheet } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu';
import type { ActionDetail, ActionItem } from '@/lib/actions/action-center';
import { getOpportunity, getOpportunityBasket } from '@/lib/actions/content';
import {
@@ -33,7 +39,7 @@ import { saveBlob } from '@/lib/download';
* tab of the drawer shows, to take into a doc, a ticket or a spreadsheet.
* Disabled until the drawer has loaded the action's detail. Copy Data opens the
* whole action as Markdown: select any part to copy it, or copy it all with
- * the icon.
+ * the icon. CSV and Excel share an Export menu.
*/
export function ActionExportButtons({
action,
@@ -185,29 +191,44 @@ export function ActionExportButtons({
const disabled = !detail || isBusy;
return (
<>
- <div className="flex flex-wrap gap-2">
- <Button variant="outline" size="sm" disabled={disabled} onClick={() => void run(showData)}>
- <Copy className="h-4 w-4" />
- {tExport('copyAll')}
- </Button>
- <Button
- variant="outline"
- size="sm"
- disabled={disabled}
- onClick={() => void run(downloadCsv)}
- >
- <FileDown className="h-4 w-4" />
- {tExport('csv')}
- </Button>
+ {/* The size of Site Audit's Export menu: they sit in the drawer's top row. */}
+ <div className="flex items-center gap-1.5">
<Button
variant="outline"
size="sm"
+ className="h-7 gap-1.5 text-xs"
disabled={disabled}
- onClick={() => void run(downloadExcel)}
+ onClick={() => void run(showData)}
>
- <FileSpreadsheet className="h-4 w-4" />
- {tExport('excel')}
+ <Copy className="h-3 w-3" />
+ {tExport('copyAll')}
</Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="outline"
+ size="sm"
+ className="h-7 gap-1.5 text-xs"
+ disabled={disabled}
+ />
+ }
+ >
+ <Download className="h-3 w-3" />
+ {tExport('menu')}
+ </DropdownMenuTrigger>
+ {/* Wider than its trigger, so "Export Excel" stays on one line. */}
+ <DropdownMenuContent align="end" className="w-36">
+ <DropdownMenuItem onClick={() => void run(downloadCsv)}>
+ <FileDown className="mr-2 h-4 w-4" />
+ {tExport('csv')}
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => void run(downloadExcel)}>
+ <FileSpreadsheet className="mr-2 h-4 w-4" />
+ {tExport('excel')}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
</div>
<Dialog open={preview !== null} onOpenChange={(open) => !open && setPreview(null)}>
<DialogContent className="sm:max-w-2xl" initialFocus={previewRef}>