Skip to content

feat(react): group, sort, and filter preference rows#75

Open
soufian3hm wants to merge 2 commits into
dodopayments:mainfrom
soufian3hm:feat/preferences-grouping
Open

feat(react): group, sort, and filter preference rows#75
soufian3hm wants to merge 2 commits into
dodopayments:mainfrom
soufian3hm:feat/preferences-grouping

Conversation

@soufian3hm

Copy link
Copy Markdown
Contributor

Frontend-only slice of #38 -- the grouping / sorting / filtering the issue calls out as shippable against current data. The other three items (critical categories, global per-channel toggle, categories endpoint) are the server half, so this intentionally does not close #38.

What

<Preferences> and <Inbox> gain three optional props:

  • preferencesFilter?: (category: string) => boolean -- show only a subset of categories.
  • preferencesSort?: (a: string, b: string) => number -- order the rows (default: alphabetical, unchanged).
  • preferenceGroups?: PreferenceGroup[] -- render rows under labeled headings; categories in no group follow in sorted order, and an empty group renders no heading.

PreferenceGroup ({ label, categories }) is exported. It works against the panel's existing category source (loaded items + explicit preference rows), so there is no server change. Default rendering with no props is unchanged.

Verification

biome, pnpm --filter "./packages/*" build, typecheck, and vitest are all green -- 110 react tests, including 5 new ones: filter, sort, groups + ungrouped tail, empty-group heading suppression, and the props threading through <Inbox> to the panel. A minor changeset covers @chimely/react.

I kept this to the frontend-only slice deliberately. Happy to add a Closes #38 (or open follow-up issues for the server items) if you'd prefer -- your call on how to track the remainder.

Frontend-only slice. <Preferences> and <Inbox> gain preferencesFilter,
preferencesSort, and preferenceGroups: categories can be filtered,
reordered, and rendered under labeled headings, with ungrouped rows
following in sorted order. PreferenceGroup is exported. Default
rendering is unchanged.

Refs dodopayments#38
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds grouping controls for React preference rows. The main changes are:

  • New preferencesFilter, preferencesSort, and preferenceGroups props on the preferences UI.
  • Prop threading from <Inbox> through <InboxContent> into <Preferences>.
  • Exported PreferenceGroup type and group label styling.
  • Tests for filtering, sorting, grouping, empty groups, and Inbox prop threading.

Confidence Score: 4/5

The changed flow looks mergeable after handling duplicate categories in groups.

  • Grouped preference rows work for the covered filter, sort, and grouping cases.
  • A category listed in more than one group can render duplicate controls for the same setting.
  • The public type exports and prop threading are consistent with the changed React API.

packages/react/src/components/Preferences.tsx

Important Files Changed

Filename Overview
packages/react/src/components/Preferences.tsx Adds preference filtering, sorting, and grouped rendering, with one duplicate-category edge case in grouped rows.
packages/react/src/components/InboxContent.tsx Adds the new preference props and forwards them to Preferences when the panel is open.
packages/react/src/Inbox.tsx Threads the new preference props from Inbox into InboxContent.
packages/react/src/index.ts Exports the new PreferenceGroup type from the package entry point.
packages/react/src/composition.test.tsx Adds tests for the new preference filtering, sorting, grouping, and prop threading behavior.
packages/react/src/styles.ts Adds CSS for preference group labels.

Reviews (1): Last reviewed commit: "feat(react): group, sort, filter prefere..." | Re-trigger Greptile

</label>
))}
{groups.map((group) => {
const rows = group.categories.filter((category) => visibleSet.has(category));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Duplicate Category Rows

When the same category appears in two groups, this renders two checkboxes for the same preference. Both rows use the same key={category} and write the same { category, channel: 'in_app' } preference, so React can reuse the wrong row identity and the panel shows duplicate controls for one setting.

Context Used: CLAUDE.md (source)

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.

Preferences depth: critical categories, global toggles, categories endpoint

2 participants