@@ -533,12 +533,13 @@ function CandRow({ id, label, count, checked, onToggle, curatable, curate, onCur
533533 ) ;
534534}
535535
536- function EntitySection ( { title, kind, items, makeId, makeName, isSel, onToggle, onAddMany } : {
536+ function EntitySection ( { title, kind, items, makeId, makeName, isSel, onToggle, onAddMany, onDeselect } : {
537537 title : string ; kind : CandidateKind ; items : EntityFacet [ ] ;
538538 makeId : ( v : string ) => string ; makeName : ( v : string ) => string ;
539539 isSel : ( id : string ) => boolean ;
540540 onToggle : ( id : string , spec : CandidateSpec ) => void ;
541541 onAddMany : ( items : { id : string ; spec : CandidateSpec } [ ] ) => void ;
542+ onDeselect ?: ( ) => void ;
542543} ) {
543544 const [ open , setOpen ] = useState ( true ) ;
544545 const [ q , setQ ] = useState ( '' ) ;
@@ -553,7 +554,13 @@ function EntitySection({ title, kind, items, makeId, makeName, isSel, onToggle,
553554 < Text fw = { 600 } size = "sm" lineClamp = { 1 } > { title } < Text span c = "dimmed" size = "xs" > ({ items . length } )</ Text > </ Text >
554555 { selN ? < Badge size = "xs" color = "orange" variant = "light" style = { { flexShrink : 0 } } > { selN } added</ Badge > : null }
555556 </ Group >
556- < BulkButtons items = { addItems } onAdd = { onAddMany } />
557+ < Group gap = { 4 } wrap = "nowrap" style = { { flexShrink : 0 } } >
558+ { selN > 0 && onDeselect && (
559+ < Button size = "compact-xs" variant = "subtle" color = "gray"
560+ onClick = { ( e ) => { e . stopPropagation ( ) ; onDeselect ( ) ; } } > Deselect all</ Button >
561+ ) }
562+ < BulkButtons items = { addItems } onAdd = { onAddMany } />
563+ </ Group >
557564 </ Group >
558565 < Collapse in = { open } >
559566 < TextInput size = "xs" mt = "xs" placeholder = { `Search ${ title . toLowerCase ( ) } …` } value = { q }
@@ -1477,9 +1484,9 @@ function PlannerStep({ planner, setPlanner, setup, aiExtras, setAiExtras, onDone
14771484 { ( ( f . studios ?. length ?? 0 ) > 0 || ( f . directors ?. length ?? 0 ) > 0 || ( f . actors ?. length ?? 0 ) > 0 ) && (
14781485 < >
14791486 < Divider label = "Studios, directors & actors" labelPosition = "left" />
1480- { ( f . studios ?. length ?? 0 ) > 0 && < EntitySection title = "Studios" kind = "studio" items = { f . studios ! } makeId = { cid . studio } makeName = { ( v ) => v } isSel = { isSel } onToggle = { toggleSel } onAddMany = { addMany } /> }
1481- { ( f . directors ?. length ?? 0 ) > 0 && < EntitySection title = "Directors" kind = "director" items = { f . directors ! } makeId = { cid . director } makeName = { ( v ) => `Directed by ${ v } ` } isSel = { isSel } onToggle = { toggleSel } onAddMany = { addMany } /> }
1482- { ( f . actors ?. length ?? 0 ) > 0 && < EntitySection title = "Actors" kind = "actor" items = { f . actors ! } makeId = { cid . actor } makeName = { ( v ) => `${ v } Movies` } isSel = { isSel } onToggle = { toggleSel } onAddMany = { addMany } /> }
1487+ { ( f . studios ?. length ?? 0 ) > 0 && < EntitySection title = "Studios" kind = "studio" items = { f . studios ! } makeId = { cid . studio } makeName = { ( v ) => v } isSel = { isSel } onToggle = { toggleSel } onAddMany = { addMany } onDeselect = { ( ) => removeMany ( f . studios ! . map ( i => cid . studio ( i . value ) ) ) } /> }
1488+ { ( f . directors ?. length ?? 0 ) > 0 && < EntitySection title = "Directors" kind = "director" items = { f . directors ! } makeId = { cid . director } makeName = { ( v ) => `Directed by ${ v } ` } isSel = { isSel } onToggle = { toggleSel } onAddMany = { addMany } onDeselect = { ( ) => removeMany ( f . directors ! . map ( i => cid . director ( i . value ) ) ) } /> }
1489+ { ( f . actors ?. length ?? 0 ) > 0 && < EntitySection title = "Actors" kind = "actor" items = { f . actors ! } makeId = { cid . actor } makeName = { ( v ) => `${ v } Movies` } isSel = { isSel } onToggle = { toggleSel } onAddMany = { addMany } onDeselect = { ( ) => removeMany ( f . actors ! . map ( i => cid . actor ( i . value ) ) ) } /> }
14831490 </ >
14841491 ) }
14851492
@@ -1538,6 +1545,7 @@ function PlannerStep({ planner, setPlanner, setup, aiExtras, setAiExtras, onDone
15381545 isSel = { isSel }
15391546 onToggle = { toggleSel }
15401547 onAddMany = { addMany }
1548+ onDeselect = { ( ) => removeMany ( f . countries ! . map ( i => cid . country ( i . value ) ) ) }
15411549 />
15421550 ) }
15431551 { ( f . moods ?. length ?? 0 ) > 0 && (
@@ -1550,6 +1558,7 @@ function PlannerStep({ planner, setPlanner, setup, aiExtras, setAiExtras, onDone
15501558 isSel = { isSel }
15511559 onToggle = { toggleSel }
15521560 onAddMany = { addMany }
1561+ onDeselect = { ( ) => removeMany ( f . moods ! . map ( i => cid . mood ( i . value ) ) ) }
15531562 />
15541563 ) }
15551564 { ( f . styles ?. length ?? 0 ) > 0 && (
@@ -1562,6 +1571,7 @@ function PlannerStep({ planner, setPlanner, setup, aiExtras, setAiExtras, onDone
15621571 isSel = { isSel }
15631572 onToggle = { toggleSel }
15641573 onAddMany = { addMany }
1574+ onDeselect = { ( ) => removeMany ( f . styles ! . map ( i => cid . style ( i . value ) ) ) }
15651575 />
15661576 ) }
15671577 </ >
0 commit comments