Skip to content

fix(content): a steadier editor header: no jump, a short Next, AI usage with the status, panel toggle in the panel - #2403

Merged
gkhngyk merged 13 commits into
ansvisor:mainfrom
cihan-gyk:fix/editor-header-tidy
Nov 14, 2026
Merged

gkhngyk merged 13 commits into
ansvisor:mainfrom
cihan-gyk:fix/editor-header-tidy

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Stacked on #2397 (→ #2396 → #2391 → #2389). Review and merge those first; until they land, this diff also shows their commits. This PR's own change is its last commit.

The owner approved this layout for the Content Editor's header and side panel, and allowed the change in the Content Editor folder for it.

Summary

The owner's screenshots showed the live editor jumping as a draft opens. About 4–5 seconds in, the agent card appeared over the toolbar and pushed the page down by about 90 px, the Rules and Quality chips changed width, and "By {author}" appeared. The header was also crowded: the Next button carried the step's name, the AI usage bar sat among the action buttons, and Hide side panel sat at the header's far end.

The cause of the late card: the editor read the agent's batch (getDraftSuggestions and getLastRestoreAt) only after it mounted, and that read waited behind the other server actions the editor starts on open. The draft's own read already lands before the editor mounts, so it now also says whether the card will show and who the author is.

Changes

  • No jump
    • getContentDraft now also returns agentCardShown and authorName. They are read in parallel with the draft, with the member's own client (row policies apply), and a failed read returns nothing rather than a guess.
    • agentCardShown follows the editor's own rule: the card shows for the latest batch, unless a restore since then closed it and nothing in it is still open.
    • When agentCardShown is true, the editor shows a skeleton from the first paint until the batch is read: grey blocks for the tile, two lines and the buttons, in the card's own box, so it is the same height. When the card won't show, or the read fails, no space is reserved.
    • The suggestions card is now one line, about 56 px: the tile with its count badge, then "6 suggestions", then a muted "Split the over-long first sentence, +5 more · 9 → 12/16 rules" that truncates and shows in full on hover. A warning, See sources and the action's link stay visible. Review, Reject all and Accept all work as before. The card's other states keep their content in the same 56 px minimum box; the all-reviewed card with a Next-step heading can still be a line taller, so it may grow slightly but never collapses.
  • Steady chips
    • The Rules and Quality chips keep a minimum width while they read ("● Rules ···", "● Quality ···"), and their labels still say they are reading.
    • The author chip shows from the draft's read on the first paint. The menu replaces it once the authors are read.
    • The line "This draft is the work of Action AC-…" is now a chip at the end of the chip row: "From Action AC-… ↗", linking to the same place. Its tooltip and label keep "Mark ready completes its task there".
  • Next shows only the dots and "Next". The step's name is in its aria-label and tooltip ("Next · Review 6 suggestions"). Clicking it does the same as before.
  • AI usage moves out of the action buttons into the status group, after Saved: "Saved · ◔ AI 4.7%". The bar is replaced by a 16 px SVG ring. It still turns amber near the limit and red when it's used up, and keeps its tooltip and popover, including this page's share. This needed a small change to the shared meter's compact mode, which only the editor uses.
  • Hide side panel moves to the right end of the panel's tab row (Chat · Instructions · Sources · Live page), with the same aria-label and aria-pressed. The closed panel's rail now has Show side panel at the top, above its tabs. There was no keyboard shortcut for the toggle; Ctrl/⌘ J still opens the Chat tab. Only the Content Editor changes.
  • Help: the Content Editor's header and side panel sections, and Next in Page quality. The approved articles are regenerated.

