@@ -26,12 +26,12 @@ export default function PinnedMonsterTray({
2626 onSelect : ( monster : Monster ) => void ;
2727 onUnpin : ( monsterId : string ) => void ;
2828} ) {
29- const [ collapsedIds , setCollapsedIds ] = useState < Set < string > > ( ( ) => new Set ( ) ) ;
30- const allExpanded = monsters . every ( ( monster ) => ! collapsedIds . has ( monster . id ) ) ;
31- const allCollapsed = monsters . every ( ( monster ) => collapsedIds . has ( monster . id ) ) ;
29+ const [ expandedIds , setExpandedIds ] = useState < Set < string > > ( ( ) => new Set ( ) ) ;
30+ const allExpanded = monsters . every ( ( monster ) => expandedIds . has ( monster . id ) ) ;
31+ const allCollapsed = monsters . every ( ( monster ) => ! expandedIds . has ( monster . id ) ) ;
3232
3333 function toggleMonster ( monsterId : string ) {
34- setCollapsedIds ( ( current ) => {
34+ setExpandedIds ( ( current ) => {
3535 const next = new Set ( current ) ;
3636 if ( next . has ( monsterId ) ) next . delete ( monsterId ) ;
3737 else next . add ( monsterId ) ;
@@ -40,7 +40,7 @@ export default function PinnedMonsterTray({
4040 }
4141
4242 function handleUnpin ( monsterId : string ) {
43- setCollapsedIds ( ( current ) => {
43+ setExpandedIds ( ( current ) => {
4444 if ( ! current . has ( monsterId ) ) return current ;
4545 const next = new Set ( current ) ;
4646 next . delete ( monsterId ) ;
@@ -77,15 +77,15 @@ export default function PinnedMonsterTray({
7777 < p className = "mr-auto text-xs text-[var(--text-3)]" > Full stat blocks · newest pin first</ p >
7878 < button
7979 type = "button"
80- onClick = { ( ) => setCollapsedIds ( new Set ( ) ) }
80+ onClick = { ( ) => setExpandedIds ( new Set ( monsters . map ( ( monster ) => monster . id ) ) ) }
8181 disabled = { allExpanded }
8282 className = "btn-ghost !min-h-8 !px-2.5 text-xs disabled:cursor-default disabled:opacity-40"
8383 >
8484 Expand all
8585 </ button >
8686 < button
8787 type = "button"
88- onClick = { ( ) => setCollapsedIds ( new Set ( monsters . map ( ( monster ) => monster . id ) ) ) }
88+ onClick = { ( ) => setExpandedIds ( new Set ( ) ) }
8989 disabled = { allCollapsed }
9090 className = "btn-ghost !min-h-8 !px-2.5 text-xs disabled:cursor-default disabled:opacity-40"
9191 >
@@ -95,7 +95,7 @@ export default function PinnedMonsterTray({
9595
9696 < div className = "min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2 [scrollbar-gutter:stable] sm:p-3" >
9797 { monsters . map ( ( monster ) => {
98- const isExpanded = ! collapsedIds . has ( monster . id ) ;
98+ const isExpanded = expandedIds . has ( monster . id ) ;
9999 const contentId = `pinned-monster-${ monster . id } -details` ;
100100 const labelId = `pinned-monster-${ monster . id } -label` ;
101101
0 commit comments