Skip to content

feat(command-bar): show residents under each building + search NPC names#65

Merged
harshithmullapudi merged 1 commit into
mainfrom
feat/command-bar-npcs
Jul 14, 2026
Merged

feat(command-bar): show residents under each building + search NPC names#65
harshithmullapudi merged 1 commit into
mainfrom
feat/command-bar-npcs

Conversation

@harshithmullapudi

Copy link
Copy Markdown
Member

The Cmd+K palette used to render every row as

HOME
home · home

That secondary line was category · plotKey — useful for a debugger, opaque for a player. Replaces it with the actual residents of that building, and folds their names into the cmdk value string so typing an NPC's name jumps you to the building they live in.

Before → after

Before

HOME
home · home                                Teleport →

After

Home
Cosma, Linnea                              Teleport →

What changed

  • Groups the flat getNpcs() list by buildingId at open-time (also re-runs when onNpcsChange fires, since the roster loads async and might not be there when Cmd+K is first hit).
  • The secondary line renders resident names joined by , . When a building has no residents yet, it falls back to a muted "no residents yet".
  • Fallback building label switched from HOME (id-uppercased) to Home (title-cased) — reads as a place name, not a shouted key.
  • value={label + id + residentNames.toLowerCase()} — search now matches building labels, ids, or any NPC name typed as-is.

Overflow handling

Residents line has truncate (CSS ellipsis). Up to ~3 names fit; the rest get . Search still finds them because cmdk filters against the full value string. Follow-up: if that gets ugly on packed buildings, switch to Cosma, Linnea +3 more.

🤖 Generated with Claude Code

…names

The Cmd+K palette used to render every row as

    HOME
    home · home

That "home · home" line is just `category · plotKey` — useful for a
debugger, opaque for a player. Replaces it with the actual residents
of that building, and folds their names into the cmdk `value` string
so typing an NPC's name jumps you to the building they live in.

- Groups the flat `getNpcs()` list by `buildingId` at open-time (also
  re-runs when `onNpcsChange` fires, since the roster loads async and
  might not be there when Cmd+K is first hit).
- Row now reads:
      Gilded Fox
      Cosma, Linnea
  When a building has no residents yet, the secondary line falls
  back to a muted "no residents yet".
- Fallback label switched from `HOME` (id-uppercased) to `Home`
  (title-cased) — reads as a place name, not a shouted key.
- `value={label + id + residentNames.toLowerCase()}` — search matches
  building labels, ids, or any NPC name typed as-is.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@harshithmullapudi
harshithmullapudi merged commit 3a0e305 into main Jul 14, 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.

1 participant