Skip to content

feat(nav): analytics before execution; everyone lands on Prompts › Tracked Prompts - #2475

Merged
gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:feat/menu-analytics-first
Nov 17, 2026
Merged

gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:feat/menu-analytics-first

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Two changes from the owner's mockup:

  1. Menu reorder: analytics before execution. The main menu now runs Chat, then ANALYTICS (Prompts, Visibility, Competitors, AI Referral Traffic, plus Ads when it's on), then EXECUTION, which replaces "More" (Action Center first, then Content, Audit, Reports).
  2. Everyone lands on Prompts › Tracked Prompts. Sign-in, /dashboard, the Stripe return page, setup after purchase (trial, and demo → purchase → setup), the demo and a new brand all open on Tracked Prompts. Menu access is respected: someone whose menu leaves Prompts off lands on Action Center › Today, which is on every menu. The Action Center keeps its own address.

Changes

  • config/dashboard.ts: new order and group names. Items, routes, icons, dots, badges and permissions are unchanged, and Ads stays hidden unless its flag is on. The desktop sidebar (open and icons-only), the mobile menu, Settings › Menu access, work areas and the onboarding preview all render from this list. There is no command palette or shortcut list that repeats the menu order.
  • nav.more is replaced by nav.execution ("Execution") in en.json. A fold remembered under "More" resets to open once, because the stored key is now …group.executionOpen.
  • config/home.ts (plain module):
    • DASHBOARD_HOME is now PROMPTS_TRACKED, a new constant in lib/prompts-routes.ts, and stays the default home.
    • homeFor(hiddenSections) returns Tracked Prompts, or ACTION_CENTER_TODAY when the Prompts section is off the person's menu.
    • isDashboardHomeItem(href, home?) marks the right menu item for either home.
  • lib/my-home.ts: readMyHome() reads the person's menu through the existing getMyMenu (the same rules as the sidebar: the role's menu in their organization, their own exceptions and work areas) and applies homeFor. If there is no menu to read, it returns the default home. No new server action and no migration.
  • Who uses the home helper:
    • /dashboard (index): redirects to readMyHome() and carries ?jobId=. Sign-in, the sidebar logo, new brand, demo entry, accepted invitations and the onboarding redirects for people who already finished all go through it.
    • Stripe return page: uses readMyHome() directly. Checkout is admin-only, but an admin's own work areas can still leave Prompts off.
    • Setup after purchase: setupLanding(jobId) now lands on /dashboard?jobId=…, so the index picks the person's home. The person finishing setup can be a manager whose role hides Prompts, and the page doing the redirect runs in the browser and can't read the menu itself.
  • /dashboard/action-center now redirects straight to ACTION_CENTER_TODAY, so the menu's Action Center still opens Today and never bounces to Prompts.
  • First-run progress: Tracked Prompts already shows "Your first answers are arriving (n of N) · ~x min" above the table while the first run is in progress, and hides it once the run finishes. It uses the same useFirstRun() read as the Action Center and is already covered by prompts/page.test.tsx, so nothing is added to the prompts route (no layout). Someone sent to Today instead sees the Action Center's own first-run line.
  • "Finish setting up" stays on Action Center › Today (it moves in a later PR).
  • The demo's ready line now reads "Ready. Opening Prompts…". Stale comments about where people land are updated.
  • Help: Chat, Action Center overview, Today, first results after setup, add your first brand, Visibility, both Competitors articles, Menu access and Site Audit, including where someone without Prompts lands. approved-articles.json was regenerated with the script, not edited by hand.
  • Onboarding guards (needsSetupAfterPurchase, finishSetupAfterPurchase, the ansvisor_setup_deferred cookie, the lapsed read-only dashboard) are untouched. Only the destination changed.

How to test

  1. Open the sidebar. It should read Chat, ANALYTICS (Prompts, Visibility, Competitors, AI Referral Traffic), EXECUTION (Action Center, Content, Audit, Reports). Collapse it to icons and check the same order, then check the mobile menu.
  2. Fold and unfold Execution. The Action Center folds with it, and the group opens by itself on an Action Center page.
  3. Open /dashboard: it lands on Prompts › Tracked Prompts. Click Action Center in the menu: it opens Today.
  4. In Settings › Menu access, take Prompts off the Analyst role. Sign in as an analyst: /dashboard opens Action Center › Today.
  5. New trial: choose the trial, check out, set up a brand and press Finish. You land on Tracked Prompts with the run's job and see "Your first answers are arriving" above the table.
  6. Explore the demo: it opens on Tracked Prompts with sample data. Buy from the demo and finish setup: you land on Tracked Prompts again.

Checks


Generated by Claude Code

The main menu now runs Chat, then ANALYTICS (Prompts, Visibility,
Competitors, AI Referral Traffic, Ads when on), then EXECUTION, which
replaces MORE (Action Center first, then Content, Audit, Reports). Same
items, routes, icons, dots, badges and permissions; the sidebar (open and
icons only), the mobile menu, Settings › Menu access, work areas and the
onboarding preview all follow dashboardNav.

The home (config/home.ts, DASHBOARD_HOME) is Prompts › Tracked Prompts
for everyone: /dashboard, sign-in, the Stripe return page, setup after
purchase (trial and demo then purchase) and the demo land there. The
Action Center keeps its own address: /dashboard/action-center opens its
Today tab directly. Tracked Prompts already shows the first run's
progress, so nothing is added to the prompts route.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Competitors sits after Visibility in Analytics, Site Audit under
Execution, groups fold as Analytics and Execution, and Ansvisor opens
on Prompts › Tracked Prompts (Chat, Action Center, Today, first results,
brand setup, Visibility). approved-articles.json regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Nobody lands on a page their menu doesn't show. homeFor(hidden) in
config/home.ts (plain module) picks Tracked Prompts, or Action Center ›
Today (always on) when Prompts is off the person's menu; DASHBOARD_HOME
stays the default. readMyHome (lib/my-home.ts) reads the menu as the
sidebar does, through getMyMenu: the role's sections in the person's
organization, their own exceptions and work areas.

/dashboard (index) and the Stripe return page use it. Setup after
purchase now lands on /dashboard with the run's job, which the index
carries to the person's home, so new brand, demo, sign-in and setup all
resolve in one place. Help says where someone without Prompts lands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good: every role/plan lands on a valid page (Action Center › Today when Prompts is hidden) and the onboarding redirect still wins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants