Skip to content

fix(content): keep filters reachable on zero results, and allow deleting selections - #733

Merged
gkhngyk merged 1 commit into
mainfrom
feature/660-731-content-filters-and-bulk-delete
Aug 18, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/660-731-content-filters-and-bulk-delete

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Two problems on the Content page, both about a list the reader cannot get out of. They share the same file and the same bulk bar, so they land together.

Zero-result filters hid the filters themselves (#660). Selecting a filter combination that matched nothing unmounted the whole content branch — filter bar included — and replaced it with the "No content opportunities yet" + Generate card. The filter values live in React state, so the reader was left with no control on screen to undo their own choice, and the empty state was wrong: data existed, the filter just matched nothing.

Only the unfiltered view can say a brand truly has no opportunities, so the Generate card is now gated on !hasActiveFilters. When filters are active the header, KPIs, filter bar and table stay rendered, and the existing no-matches message — previously unreachable in this state — now carries a Clear filters button.

Nothing could be removed (#731). The bulk bar offered send, done and dismiss. Dismissing only moves a row behind a status filter and leaves it in the table, which is no help to a brand carrying hundreds of stale suggestions: across production the open list averages 147 rows per brand, against 114 dismissed in total across every brand.

Delete now sits last in the bar and is the only destructive-styled trigger there. It opens a confirmation stating the count, following the same Dialog shape as Dismiss all.

Two details worth calling out in review:

  • Briefs go with the row. The generated brief is a column on the opportunity, not a separate record, and briefs are metered against a monthly quota. When the selection includes one the dialog says so in its own line rather than describing every deletion identically. brief_usage.opportunity_id is ON DELETE SET NULL, so the usage record survives and quota already spent stays spent — deleting must not hand back an allowance.
  • Authorization is unchanged. The new endpoint guards with assertOpportunitiesAccess(ids, req.user.id), exactly like POST /bulk/status next to it, so deletion is available to any org member. Content: let selected opportunities be deleted, with a confirmation #731 raised whether permanent deletion should instead be admin/manager only. That is a product decision and is deliberately not made here; say the word and it is a one-line change.

Single-row deletion is intentionally out of scope — on a list this long a per-row delete invites accidents.

Related issue

Closes #660
Closes #731

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

Filters (#660)

  1. On a brand with opportunities, set Status to a value with no rows (e.g. dismissed on a brand that has none).
  2. The filter bar stays visible, the message reads "No opportunities match your filters", and a Clear filters button is offered.
  3. Click it — all four controls (status, impact, type, search) reset and the list returns.
  4. On a brand with no opportunities at all and no filters active, the "No content opportunities yet" + Generate card still appears, unchanged.

Delete (#731)

  1. Select several rows; Delete appears only while a selection exists.
  2. Open the dialog and cancel — nothing is removed.
  3. Confirm — the rows are gone after a reload, not merely hidden behind a status filter.
  4. Select a row that has a generated brief and confirm the dialog adds the brief warning.
  5. Delete enough rows from the last page to empty it and confirm the pager lands on a page that still exists rather than a blank one.

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 build and the server test suite (276 tests) also pass locally.

…ing selections

Two problems on the Content page, both about a list the reader cannot get
out of.

Selecting a filter combination that matched nothing unmounted the whole
content branch, filter bar included, and replaced it with the "No content
opportunities yet" + Generate card. The filter values live in React state,
so the reader was stuck with no control on screen to undo their own choice
and an empty state that was simply wrong — data existed, the filter just
matched nothing. Only the unfiltered view can say a brand truly has no
opportunities, so the Generate card is now gated on that, and the
no-matches message carries a Clear filters button.

The bulk bar offered send, done and dismiss but no way to remove anything.
Dismissing hides a row behind a status filter and leaves it in the table,
which is no help to a brand carrying hundreds of stale suggestions —
across production the open list averages 147 rows per brand against 114
dismissed in total. Delete now sits last in the bar, behind a confirmation
that states the count and warns separately when the selection includes a
generated brief: the brief lives on the opportunity row, so it goes with
it, and brief_usage.opportunity_id is ON DELETE SET NULL, so quota already
spent stays spent.

Closes #660
Closes #731
@gkhngyk
gkhngyk force-pushed the feature/660-731-content-filters-and-bulk-delete branch from 4dfa853 to 6dbd8a6 Compare August 18, 2026 10:22
@gkhngyk
gkhngyk merged commit 9cccf24 into main Aug 18, 2026
4 checks passed
@gkhngyk
gkhngyk deleted the feature/660-731-content-filters-and-bulk-delete branch August 18, 2026 10:45
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.

Content: let selected opportunities be deleted, with a confirmation Content: zero-result filters hide the filter bar, leaving no way to clear them

1 participant