Skip to content

feat(content): show the Plan's Priority Score, and how it is worked out - #1342

Merged
gkhngyk merged 16 commits into
ansvisor:mainfrom
cihan-gyk:feature/plan-priority-score
Oct 22, 2026
Merged

gkhngyk merged 16 commits into
ansvisor:mainfrom
cihan-gyk:feature/plan-priority-score

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

From the user: the Content Plan ranks its list by a 0–100 score that the page never showed. This shows it, with how it is worked out. Step 1 of 2: the calculation and the order don't change.

  • A Priority Score column beside the rank.
    • It uses the Action Center's PriorityBadge: the score coloured by its level, and the level's name ("76 High"), with the same thresholds (90 / 75 / 50, priorityLevelOf).
    • Below xl the level's name is hidden (the colour still says it), the header wraps, and the Page column narrows to 200 px. Without that the table ran 87 px past its card at 1024 px; now it fits.
    • PriorityBadge gets an optional levelClassName for this. The Action Center is unchanged.
  • On hover or keyboard focus, a breakdown (a tooltip on a button):
    • an opportunity: "The content opportunity's own score: 76";
    • a page losing citations: "40 + 14 for 70% fewer citations + 7 for 7 citations lost = 61";
    • a top page: "20 + 18 citations = 38", with "(at most 60)" when capped;
    • a row with both (an opportunity on a page losing ground) lists both and says the higher counts;
    • a row marked as a priority says that's why it's listed first.
  • plan.ts:
    • each PlanRow carries scoreParts, built from the same numbers the score uses;
    • citationsDownScore and protectScore now read named constants (DROP_BASE, PROTECT_BASE, MAX_PROTECT_SCORE) shared with the breakdown;
    • their results are unchanged.

Step 2 (a separate PR, with your input) would align the score to spec v2: the AC-006 priority, page value and the period's change. The order would change then, and this breakdown makes the before/after easy to compare.

Web only, no migration.

Stacked on #1334 (and #1332/#1321/#1320 below it), which change the Plan table this adds to. This PR's own commit is 78fe313d.

Related issue

None. Product feedback from the user.

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. Open /dashboard/content/plan: the Priority list has a Priority Score column after #, e.g. "76 High".
  2. Hover a score (or tab to it): the tooltip says how it is worked out.
  3. The order is the same as before.
  4. At 1024 px: only the coloured score shows, and the table fits without scrolling sideways.

Checked in light and dark, at 1280 px and 1024 px. The demo data has only opportunity rows; the drop and top-page breakdowns are covered by tests.

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

yarn test: 286 files, 2,530 tests pass. yarn build passes with CI's placeholders.

🤖 Generated with Claude Code

cihan-gyk and others added 9 commits October 21, 2026 21:39
…e in its final layout

- "What AI cites in your topics" drew both shares on one track scaled to
  AI's largest share, so a type the brand leans on more than AI does
  (e.g. 35% · 73%) ran its bar past the track onto the shares column. The
  two shares are now two thin bars on one scale, the larger of the two,
  never past the track.
- The list and the sections above it (AI results, the mix) were read and
  drawn apart, so the list showed mid-screen first and jumped down when
  the sections came in. The page now shows one spinner until both reads
  are in; a list that fails says so at once.

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

More of the brand's pages cited for the same prompts is no loss (AI
answers aren't a ranking), so neither Start nor the Plan treats it as a
problem any more:

- Start's "Overlap check" is an "Overview": a plain box listing the
  brand's pages AI already cites for these prompts, with no amber warning,
  no "Safe to create" and no "Recommended". The action the person clicked
  stays chosen (Create stays Create); the choices are the plan's page when
  it named one, a new page, and optimizing the page cited most.
- The Plan drops the Overlaps card, the ⚠ Overlap tag on rows, and the
  rows that were listed only because another page of the brand is cited
  for the same prompts.

content_plan_pages (00220/00221) still returns overlaps; the Plan no
longer reads it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each Priority list row gets a "…" menu:
- Assign to… (every member): a row with a draft assigns its Action
  Center task (sending the draft first when needed); a row without one
  opens Start on Team, which now has an "Assign to" picker. The Who
  column shows the assignee.
- Mark as priority (admins and managers): the row goes to the top with a
  Priority tag; a Priority card counts and filters the marked rows.
- Hide from the plan (admins and managers): the row leaves the list, with
  Undo and "N hidden rows · Show"; an opportunity's row also dismisses the
  opportunity and gets its status back when shown again.

Migration 00229 adds content_plan_marks (members read; admins and
managers write).

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

