Skip to content

feat(prompts): fold the Tracked Prompts usage cards under their title - #1130

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:feature/tracked-prompts-collapsible
Oct 17, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:feature/tracked-prompts-collapsible

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

The Tracked Prompts usage cards fold under their title, so the table sits right under the controls. The section's title row ("Tracked Prompts" · "Every tracked prompt for this brand · edit or pause any row in place" · Plan & usage) stays. A chevron before the title, the same as the sidebar's Prompts item, opens and closes the brand and account cards and their footer.

  • Closed by default, every time: the page always opens with the cards folded. They open only when the reader clicks the chevron or the title, and nothing is remembered between visits.
  • A warning that survives folding: while folded, the title shows a short amber or red note ("46 / 50 prompt locations") when the plan's prompt locations are nearly or fully used, the states the cards color. Nothing is added well under the limit or on an unlimited plan.
  • Instant open: the cards stay mounted while folded (hidden with a class), so their counts are already there and the diff stays small.

Changes

  • prompts/_usage-cards.tsx:
    • The title is a button inside the h2, with aria-expanded and aria-controls.
    • The chevron is rotated -90° when closed, as in components/layout/sidebar.tsx.
    • The cards grid and footer get hidden while closed, and the header drops its bottom border.
    • The warning pill.
  • messages/en.json: prompts.usage.collapsedLocations.
  • prompts/_usage-cards.test.tsx:
    • The existing tests open the cards before reading them.
    • New tests cover: folded by default and toggling; the amber and red pill while folded and its removal when open; nothing added under the limit or without one.

Related issue

None.

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 Prompts → Tracked Prompts.
    • Only the "› Tracked Prompts" title row shows above the table.
    • The table starts right below the controls.
  2. Click the chevron or the title: the This brand and Account cards open. Click again: they fold.
  3. Open them, leave the page or reload: the cards are folded again.
  4. On a cloud plan at 90%+ of its prompt locations, the folded title shows an amber note; at or over the limit, a red one.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/): no errors; the 7 warnings are in files this PR does not touch
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run:

  • web: yarn test (1252) and yarn build pass.
  • Browser (demo brand, self-hosted):
    • The section opens folded and toggles open and closed.
    • It is folded again after a reload.
    • Checked at 1440px and 1024px, in light and dark.
    • The warning pill needs a cloud plan near its limit, so it is covered by the tests rather than the local install.

Known, unchanged here:

  • A failed counts load ("Couldn't load the counts · Retry") is in the footer, so it shows once the cards are opened. The table is unaffected.
  • The cards' New and Paused shortcuts are folded away. The table's own Status filter offers the same choices.

🤖 Generated with Claude Code

The Tracked Prompts usage cards now fold under their title with a chevron,
as the sidebar's Prompts item does. They open closed every time, so the
table sits right under the controls, and open only on the reader's click.
Folded, the title shows a short amber or red note when the plan's prompt
locations are nearly or fully used.

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk a small Prompts change: the Tracked Prompts usage cards fold under their title with a chevron (like the sidebar), closed every time the page opens, so the table sits right under the controls; folded, the title still warns in amber/red when prompt locations are nearly or fully used. Web only, from main.

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

Rebuilt on main: the usage-cards tests, typecheck, lint and format pass, and CI is green. The cards stay mounted while folded, so opening them shows the counts at once.

@gkhngyk
gkhngyk merged commit 7c50d10 into ansvisor:main Oct 17, 2026
5 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.

2 participants