How to test

  1. Open a draft that has open agent suggestions. From the first paint, a grey card sits over the toolbar. It turns into the one-line card ("N suggestions · … · Review / Reject all / Accept all") without moving the page.
  2. Open a draft with no batch, or one whose decided batch came before its last restore. Nothing is reserved over the toolbar.
  3. Watch the chip row as a draft opens. "Rules ···" and "Quality ···" become "9/16 rules" and "Quality 97" without the chips after them moving. "By {author} ▾" is there from the start. A draft from the Action Center ends the row with "From Action AC-… ↗"; hover it for the Mark ready note, and click it to open the action.
  4. The header's Next button shows the dots and "Next". Hover it for the step's name, then click it: the Next step window opens as before.
  5. After "Saved" you see "· ◔ AI x%". Hover it for the month's usage, and click it for the popover with this page's share. With usage at 80% or more it is amber.
  6. Click Hide side panel at the right of the panel's tabs. The rail shows Show side panel at the top: click it, or one of the rail's tabs, to open the panel again. Embedded beside Chat (Open here), the bottom bar is unchanged.

Checks

  • Web typecheck (tsc --noEmit): passes.
  • ESLint on the changed files: no errors. The one warning (an unused _args in page.test.tsx) was already there.
  • Prettier on the changed files: clean, apart from web/src/lib/help/approved-articles.json, which is generated and wasn't Prettier-formatted before this change either.
  • Vitest:
    • Content Editor folder: 48 files, 759 tests passed.
    • src/lib/content, src/lib/use-server-exports, src/lib/help, src/lib/actions/content-drafts*, src/components/ai-usage and src/lib/supabase/embed-hints: 101 files, 1246 tests passed.
  • New tests cover the opening read (agentCardShown, authorName, soft failure), the skeleton (same box as the card; reserved only when the read says the card shows; gone once the batch is read or the read fails), the one-line card, the steady Rules chip, the author chip from the draft's read, the Action chip, the ring and its warning colour, and the panel toggle in the tab row and rail.
  • No migrations, lockfile changes or new dependencies. No new server actions.

Generated by Claude Code

…n't meet are set apart

- A rule set picked while the page has no type sets the page type (through
  the header's page type path); a set picked for another type holds only
  while the page keeps the type it was picked on (rules.setFor), so setting
  or changing the page type brings back the page type's own set. Every
  reader (editor, Chat's rules read, the agent's request, Quality's type
  rules) goes through ruleSetType.
- Rules the page can't meet (another type's rule, no feed, no sizes, a
  product page with no specs, no fan-outs...) go under "Not checked on this
  page": never counted, and Rewrite and Chat's optimize no longer send them.
- Product, Category, Collection and Sizing-guide sets ask for 2 fan-out
  H2s, 3 FAQ questions and 2 fan-out questions, so no default set has a
  Length conflict (tested for every page type).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…p what the rules ask for

One state per rule (F1): agentFixable() is the open rules less those the
agent never fixes, a setting only the person fills, rules held by what the
page keeps, rules it tried and couldn't close, and rules not checked on
this page. The Rules tab's Fix button, Fix open rules, the agent card's
Run, rulesForNext, the Next step and its steps window all read it. With
nothing left it can fix, the Rules tab says "Content Agent did what it
could. N rules are yours to decide." in place of the button and lists
them, each with Change the page, Change the rule and, for a tried rule,
Ask again (clears its mark and runs Fix for it alone). The steps window
shows Fix open rules as taken by the agent then, as the Rules tab says.

Conflicts first (B1): when the rules can't fit the Length, the next step
is "Raise Length to ~N" (what the rules need, rounded up to 50), set in
one click, with Ask for fewer beside it, before Fix or a rewrite.

Page type first (A2): with no page type, the first step is Set page type,
which opens the header's page type menu.

Next step order: page type, conflict, Fix open rules, then the Length's
rewrite, then Before you publish.