Content Opportunities gave every brand the same ten asset types, so a
shop could get a glossary or landing page and a SaaS brand a product or
category page. The generator now reads brands.site_type (or the
editor's guess from Shopping mode and industry), lists that site's page
types with their formats in the prompt, and limits assetType and the
supporting types to them, plus the earned third_party_article and
backlink. No calculation changes.

Older opportunities keep their stored types and are read as the brand's
page types (pillar_guide -> guide / buying_guide, landing_page ->
solution_page / collection_page / destination_page, and so on). The
opportunities list, the drawer, the assets card and Copy All Data name
them with the editor's labels. Start preselects an opportunity's type
for a new page; an existing page goes by its own address or title
first. The Content Plan follows the same rules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	web/src/components/content/new-content-dialog.tsx
#	web/src/lib/actions/content-plan.ts
From the user's spec, PR B of the Content Editor entry points, with the
user's follow-up choices:

- Opportunity panel: three buttons in front, in this order: Send to
  Actions, Generate Brief and Send to Editor. Each turns into its done
  state in place (Open in Actions, Brief Generated, Open draft). The
  rest move into a "..." menu on the right: Send to Plan, Another angle,
  Send to Workflow, Copy All Data, Mark as reviewed, Restore, Dismiss.
- Opportunities list: a row's actions sit in one "..." menu: Send to
  Editor or Open draft, Send to Plan or Open in Plan, Send to Workflow,
  Open in new tab, Dismiss. The Actions column narrows to fit.
- Send to Editor opens New content > Start. A create decision starts a
  new page; any other decision starts on its first target page
  (lib/content/opportunity-start.ts). Owned work still open only.
  getOpportunityDrafts finds the draft already being written.
- Send to Plan marks the opportunity's Plan row as a priority
  (content_plan_marks, ansvisor#1321) for admins and managers;
  getPlanPriorities reads which rows already are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Priority Score column beside the rank shows each row's 0-100 score as the
Action Center's badge does (level by colour, its name on wide windows). On
hover or focus it says what the score is made of: the opportunity's own
score, a drop's base and points, or a top page's citations. The calculation
and the order don't change. The table still fits at 1024 px.

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk Step 1 of the Plan's Priority Score, stacked on #1334 (this PR's own commit is 78fe313d): a column with the existing score and a hover breakdown. The calculation and the order don't change. Step 2 (aligning the score to spec v2: AC-006 + page value + change) would be a separate PR, and it would change the order, so we'd like your input on the weights first. Web only, no migration.

@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 22, 2026
cihan-gyk and others added 6 commits October 22, 2026 12:02
# Conflicts:
#	supabase/schema.sql
#	web/messages/en.json
#	web/src/app/[locale]/(dashboard)/dashboard/content/plan/_plan-insights.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.test.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.tsx
#	web/src/components/content/new-content-dialog.test.tsx
#	web/src/lib/content/plan.test.ts
#	web/src/lib/content/plan.ts
… only what is still dismissed

hidePlanRow and showPlanRow no longer take an opportunity id from the client:
the server reads it from the row key the mark is written under (a uuid, or
'invalid'). Show again gives an opportunity back its status only while it
is still dismissed; one completed or reopened elsewhere keeps its status and
only the mark goes. Hidden rows read only dismissed opportunities. The
Priority card's dot is in ink, as its outline badge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and tell the list about Send to Plan

- A failed getOpportunityDrafts is no "no draft": the row menu and the
  panel offer "Couldn't check for a draft · Retry" instead of Start, so a
  failed read never starts a second draft for the same opportunity.
- Send to Plan from the panel calls the page's onPrioritized, so the row's
  menu says Open in Plan without a reload.
- Start's page types come from the opportunity's brand, not the active one.
- content.send is gone; content.alternative.hint is Another angle's title.
- Drop the unused contains mock and fix the content prop's doc.

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. Two small follow-ups (reviewed 78fe313d, the only commit of this PR's own). 832db273 and 87dfcf25 are clean merges of #1334: each is identical to re-merging its parents.

  1. web/src/app/[locale]/(dashboard)/dashboard/content/plan/_plan-table.tsx:252: the breakdown lives only in a Base UI tooltip, and the tooltip isn't tied to its trigger (no aria-describedby). A screen reader hears "Priority Score 61: how it is worked out" and can't reach the breakdown. Fix either way:
    • put the breakdown text in the button as an sr-only span;
    • or drop ": how it is worked out" from score.label (web/messages/en.json:3169).
  2. _plan-table.tsx:289 and web/messages/en.json:3172: the drop's "(at most 100)" can never show (40 + 20 + 40 = 100). The cap that does apply, citations lost counting for at most 40 points, isn't stated: a page that lost 90 reads "+ 40 for 90 citations lost". Move the capped select onto the lost part (lostPoints < lost) and say "(at most 40)".

The order and the scores are unchanged: the new constants equal the old literals, and the tests tie each breakdown to its row's score.

Stacked on #1334, with #1332 and #1321 under it. Merge those first. It merges cleanly on main.

Tested on top of the current main together with #1343, #1344, #1321, #1329, #1332, #1334 and #1342: web and server tests, tsc, lint and Prettier pass, and schema.sql matches a rebuild. 00229, 00234 and 00238 are applied on production.

@gkhngyk
gkhngyk merged commit 34bdbcc into ansvisor:main Oct 22, 2026
1 check passed
@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 22, 2026
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