[GH-ISSUE #7803] soup/ [Feature]: Shared character picker to replace duplicated pickers #4309

Closed
opened 2026-10-21 06:14:39 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Gunterlie on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7803

Originally assigned to: @SpicyMarinara on GitHub.

Part of S.O.U.P. 🥣
Simplify · Organize · Unify · Polish

An intuitive Marinara, built on clear interaction rules, thoughtful UX, and a cohesive, polished UI.

What problem does this solve?

Picking characters looks and behaves differently depending on where you are. There is no shared character picker in the client: an inventory of packages/client/src found about 18 separate pickers, each with its own markup and logic. The only shared piece is the generic PickerDropdown (features/chat-settings/PickerDropdown.tsx), and only Chat Settings uses it for characters.

For users this means search, avatars, paging and folder handling exist in some pickers and are missing in others. For contributors it means the same fix has to land in several copies, and the copies drift. The clearest case: ChatSetupWizard.tsx carries the participants picker twice (Conversation step at ~L1690, Roleplay at ~L3107), each with its own search state, characterPickerLimit and CHARACTER_PICKER_PAGE_SIZE paging.

Inventory

A. Search + avatar list, single or multi select. Best fit for a shared component.

Where Select
components/chat/ChatSetupWizard.tsx ~L1690, participants (Conversation) multi
components/chat/ChatSetupWizard.tsx ~L3107, participants (Roleplay), copy of the above multi
components/chat/ChatSettingsDrawer.tsx ~L6322, "Add character" (uses PickerDropdown) single, adds
components/game/GameSetupWizard.tsx ~L2517, GM single
components/game/GameSetupWizard.tsx ~L2620, party (same markup as GM) multi
components/chat/CharacterScheduleManagerModal.tsx ~L473 (plus per-row auto-renew) multi
components/chat/ChatSetupWizard.tsx ~L623 PersonaPicker (persona or character identity) single

B. Native <select>, one character. ChatGallery.tsx ~L595, MultiplayerParticipantControls.tsx ~L91, AvatarAgentSetup.tsx ~L104, TrackerCardColorSettings.tsx ~L443.

C. Chips/popover, multi, no avatars. RegexScriptEditor.tsx ~L170 ScopeTargetPicker, LorebookEditor.tsx ~L177 LinkedResourcePicker, LorebookEntryRow.tsx ~L1373 FilterPills.

D. Special-purpose. ChatInput.tsx ~L2240 (who replies), TTSConfigCard.tsx ~L809 (searchable per voice row), ChatSettingsDrawer.tsx ~L6404 (add a folder), AgentSuiteModal.tsx ~L852 (mixed context sources).

Line numbers are approximate as of staging on 2026-10-19.

Proposed solution

Add one shared CharacterPicker for group A: search, avatars, paging, folder add and a single/multi mode. It can render inside PickerDropdown when used as a popover. Migrate in this order, one small PR each:

  1. The two ChatSetupWizard participant pickers. Exact duplicates, highest drift risk, lowest behavior risk.
  2. GameSetupWizard GM + party pickers. Same markup, only single vs multi differs.
  3. Chat Settings "Add character".

After that, consider CharacterScheduleManagerModal and PersonaPicker. They need per-row extras and persona mixing, so move them only once the shared picker is proven.

Out of scope for now:

  • B (native selects): small, accessible, working. Replacing them adds code for little gain.
  • C: move only if lorebook/regex scope gains a need for avatars or search.
  • D: keep as-is.

Each migration must keep current behavior (search matching via characterMatchesSearch, paging, folder add, keyboard/focus) and show the same result at mobile and desktop widths.

Where shared components live, and rules for them

No new folder or schema is needed. The structure exists; what is missing are rules for using it.

Current state

  • components/ui/ (51 files): documented in packages/client/.instructions.md as "Reusable UI primitives". It holds real primitives (Modal, Drawer, ColorPicker, EmojiPicker, ContextMenu) but also single-feature parts (SpriteGenerationModal, ChibiProfessorMariEasterEgg, WorldStateInstruments, TrackerCardColorControls). 15 of the 51 files import hooks, stores or the API client.
  • components/<entity>/ (characters/, personas/, lorebooks/, ...): per-domain folders. The right home for shared parts that read entity data.
  • features/: meant to be self-contained modules, yet components/ imports from features/ in 14 files. The generic PickerDropdown lives in features/chat-settings/, where other areas do not look for it.
  • No rule says when to extract a shared component. That is how we got ~18 character pickers.

Proposed rules

  1. Two tiers of shared components.
    • components/ui/: no domain knowledge. Data in via props only; no entity hooks, stores or API calls.
    • components/<entity>/: shared parts for one entity, e.g. components/characters/CharacterPicker.tsx. May use that entity's hook (useCharacters) and builds on ui/ primitives.
  2. Look before you build. Before adding a picker, modal, list or select, search components/ui/ and the entity folder.
  3. Extract at the second exact copy or the third similar copy. No shared component with only one caller.
  4. features/ stays self-contained. If code outside a feature imports a part from it, move that part to ui/ or the entity folder. First move: PickerDropdown → components/ui/.
  5. Keep the API small. Prefer composition (children, render slots) over a growing list of boolean props. One mode prop (e.g. single | multi) beats several flags.
  6. Quality lives once, in the shared part: localization keys, keyboard and focus support, mobile and desktop layout, theme tokens only (no per-surface colours).
  7. Migrate callers one at a time. One small PR per caller, keeping current behavior, with screenshots as proof.

Enforcement

  • Write these rules into packages/client/.instructions.md under "Component Pattern" and update its directory map (it lists only 6 of the 51 ui/ files and 2 of the 4 features/ modules).
  • Later, an ESLint no-restricted-imports rule can stop ui/ from importing hooks, stores or the API. 15 files would break it today, so start with documentation and add the lint rule after a cleanup.

Suggested PR order

  1. Docs PR: rules in .instructions.md + move PickerDropdown to components/ui/.
  2. CharacterPicker in components/characters/ + migrate the two ChatSetupWizard participant pickers.
  3. GameSetupWizard GM + party pickers.
  4. Chat Settings "Add character".

Alternatives considered

  • Unify every picker, including native selects. Rejected: more code and more risk than it saves.
  • Extend PickerDropdown itself with character rows. Rejected: it is a generic popover also used for lorebooks and functions. Keep it generic and compose the character list on top.
  • Leave as-is. The duplicate ChatSetupWizard code will keep drifting.

Additional context

The inventory comes from a read-only scan of packages/client/src. The ChatSetupWizard duplication and the PickerDropdown API were checked by hand.

@SpicyMarinara

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Gunterlie on GitHub (Oct 19, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7803 Originally assigned to: @SpicyMarinara on GitHub. > **Part of S.O.U.P. 🥣** > **S**implify · **O**rganize · **U**nify · **P**olish > > *An intuitive Marinara, built on clear interaction rules, thoughtful UX, and a cohesive, polished UI.* ## What problem does this solve? Picking characters looks and behaves differently depending on where you are. There is no shared character picker in the client: an inventory of `packages/client/src` found about 18 separate pickers, each with its own markup and logic. The only shared piece is the generic `PickerDropdown` (`features/chat-settings/PickerDropdown.tsx`), and only Chat Settings uses it for characters. For users this means search, avatars, paging and folder handling exist in some pickers and are missing in others. For contributors it means the same fix has to land in several copies, and the copies drift. The clearest case: `ChatSetupWizard.tsx` carries the participants picker twice (Conversation step at ~L1690, Roleplay at ~L3107), each with its own search state, `characterPickerLimit` and `CHARACTER_PICKER_PAGE_SIZE` paging. ### Inventory **A. Search + avatar list, single or multi select. Best fit for a shared component.** | Where | Select | |---|---| | `components/chat/ChatSetupWizard.tsx` ~L1690, participants (Conversation) | multi | | `components/chat/ChatSetupWizard.tsx` ~L3107, participants (Roleplay), copy of the above | multi | | `components/chat/ChatSettingsDrawer.tsx` ~L6322, "Add character" (uses `PickerDropdown`) | single, adds | | `components/game/GameSetupWizard.tsx` ~L2517, GM | single | | `components/game/GameSetupWizard.tsx` ~L2620, party (same markup as GM) | multi | | `components/chat/CharacterScheduleManagerModal.tsx` ~L473 (plus per-row auto-renew) | multi | | `components/chat/ChatSetupWizard.tsx` ~L623 `PersonaPicker` (persona or character identity) | single | **B. Native `<select>`, one character.** `ChatGallery.tsx` ~L595, `MultiplayerParticipantControls.tsx` ~L91, `AvatarAgentSetup.tsx` ~L104, `TrackerCardColorSettings.tsx` ~L443. **C. Chips/popover, multi, no avatars.** `RegexScriptEditor.tsx` ~L170 `ScopeTargetPicker`, `LorebookEditor.tsx` ~L177 `LinkedResourcePicker`, `LorebookEntryRow.tsx` ~L1373 `FilterPills`. **D. Special-purpose.** `ChatInput.tsx` ~L2240 (who replies), `TTSConfigCard.tsx` ~L809 (searchable per voice row), `ChatSettingsDrawer.tsx` ~L6404 (add a folder), `AgentSuiteModal.tsx` ~L852 (mixed context sources). Line numbers are approximate as of `staging` on 2026-10-19. ## Proposed solution Add one shared `CharacterPicker` for group A: search, avatars, paging, folder add and a single/multi mode. It can render inside `PickerDropdown` when used as a popover. Migrate in this order, one small PR each: 1. **The two `ChatSetupWizard` participant pickers.** Exact duplicates, highest drift risk, lowest behavior risk. 2. **`GameSetupWizard` GM + party pickers.** Same markup, only single vs multi differs. 3. **Chat Settings "Add character".** After that, consider `CharacterScheduleManagerModal` and `PersonaPicker`. They need per-row extras and persona mixing, so move them only once the shared picker is proven. Out of scope for now: - **B (native selects):** small, accessible, working. Replacing them adds code for little gain. - **C:** move only if lorebook/regex scope gains a need for avatars or search. - **D:** keep as-is. Each migration must keep current behavior (search matching via `characterMatchesSearch`, paging, folder add, keyboard/focus) and show the same result at mobile and desktop widths. ## Where shared components live, and rules for them No new folder or schema is needed. The structure exists; what is missing are rules for using it. ### Current state - **`components/ui/`** (51 files): documented in `packages/client/.instructions.md` as "Reusable UI primitives". It holds real primitives (`Modal`, `Drawer`, `ColorPicker`, `EmojiPicker`, `ContextMenu`) but also single-feature parts (`SpriteGenerationModal`, `ChibiProfessorMariEasterEgg`, `WorldStateInstruments`, `TrackerCardColorControls`). 15 of the 51 files import hooks, stores or the API client. - **`components/<entity>/`** (`characters/`, `personas/`, `lorebooks/`, ...): per-domain folders. The right home for shared parts that read entity data. - **`features/`**: meant to be self-contained modules, yet `components/` imports from `features/` in 14 files. The generic `PickerDropdown` lives in `features/chat-settings/`, where other areas do not look for it. - No rule says when to extract a shared component. That is how we got ~18 character pickers. ### Proposed rules 1. **Two tiers of shared components.** - `components/ui/`: no domain knowledge. Data in via props only; no entity hooks, stores or API calls. - `components/<entity>/`: shared parts for one entity, e.g. `components/characters/CharacterPicker.tsx`. May use that entity's hook (`useCharacters`) and builds on `ui/` primitives. 2. **Look before you build.** Before adding a picker, modal, list or select, search `components/ui/` and the entity folder. 3. **Extract at the second exact copy or the third similar copy.** No shared component with only one caller. 4. **`features/` stays self-contained.** If code outside a feature imports a part from it, move that part to `ui/` or the entity folder. First move: `PickerDropdown` → `components/ui/`. 5. **Keep the API small.** Prefer composition (`children`, render slots) over a growing list of boolean props. One `mode` prop (e.g. `single | multi`) beats several flags. 6. **Quality lives once, in the shared part:** localization keys, keyboard and focus support, mobile and desktop layout, theme tokens only (no per-surface colours). 7. **Migrate callers one at a time.** One small PR per caller, keeping current behavior, with screenshots as proof. ### Enforcement - Write these rules into `packages/client/.instructions.md` under "Component Pattern" and update its directory map (it lists only 6 of the 51 `ui/` files and 2 of the 4 `features/` modules). - Later, an ESLint `no-restricted-imports` rule can stop `ui/` from importing hooks, stores or the API. 15 files would break it today, so start with documentation and add the lint rule after a cleanup. ### Suggested PR order 1. Docs PR: rules in `.instructions.md` + move `PickerDropdown` to `components/ui/`. 2. `CharacterPicker` in `components/characters/` + migrate the two `ChatSetupWizard` participant pickers. 3. `GameSetupWizard` GM + party pickers. 4. Chat Settings "Add character". ## Alternatives considered - **Unify every picker, including native selects.** Rejected: more code and more risk than it saves. - **Extend `PickerDropdown` itself with character rows.** Rejected: it is a generic popover also used for lorebooks and functions. Keep it generic and compose the character list on top. - **Leave as-is.** The duplicate `ChatSetupWizard` code will keep drifting. ## Additional context The inventory comes from a read-only scan of `packages/client/src`. The `ChatSetupWizard` duplication and the `PickerDropdown` API were checked by hand. @SpicyMarinara ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:14:39 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 19, 2026):

Closing this for now to clear the board for the next release. It isn't a rejection: reopen it after the release when you pick it up again.

<!-- gh-comment-id:6264052854 --> @SpicyMarinara commented on GitHub (Oct 19, 2026): Closing this for now to clear the board for the next release. It isn't a rejection: reopen it after the release when you pick it up again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4309
No description provided.