@@ -61,67 +61,71 @@ const GameboardBuilderRow = (
61
61
const isSelected = question . id !== undefined && currentQuestions . selectedQuestions . has ( question . id ) ;
62
62
63
63
return filteredAudienceViews . map ( ( view , i , arr ) => < tr
64
- key = { `${ question . id } ${ i } ` } ref = { provided && provided . innerRef }
65
- className = { classnames ( { selected : isSelected } ) }
66
- { ...( provided && provided . draggableProps ) } { ...( provided && provided . dragHandleProps ) }
64
+ key = { `${ question . id } ${ i } ` } className = { classnames ( { selected : isSelected } ) }
67
65
>
68
66
{ i === 0 && < >
69
67
< td rowSpan = { arr . length } className = "w-5 text-center align-middle" >
70
- < RS . Input
71
- type = "checkbox"
72
- id = { `${ provided ? "gameboard-builder" : "question-search-modal" } -include-${ question . id } ` }
73
- aria-label = { ! isSelected ? "Select question" : "Deselect question" }
74
- title = { ! isSelected ? "Select question" : "Deselect question" }
75
- color = "secondary"
76
- className = { ! provided ? "isaac-checkbox mt-1" : undefined }
77
- checked = { isSelected }
78
- onChange = { ( ) => {
79
- if ( question . id ) {
80
- const newSelectedQuestions = new Map ( currentQuestions . selectedQuestions ) ;
81
- const newQuestionOrder = [ ...currentQuestions . questionOrder ] ;
82
- if ( newSelectedQuestions . has ( question . id ) ) {
83
- newSelectedQuestions . delete ( question . id ) ;
84
- newQuestionOrder . splice ( newQuestionOrder . indexOf ( question . id ) , 1 ) ;
85
- } else {
86
- newSelectedQuestions . set ( question . id , { ...question , creationContext} ) ;
87
- newQuestionOrder . push ( question . id ) ;
68
+ < div className = "d-flex justify-content-center" >
69
+ < RS . Input
70
+ type = "checkbox"
71
+ id = { `${ provided ? "gameboard-builder" : "question-search-modal" } -include-${ question . id } ` }
72
+ aria-label = { ! isSelected ? "Select question" : "Deselect question" }
73
+ title = { ! isSelected ? "Select question" : "Deselect question" }
74
+ color = "secondary"
75
+ className = { ! provided ? "isaac-checkbox mt-1" : undefined }
76
+ checked = { isSelected }
77
+ onChange = { ( ) => {
78
+ if ( question . id ) {
79
+ const newSelectedQuestions = new Map ( currentQuestions . selectedQuestions ) ;
80
+ const newQuestionOrder = [ ...currentQuestions . questionOrder ] ;
81
+ if ( newSelectedQuestions . has ( question . id ) ) {
82
+ newSelectedQuestions . delete ( question . id ) ;
83
+ newQuestionOrder . splice ( newQuestionOrder . indexOf ( question . id ) , 1 ) ;
84
+ } else {
85
+ newSelectedQuestions . set ( question . id , { ...question , creationContext} ) ;
86
+ newQuestionOrder . push ( question . id ) ;
87
+ }
88
+ currentQuestions . setSelectedQuestions ( newSelectedQuestions ) ;
89
+ currentQuestions . setQuestionOrder ( newQuestionOrder ) ;
90
+ if ( provided ) {
91
+ undoStack . push ( { questionOrder : currentQuestions . questionOrder , selectedQuestions : currentQuestions . selectedQuestions } ) ;
92
+ redoStack . clear ( ) ;
93
+ }
88
94
}
89
- currentQuestions . setSelectedQuestions ( newSelectedQuestions ) ;
90
- currentQuestions . setQuestionOrder ( newQuestionOrder ) ;
91
- if ( provided ) {
92
- undoStack . push ( { questionOrder : currentQuestions . questionOrder , selectedQuestions : currentQuestions . selectedQuestions } ) ;
93
- redoStack . clear ( ) ;
94
- }
95
- }
96
- } }
97
- />
95
+ } }
96
+ />
97
+ </ div >
98
98
</ td >
99
99
< td rowSpan = { arr . length } className = { classNames ( cellClasses , siteSpecific ( "w-40" , "w-30" ) ) } >
100
- { provided && < img src = "/assets/common/icons/drag_indicator.svg" alt = "Drag to reorder" className = "me-1 grab-cursor" /> }
101
100
< div className = "d-flex" >
102
- < a className = "me-2 text-wrap" href = { `/questions/${ question . id } ` } target = "_blank" rel = "noopener noreferrer" title = "Preview question in new tab" >
103
- { generateQuestionTitle ( question ) }
104
- </ a >
105
- < input
106
- type = "image" src = "/assets/common/icons/new-tab.svg" alt = "Preview question" title = "Preview question in modal"
107
- className = "pointer-cursor align-middle new-tab" onClick = { ( ) => question . id && openQuestionModal ( question . id ) }
108
- />
109
- < Spacer />
110
- { isPhy && < div className = "d-flex flex-column justify-self-end" >
111
- { question . supersededBy && < a
112
- className = "superseded-tag ms-1 ms-sm-3 my-1 align-self-end"
113
- href = { `/questions/${ question . supersededBy } ` }
114
- onClick = { ( e ) => e . stopPropagation ( ) }
115
- > SUPERSEDED</ a > }
116
- { question . tags ?. includes ( "nofilter" ) && < span
117
- className = "superseded-tag ms-1 ms-sm-3 my-1 align-self-end"
118
- > NO-FILTER</ span > }
119
- </ div > }
120
- </ div >
101
+ { provided && < img src = "/assets/common/icons/drag_indicator.svg" alt = "Drag to reorder" className = "me-1 grab-cursor" /> }
102
+ < div >
103
+ < div className = "d-flex" >
104
+ < a className = "me-2 text-wrap" href = { `/questions/${ question . id } ` } target = "_blank" rel = "noopener noreferrer" title = "Preview question in new tab" >
105
+ { generateQuestionTitle ( question ) }
106
+ </ a >
107
+ < input
108
+ type = "image" src = "/assets/common/icons/new-tab.svg" alt = "Preview question" title = "Preview question in modal"
109
+ className = "pointer-cursor align-middle new-tab" onClick = { ( ) => question . id && openQuestionModal ( question . id ) }
110
+ />
111
+ < Spacer />
112
+ { isPhy && < div className = "d-flex flex-column justify-self-end" >
113
+ { question . supersededBy && < a
114
+ className = "superseded-tag ms-1 ms-sm-3 my-1 align-self-end"
115
+ href = { `/questions/${ question . supersededBy } ` }
116
+ onClick = { ( e ) => e . stopPropagation ( ) }
117
+ > SUPERSEDED</ a > }
118
+ { question . tags ?. includes ( "nofilter" ) && < span
119
+ className = "superseded-tag ms-1 ms-sm-3 my-1 align-self-end"
120
+ > NO-FILTER</ span > }
121
+ </ div > }
122
+ </ div >
121
123
122
- { question . subtitle && < >
123
- < span className = "small text-muted d-none d-sm-block" > { question . subtitle } </ span >
124
- </ > }
124
+ { question . subtitle && < >
125
+ < span className = "small text-muted d-none d-sm-block" > { question . subtitle } </ span >
126
+ </ > }
127
+ </ div >
128
+ </ div >
125
129
</ td >
126
130
< td rowSpan = { arr . length } className = { classNames ( cellClasses , siteSpecific ( "w-25" , "w-20" ) ) } >
127
131
{ topicTag ( ) }
@@ -142,4 +146,5 @@ const GameboardBuilderRow = (
142
146
</ td > }
143
147
</ tr > ) ;
144
148
} ;
149
+
145
150
export default GameboardBuilderRow ;
0 commit comments