Skip to content

feat(content): order the Content menu as the work goes and mark Content itself new - #1603

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/content-menu-order
Oct 27, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/content-menu-order

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

The sidebar's Content menu follows the work, and "New" moves to Content itself. Ansvisor asked for the Plan item's "New" to go, with the badge on Content, and for an order that fits the work.

  • Order: Opportunities → Plan → Editor → Library: find, plan, write, then the archive. It was Plan, Editor, Opportunities, Library.
  • The badge: Content has badge: 'New' and Plan has none (web/src/config/dashboard.ts).
  • The desktop sidebar (sidebar.tsx) didn't show a badge on an item with a submenu. It now shows effectiveBadge beside the chevron, in the plain items' style (secondary, h-5, 10 px). The mobile menu already showed it.
  • The collapsed sidebar names Content "Content (New)" on hover, as plain items do.

Written by a side session at the user's request, and handed over for the checks, the browser check and this PR.

Related issue

None. Ansvisor's request.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. cd web && yarn vitest run src/lib/dashboard-navigation.test.ts src/components/layout
  2. Open the dashboard:
    • Content shows "New" beside its chevron;
    • its submenu reads Opportunities, Plan, Editor, Library;
    • Plan has no badge.
  3. Collapse the sidebar: hovering Content reads "Content (New)".
  4. On a phone, the menu shows the same.

Checked in the browser:

  • at 1024 px, light and dark: the expanded sidebar has "New" beside Content's chevron, the new order, and no badge on Plan;
  • the collapsed sidebar's Content reads "Content (New)" on hover;
  • the mobile menu (375 px) shows the same.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run in web/:

  • yarn format, yarn lint (0 errors), yarn typecheck;
  • yarn test (4,138 tests);
  • yarn build.

🤖 Generated with Claude Code

…nt itself new

The sidebar's Content submenu now lists its pages in the order the work
goes: Opportunities, Plan, Editor, Library (was Plan, Editor,
Opportunities, Library). The "New" badge moves from Plan to the Content
item itself, and the desktop sidebar's expandable items show their badge
beside the chevron, as plain items and the mobile menu already do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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, with a follow-up.

What I checked:

  • Own change. One commit on 5bbd162: config/dashboard.ts, sidebar.tsx and the nav test. It merges clean on main (15b5b5f), and with #1596 and #1597. No other open PR touches these files.
  • Order and the current item. activeChildHref picks the longest matching route, not the first, so putting Opportunities (/dashboard/content) first changes nothing: the Plan, the Editor (and a draft under it), the Library and an opportunity's own page each still mark only their own item. The existing activeChildHref tests read the real config and pass.
  • The badge.
    • Desktop, expanded: a submenu parent now shows effectiveBadge before the chevron, with the plain items' classes. Prompts has no badge, so only Content changes.
    • Desktop, collapsed: a parent falls through to the plain link, whose title already reads "Content (New)".
    • Mobile: the parent row already rendered effectiveBadge; the children loop keeps rendering a child badge, and none is left.
    • Locked (plan without Content): the row shows the plan badge as before, not "New".
    • The onboarding preview lists the nav without badges or children, so it doesn't change.
  • Keys. No new message key. badge stays a literal, as Action Center's "New" already is.
  • Tests. dashboard-navigation.test.ts and src/components/layout pass at this head (35). With main's dashboard.ts and sidebar.tsx, the changed test fails ("expected undefined to be 'New'") and the rest pass.
  • Before the API deploy. Web only, nothing reads the API.

Follow-up:

  1. No test covers the badge on a submenu parent (sidebar.tsx:431-438). Reverting sidebar.tsx alone leaves every test passing. A small render test of the expanded sidebar that finds "New" inside the Content button (data-submenu="/dashboard/content") would keep it from being lost again.

@gkhngyk
gkhngyk merged commit 6689da7 into ansvisor:main Oct 27, 2026
11 checks passed
gkhngyk pushed a commit that referenced this pull request Oct 28, 2026
* test(layout): pin the "New" badge on a sidebar submenu's parent

Follow-up from #1603. No test covered the badge on a submenu parent
(sidebar.tsx, the expandable item's button): reverting it left every test
passing. A render test of the expanded sidebar now finds "New" inside the
Content button (data-submenu="/dashboard/content"), and a plain item's
(Action Center) too. Removing the parent's badge fails it.

The sidebar's heavy parts (brand switcher, profile, theme toggle, the
tracked-prompt count) are stubbed; it opens collapsed, so the test
expands it through its store.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(layout): give the sidebar badge test a menu of its own

Review follow-up. The test read the real dashboardNav, so it leaned on
Action Center and Content being marked "New" today: dropping either badge
from the product would fail it for no fault of the sidebar. It now mocks
@/config/dashboard with a plain item and a submenu parent, both badged.
Removing the badge from the real menu leaves it passing; removing the
parent's badge from sidebar.tsx still fails it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Cihan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

2 participants