Skip to content

Make inventory sections collapsible#14

Merged
narayan24 merged 1 commit into
masterfrom
feature/collapsible-inventory
May 14, 2026
Merged

Make inventory sections collapsible#14
narayan24 merged 1 commit into
masterfrom
feature/collapsible-inventory

Conversation

@narayan24
Copy link
Copy Markdown
Owner

Summary

The Clothing and Items sections in the inventory panel can now be collapsed and expanded by clicking their headers.

Behaviour:

  • Both sections start expanded by default
  • Header shows ▲ when expanded, ▼ when collapsed
  • State persists across inventory refreshes (e.g. after buying an item) via _inventoryCollapsed dictionary — same pattern as _journalExpanded used by the quest journal
  • Collapsing one section doesn't affect the other

Implementation:

  • Replaced AddInventorySectionHeader (plain TextBlock) and AddInventoryEmptyNote with AddInvCollapsibleSection(key, title, content) and AddInvEmptyNote(target)
  • Each section's item rows are built into a local StackPanel first, then passed to AddInvCollapsibleSection
  • Header is a Border with MouseLeftButtonUp toggle — reuses Journal.Hdr.Bg and Journal.Chevron theme resources so it fits both Dark and Light themes automatically

Test plan

  • Both sections start expanded on first launch
  • Clicking "CLOTHING" header collapses/expands clothing list
  • Clicking "ITEMS" header collapses/expands items list
  • Collapsed state survives inventory refresh (e.g. pick up an item → section stays collapsed)
  • Chevron correctly shows ▲ / ▼
  • Works in both Dark and Light themes

🤖 Generated with Claude Code

Both the Clothing and Items sections in the inventory panel now have a
clickable header that toggles their content. State persists across
panel refreshes via _inventoryCollapsed dict (same pattern as the
existing _journalExpanded for the quest journal).

- Sections start expanded by default
- Header shows ▲ (open) / ▼ (closed) chevron
- Style reuses Journal.Hdr.Bg + Journal.Chevron theme resources
- AddInventorySectionHeader + AddInventoryEmptyNote replaced by
  AddInvCollapsibleSection + AddInvEmptyNote; content is now built
  into a local StackPanel per section before being handed to the header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@narayan24 narayan24 merged commit 3babe91 into master May 14, 2026
@narayan24 narayan24 deleted the feature/collapsible-inventory branch May 14, 2026 17:12
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