The rewrite within all rules (B2: the cut pass told the rules, the
rewrite-drop warning, the step's new name) is left for a follow-up, to
keep this change to its scope.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
The server's cut pass gets the rules and never drops a section they
require. The agent card says when a rewrite left met rules open, beside
Undo. The Length step reads "Rewrite within all rules".

Follow-up to the one-agent-state change; not opened as a PR yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Keeps both PR1's "Not checked on this page" note and main's missing
fan-outs line in the rule row. The Rules tab Help section went over 150
words with both, so the fan-out paragraph is its own section now. Help
is regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Brings in main (with the agent reliability and score changes) through
PR1's branch. No conflicts; Help needed no regeneration.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Brings in main through the PR1 and PR2 branches. Trims Help's "Before
you publish" section back under 150 words and regenerates Help.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
When a brand has banned phrases in Brand settings › Content rules, the
Content Editor's Rules tab shows "Avoid your brand's banned phrases" in
Style: on by default, turned off per draft like other rules, open while
the page has one (whole words, any case, as Chat's check), listing them,
counted, fixable by Content Agent, and under Before you publish › Fix
before you publish. With an empty list nothing new shows.

- getContentDraft reads the list through the draft (its brand, under the
  member's row policies), in parallel; a failed read leaves the rule out.
- Content Agent: Fix open rules is told the phrases only when there are
  some; a suggestion (Fix or a live page's) that brings one in is dropped
  and counted in the log. The page rewrite gets the after-write pass a
  new page has: those sentences once more, kept only when every kept
  line and heading stays. cutToLength and cutPrompt are unchanged.

Stacked on ansvisor#2396 (-> ansvisor#2391 -> ansvisor#2389).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…ge with the status, panel toggle in the panel

The Content Editor's header and side panel, as the owner approved them.

- No jump: getContentDraft also says whether the agent card shows as the
  editor opens (the latest batch, unless a restore since closed it with
  none open, the editor's own rule) and the author's name, read with the
  member's client and failing soft. The editor keeps the card's place from
  the first paint with a skeleton of the same box (tile, two lines,
  buttons) until its batch is read; nothing when it doesn't show or the
  read failed. The suggestions card is one line, about 56 px: the tile
  with its count, "6 suggestions", then what they change truncating
  ("..., +5 more · 9 → 12/16 rules"), with a warning, See sources and the
  action's link kept in sight, and Review, Reject all, Accept all.
- Steady chips: Rules and Quality keep a minimum width while they read
  ("Rules ···", "Quality ···"); the author chip shows from the draft's
  read until the menu is read; the Action line is a chip at the row's
  end, "From Action AC-…", its hint and label saying Mark ready completes
  its task.
- Next is the dots and "Next"; the step's name is in its label and title.
- AI usage moves to the status group after Saved, as a 16 px ring with
  "AI 4.7%", amber and red as before; its popover and tooltip stay.
- Hide side panel moves to the right end of the panel's tab row; the
  closed panel's rail gets Show side panel on top.
- Help: the editor's header and side panel, and Next in Quality.

Stacked on ansvisor#2397 (-> ansvisor#2396 -> ansvisor#2391 -> ansvisor#2389).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk
gkhngyk previously approved these changes Nov 14, 2026

@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.

LGTM (its own commits). Waits on #2389.

…set on an unrelated edit

- A set saved before setFor existed (rules.set with no setFor) holds
  whatever the page type, with or without one, as it did before ansvisor#2389:
  ruleSetType returns it, and rulesPageType checks its type rules as its
  own (editor, Chat's rules read, Quality's type rules), so they aren't
  set apart as another type's. Its customised rules stay.
- A set with setFor still holds only while the page keeps that type.
- Only the person's own set pick writes set (and setFor, which a legacy
  pin gains then); a rule's change, a toggle, the Length, Reset or the
  page type changed from the header keep set, setFor and the custom rules
  as stored, so nothing writes set: null behind the person's back.
- Help: the set follows the page type, except a set picked for another
  type (while the page keeps its type) and one picked before.

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.

LGTM.

@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.

LGTM.

@gkhngyk
gkhngyk merged commit 59c24c7 into ansvisor:main Nov 14, 2026
12 checks passed
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