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.

fix(action-center): say "1 signal" in the history drawer (#1091)

Cihan3ead5e4cfa57
diff --git a/web/messages/en.json b/web/messages/en.json
index d9f9bd46e..629713f32 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -1455,7 +1455,7 @@
"drawer": {
"goal": "What was the goal?",
"whatHappened": "What happened?",
- "triggeredBy": "Consolidated from {count} signals",
+ "triggeredBy": "Consolidated from {count, plural, one {# signal} other {# signals}}",
"result": "Result",
"visibilityChange": "Visibility Change",
"citationsChange": "Citations Change",
diff --git a/web/src/components/action-center/history-drawer.test.tsx b/web/src/components/action-center/history-drawer.test.tsx
new file mode 100644
index 000000000..952012df4
--- /dev/null
+++ b/web/src/components/action-center/history-drawer.test.tsx
@@ -0,0 +1,76 @@
+import { act } from 'react';
+import { createRoot } from 'react-dom/client';
+import { NextIntlClientProvider } from 'next-intl';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import type { ActionHistoryItem } from '@/lib/action-center/history';
+import messages from '../../../messages/en.json';
+
+(
+ globalThis as typeof globalThis & {
+ IS_REACT_ACT_ENVIRONMENT: boolean;
+ }
+).IS_REACT_ACT_ENVIRONMENT = true;
+
+vi.mock('@/i18n/navigation', () => ({
+ useRouter: () => ({ push: vi.fn() }),
+}));
+
+import { HistoryDrawer } from './history-drawer';
+
+const item = (signalCount: number): ActionHistoryItem => ({
+ id: 'action-id',
+ actionNo: 1,
+ kind: 'recover_visibility',
+ type: 'recover',
+ impact: 'high',
+ status: 'completed',
+ outcome: 'pending_measurement',
+ payload: {},
+ kpiKeys: [],
+ sources: [],
+ triggerSignals: Array.from({ length: signalCount }, (_, i) => ({
+ signalId: `signal-${i}`,
+ kind: 'visibility_drop',
+ detectedAt: '2026-01-01T00:00:00.000Z',
+ })),
+ affected: [],
+ results: [],
+ positionOutcome: null,
+ tasks: [],
+ assignee: null,
+ createdAt: '2026-01-01T00:00:00.000Z',
+ completedAt: '2026-01-05T00:00:00.000Z',
+ timeToCloseDays: 4,
+});
+
+async function renderDrawer(signalCount: number) {
+ const container = document.createElement('div');
+ document.body.append(container);
+ const root = createRoot(container);
+ await act(async () => {
+ root.render(
+ <NextIntlClientProvider locale="en" messages={messages} timeZone="UTC">
+ <HistoryDrawer item={item(signalCount)} onOpenChange={() => {}} />
+ </NextIntlClientProvider>,
+ );
+ });
+ return root;
+}
+
+afterEach(() => {
+ document.body.replaceChildren();
+});
+
+describe('HistoryDrawer', () => {
+ it.each([
+ [1, 'Consolidated from 1 signal'],
+ [3, 'Consolidated from 3 signals'],
+ ])('counts %i trigger signal(s) in the right grammatical number', async (count, text) => {
+ const root = await renderDrawer(count);
+ const line = Array.from(document.body.querySelectorAll('p')).find((p) =>
+ p.textContent?.startsWith('Consolidated from'),
+ );
+ expect(line?.textContent).toBe(text);
+ await act(async () => root.unmount());
+ });
+});