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): land on the Action Center's Actions, its first tab (#1238)

Cihan4da7826c2f80
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/action-center/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/action-center/page.tsx
index 8d23500b7..b340e2209 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/action-center/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/action-center/page.tsx
@@ -1,5 +1,7 @@
import { redirect } from 'next/navigation';
+import { DASHBOARD_HOME } from '@/config/home';
+// Actions is the Action Center's first tab.
export default function ActionCenterPage() {
- redirect('/dashboard/action-center/kpis');
+ redirect(DASHBOARD_HOME);
}
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsx
index dc8ca011e..25c17cb5f 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsx
@@ -58,6 +58,7 @@ import {
} from 'lucide-react';
import { cn } from '@/lib/utils';
import { suggestTopics, generatePromptsFromTopics, suggestCompetitors } from '@/lib/ai-brand-setup';
+import { DASHBOARD_HOME } from '@/config/home';
// ── Step indicator ─────────────────────────────────────────────────────────────
@@ -701,7 +702,7 @@ export default function NewBrandPage() {
await bootstrapBrandVolumes(createdBrand.id);
toast.success('Brand setup complete! Tracking is starting.');
- router.push('/dashboard/insights');
+ router.push(DASHBOARD_HOME);
} catch (err) {
toast.error(err instanceof Error ? err.message : 'Failed to save competitors');
setSavingCompetitors(false);
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/page.tsx
index 528d87cad..98f89f0f1 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/page.tsx
@@ -1,5 +1,6 @@
import { redirect } from 'next/navigation';
+import { DASHBOARD_HOME } from '@/config/home';
export default function DashboardPage() {
- redirect('/dashboard/insights');
+ redirect(DASHBOARD_HOME);
}
diff --git a/web/src/app/[locale]/(dashboard)/layout.tsx b/web/src/app/[locale]/(dashboard)/layout.tsx
index abdfbea02..ee29d5ad0 100644
--- a/web/src/app/[locale]/(dashboard)/layout.tsx
+++ b/web/src/app/[locale]/(dashboard)/layout.tsx
@@ -13,6 +13,7 @@ import { getBrands } from '@/lib/actions/brand';
import { getPlan, isCloud, type PlanId } from '@/config/plans';
import { evaluateSubscriptionAccess } from '@/lib/billing/subscription-access';
import { SubscriptionExpiredNotice } from '@/components/billing/subscription-expired-notice';
+import { TrackingJobHandoff } from '@/components/layout/tracking-job-handoff';
export default async function DashboardLayout({ children }: { children: React.ReactNode }) {
const supabase = await createClient();
@@ -103,6 +104,7 @@ export default async function DashboardLayout({ children }: { children: React.Re
<main className="flex-1 overflow-y-auto bg-background p-6">
<BrandGuard>{children}</BrandGuard>
</main>
+ <TrackingJobHandoff />
</div>
</div>
</RoleProvider>
diff --git a/web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx b/web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx
index aaadeae3d..8be6d8b22 100644
--- a/web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx
+++ b/web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx
@@ -71,6 +71,7 @@ import { cn } from '@/lib/utils';
import { suggestTopics, generatePromptsFromTopics, suggestCompetitors } from '@/lib/ai-brand-setup';
import { DashboardPreview } from '@/components/onboarding/dashboard-preview';
import { OnboardingFrame } from '@/components/onboarding/onboarding-frame';
+import { DASHBOARD_HOME } from '@/config/home';
// ── Step indicator ─────────────────────────────────────────────────────────────
@@ -977,7 +978,7 @@ export default function OnboardingPage() {
// Full page navigation bypasses Next.js router cache, ensuring
// the server-side layout reads the fresh onboarding_completed flag.
- window.location.href = '/dashboard/insights';
+ window.location.href = DASHBOARD_HOME;
} catch (err) {
toast.error(err instanceof Error ? err.message : 'Failed to save competitors');
setSavingCompetitors(false);
diff --git a/web/src/app/api/stripe/success/route.ts b/web/src/app/api/stripe/success/route.ts
index ba7a61355..571a15d40 100644
--- a/web/src/app/api/stripe/success/route.ts
+++ b/web/src/app/api/stripe/success/route.ts
@@ -3,6 +3,7 @@ import { stripe } from '@/lib/stripe';
import { supabaseAdmin } from '@/lib/supabase/admin';
import { alignPromptsToPlanForOrg } from '@/lib/plan-engines';
import { API_BASE_URL } from '@/config/api';
+import { DASHBOARD_HOME } from '@/config/home';
export async function GET(req: NextRequest) {
const { searchParams } = new URL(req.url);
@@ -10,7 +11,7 @@ export async function GET(req: NextRequest) {
const appUrl = process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000';
if (!sessionId) {
- return NextResponse.redirect(`${appUrl}/dashboard/insights`);
+ return NextResponse.redirect(`${appUrl}${DASHBOARD_HOME}`);
}
let trackingJobId: string | null = null;
@@ -139,7 +140,9 @@ export async function GET(req: NextRequest) {
console.error('[stripe/success] Error:', err);
}
- const redirectUrl = new URL(`${appUrl}/dashboard/insights`);
+ // The first tracking run's id rides along: TrackingJobHandoff keeps it for
+ // Visibility's progress bar.
+ const redirectUrl = new URL(`${appUrl}${DASHBOARD_HOME}`);
if (trackingJobId) {
redirectUrl.searchParams.set('jobId', trackingJobId);
}
diff --git a/web/src/components/action-center/action-center-tabs.tsx b/web/src/components/action-center/action-center-tabs.tsx
index 88a1206a6..0f9ff53ac 100644
--- a/web/src/components/action-center/action-center-tabs.tsx
+++ b/web/src/components/action-center/action-center-tabs.tsx
@@ -6,16 +6,10 @@ import { Link, usePathname } from '@/i18n/navigation';
import { useBrandStore } from '@/stores/use-brand-store';
import { getNewSignalCount } from '@/lib/actions/signals';
import { cn } from '@/lib/utils';
-
-const TABS = [
- { key: 'kpis', href: '/dashboard/action-center/kpis' },
- { key: 'actions', href: '/dashboard/action-center/actions' },
- { key: 'signals', href: '/dashboard/action-center/signals' },
- { key: 'history', href: '/dashboard/action-center/history' },
-] as const;
+import { ACTION_CENTER_TABS } from '@/lib/action-center/tabs';
/**
- * The Action Center's section nav: KPIs | Actions | Signals | History.
+ * The Action Center's section nav: Actions | Signals | KPIs | History.
* Route-backed rather than state-backed tabs so each section is linkable
* and the browser back button works across them.
*/
@@ -42,7 +36,7 @@ export function ActionCenterTabs() {
return (
<nav className="flex gap-6 border-b" aria-label={t('label')}>
- {TABS.map((tab) => {
+ {ACTION_CENTER_TABS.map((tab) => {
const isActive = pathname.startsWith(tab.href);
return (
<Link
diff --git a/web/src/components/layout/tracking-job-handoff.test.tsx b/web/src/components/layout/tracking-job-handoff.test.tsx
new file mode 100644
index 000000000..4b15cbcb6
--- /dev/null
+++ b/web/src/components/layout/tracking-job-handoff.test.tsx
@@ -0,0 +1,76 @@
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+/**
+ * The payment lands on the Action Center with the first tracking run's id;
+ * it is kept for Visibility's progress bar and taken out of the address.
+ */
+
+(
+ globalThis as typeof globalThis & {
+ IS_REACT_ACT_ENVIRONMENT: boolean;
+ }
+).IS_REACT_ACT_ENVIRONMENT = true;
+
+const { saveTrackingJob, nav } = vi.hoisted(() => ({
+ saveTrackingJob: vi.fn(),
+ nav: { pathname: '/dashboard/action-center/actions', brandId: 'b1' as string | null },
+}));
+
+vi.mock('@/i18n/navigation', () => ({ usePathname: () => nav.pathname }));
+vi.mock('@/stores/use-brand-store', () => ({
+ useBrandStore: (selector: (state: { activeBrandId: string | null }) => unknown) =>
+ selector({ activeBrandId: nav.brandId }),
+}));
+vi.mock('@/lib/tracking-job-store', () => ({ saveTrackingJob }));
+
+const { TrackingJobHandoff } = await import('./tracking-job-handoff');
+
+let root: Root;
+
+async function render() {
+ await act(async () => root.render(<TrackingJobHandoff />));
+}
+
+beforeEach(() => {
+ saveTrackingJob.mockReset();
+ nav.pathname = '/dashboard/action-center/actions';
+ nav.brandId = 'b1';
+ window.history.replaceState(null, '', '/dashboard/action-center/actions?jobId=j1&x=1');
+ root = createRoot(document.createElement('div'));
+});
+
+afterEach(() => {
+ act(() => root.unmount());
+});
+
+describe('TrackingJobHandoff', () => {
+ it("keeps the run's id for Visibility and takes it out of the address", async () => {
+ await render();
+ expect(saveTrackingJob).toHaveBeenCalledWith(
+ expect.objectContaining({ jobId: 'j1', brandId: 'b1' }),
+ );
+ expect(window.location.search).toBe('?x=1');
+ });
+
+ it('waits for the brand', async () => {
+ nav.brandId = null;
+ await render();
+ expect(saveTrackingJob).not.toHaveBeenCalled();
+ expect(window.location.search).toBe('?jobId=j1&x=1');
+ });
+
+ it('leaves Visibility, which reads the id itself, alone', async () => {
+ nav.pathname = '/dashboard/insights';
+ await render();
+ expect(saveTrackingJob).not.toHaveBeenCalled();
+ expect(window.location.search).toBe('?jobId=j1&x=1');
+ });
+
+ it('does nothing without an id', async () => {
+ window.history.replaceState(null, '', '/dashboard/action-center/actions');
+ await render();
+ expect(saveTrackingJob).not.toHaveBeenCalled();
+ });
+});
diff --git a/web/src/components/layout/tracking-job-handoff.tsx b/web/src/components/layout/tracking-job-handoff.tsx
new file mode 100644
index 000000000..202deba61
--- /dev/null
+++ b/web/src/components/layout/tracking-job-handoff.tsx
@@ -0,0 +1,29 @@
+'use client';
+
+import { useEffect } from 'react';
+import { usePathname } from '@/i18n/navigation';
+import { useBrandStore } from '@/stores/use-brand-store';
+import { saveTrackingJob } from '@/lib/tracking-job-store';
+import { readUrlParam, writeUrlParams } from '@/lib/url-state';
+
+/**
+ * The first tracking run starts with the payment, and the Stripe success
+ * route lands on the Action Center (DASHBOARD_HOME) with ?jobId=. Visibility
+ * shows a run's progress from the saved job, so the id is kept for it here
+ * and taken out of the address. Visibility reads ?jobId= itself, so it is
+ * left alone there.
+ */
+export function TrackingJobHandoff() {
+ const pathname = usePathname();
+ const brandId = useBrandStore((s) => s.activeBrandId);
+
+ useEffect(() => {
+ if (!brandId || pathname.startsWith('/dashboard/insights')) return;
+ const jobId = readUrlParam('jobId');
+ if (!jobId) return;
+ saveTrackingJob({ jobId, brandId, startedAt: Date.now() });
+ writeUrlParams({ jobId: null });
+ }, [pathname, brandId]);
+
+ return null;
+}
diff --git a/web/src/components/onboarding/dashboard-preview.tsx b/web/src/components/onboarding/dashboard-preview.tsx
index c55f36b5a..f11866214 100644
--- a/web/src/components/onboarding/dashboard-preview.tsx
+++ b/web/src/components/onboarding/dashboard-preview.tsx
@@ -14,6 +14,7 @@ import {
} from '@/lib/dashboard-navigation';
import { getFaviconUrl } from '@/lib/favicon';
import { cn } from '@/lib/utils';
+import { isDashboardHomeItem } from '@/config/home';
export interface DashboardPreviewCompetitor {
name: string;
@@ -28,7 +29,6 @@ interface DashboardPreviewProps {
competitors: DashboardPreviewCompetitor[];
}
-const LANDING_HREF = '/dashboard/insights';
const MAX_ROWS = 6;
/**
@@ -101,7 +101,7 @@ export function DashboardPreview({
key={item.href}
className={cn(
'flex items-center gap-3 rounded-md px-2 py-1.5 text-[13px] font-medium',
- item.href === LANDING_HREF
+ isDashboardHomeItem(item.href)
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground',
)}
diff --git a/web/src/config/home.test.ts b/web/src/config/home.test.ts
new file mode 100644
index 000000000..b235ba6fe
--- /dev/null
+++ b/web/src/config/home.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it } from 'vitest';
+import { DASHBOARD_HOME, isDashboardHomeItem } from './home';
+import { ACTION_CENTER_TABS } from '@/lib/action-center/tabs';
+
+/**
+ * New Ansvisor (AC-ALT2 §3): everything starts at the Action Center's
+ * Actions, and its tabs read Actions · Signals · KPIs · History.
+ */
+describe('the dashboard home', () => {
+ it("is the Action Center's Actions", () => {
+ expect(DASHBOARD_HOME).toBe('/dashboard/action-center/actions');
+ });
+
+ it('marks the Action Center item as the one the home page sits under', () => {
+ expect(isDashboardHomeItem('/dashboard/action-center')).toBe(true);
+ expect(isDashboardHomeItem('/dashboard/action-center/actions')).toBe(true);
+ expect(isDashboardHomeItem('/dashboard/insights')).toBe(false);
+ expect(isDashboardHomeItem('/dashboard/action')).toBe(false);
+ });
+
+ it('opens the Action Center on Actions, then Signals, KPIs and History', () => {
+ expect(ACTION_CENTER_TABS.map((tab) => tab.key)).toEqual([
+ 'actions',
+ 'signals',
+ 'kpis',
+ 'history',
+ ]);
+ expect(ACTION_CENTER_TABS[0].href).toBe(DASHBOARD_HOME);
+ });
+});
diff --git a/web/src/config/home.ts b/web/src/config/home.ts
new file mode 100644
index 000000000..c332a32b4
--- /dev/null
+++ b/web/src/config/home.ts
@@ -0,0 +1,12 @@
+/**
+ * Where a signed-in user starts (New Ansvisor, AC-ALT2 §3): the Action
+ * Center's Actions, where Getting started and the actions live. /dashboard
+ * and /dashboard/action-center redirect here, and onboarding, payment and a
+ * new brand land here.
+ */
+export const DASHBOARD_HOME = '/dashboard/action-center/actions';
+
+/** Whether a sidebar item leads to the home page (it or a parent of it). */
+export function isDashboardHomeItem(href: string): boolean {
+ return DASHBOARD_HOME === href || DASHBOARD_HOME.startsWith(`${href}/`);
+}
diff --git a/web/src/lib/action-center/tabs.ts b/web/src/lib/action-center/tabs.ts
new file mode 100644
index 000000000..c62ae16c1
--- /dev/null
+++ b/web/src/lib/action-center/tabs.ts
@@ -0,0 +1,10 @@
+/**
+ * The Action Center's tabs, in order: Actions first (New Ansvisor, AC-ALT2 §3:
+ * everything starts at Actions), then Signals, KPIs and History.
+ */
+export const ACTION_CENTER_TABS = [
+ { key: 'actions', href: '/dashboard/action-center/actions' },
+ { key: 'signals', href: '/dashboard/action-center/signals' },
+ { key: 'kpis', href: '/dashboard/action-center/kpis' },
+ { key: 'history', href: '/dashboard/action-center/history' },
+] as const;