@@ -62,19 +62,20 @@ export default function FishboneChart(props) {
62
62
console . log ( `FishboneChart render no causes! props=` , props ) ;
63
63
return < React . Fragment > </ React . Fragment > ;
64
64
}
65
+ const vscodeStyles = window . getComputedStyle ( document . body ) ;
65
66
66
- const getColor = ( index ) => {
67
- const colors = [
68
- 'blue_two' ,
69
- 'gray' ,
70
- 'black' ,
71
- 'green' ,
72
- 'blue' ,
73
- 'orange' ,
74
- 'purple' ,
75
- 'pink' ,
76
-
77
- ] ;
67
+ const getColor = ( index ) => {
68
+ const colors = [
69
+ 'blue_two' ,
70
+ 'gray' ,
71
+ 'black' ,
72
+ 'green' ,
73
+ 'blue' ,
74
+ 'orange' ,
75
+ 'purple' ,
76
+ 'pink' ,
77
+
78
+ ] ;
78
79
79
80
if ( index >= colors . length ) {
80
81
index %= colors . length ;
@@ -158,64 +159,64 @@ export default function FishboneChart(props) {
158
159
}
159
160
160
161
const getHalfCategories = ( categories , top ) => {
161
- // we want them sorted from left to right always changing top/down, e.g.
162
- // 1 3 5
163
- // 2 4
164
-
165
- const halfArray = [ ] ;
162
+ // we want them sorted from left to right always changing top/down, e.g.
163
+ // 1 3 5
164
+ // 2 4
165
+
166
+ const halfArray = [ ] ;
166
167
for ( let i = top ? 0 : 1 ; i < categories . length ; i += 2 ) {
167
168
halfArray . push ( categories [ i ] ) ;
168
- }
169
- // top ? causes.slice(0, middle) : causes.slice(middle);
170
-
171
- const color = effectIndexColor ;
172
- const halfCauses = halfArray . map ( ( category , index ) => {
173
- if ( top ) {
174
- // todo optimize so that we do use only one menu instance?
175
- return (
176
- < div key = { `top_causes_${ category . name } _${ index } ` } className = "causeContent" >
177
- < div className = { `cause top ${ color } _ ${ color } Border` } >
178
- < OnBlurInputBase style = { { height : '1em' } } margin = 'dense' value = { category . name } onChange = { ( event ) => props . onChange ( category , event , 'name' ) } />
179
- { props . categoryContextMenu && props . categoryContextMenu . length > 0 && /* todo race cond if all items are undefined... */
180
- < React . Fragment >
181
- < IconButton id = { `top_cat_${ index } ` } onClick = { handleMenuClick } color = "secondary" size = "small" > < MoreVertIcon fontSize = "small" /> </ IconButton >
182
- < Menu id = { `top_cat_${ index } ` } anchorEl = { menuAnchorEl } keepMounted open = { menuOpen === `top_cat_${ index } ` } onClose = { handleMenuClose } >
183
- { props . categoryContextMenu . filter ( m => m !== undefined ) . map ( ( menuItem , index ) => < MenuItem onClick = { ( ) => { handleMenuClose ( ) ; menuItem ?. cb ( props . data , effectIndex , category ) ; } } > { menuItem . text } </ MenuItem > ) }
184
- </ Menu >
185
- </ React . Fragment >
186
- }
187
-
188
- </ div >
189
- < div className = "causeAndLine" >
190
- { getRootCauses ( category . rootCauses , category ) }
191
- < div className = { `diagonalLine ${ color } TopBottom` } />
192
- </ div >
193
- </ div >
194
- ) ;
195
- } else {
196
- return (
197
- < div key = { `bottom_causes_${ category . name } _${ index } ` } className = "causeContent" >
198
- < div className = "causeAndLine" >
199
- { getRootCauses ( category . rootCauses , category ) }
200
- < div className = { `diagonalLine ${ color } BottomTop` } />
201
- </ div >
202
- < div className = { `cause bottom ${ color } _ ${ color } Border` } >
203
- < OnBlurInputBase style = { { height : '1em' } } margin = 'dense' value = { category . name } onChange = { ( event ) => props . onChange ( category , event , 'name' ) } />
204
- { props . categoryContextMenu && props . categoryContextMenu . length > 0 &&
205
- < React . Fragment >
206
- < IconButton id = { `bottom_cat_${ index } ` } onClick = { handleMenuClick } color = "secondary" size = "small" > < MoreVertIcon fontSize = "small" /> </ IconButton >
207
- < Menu id = { `bottom_cat_${ index } ` } anchorEl = { menuAnchorEl } keepMounted open = { menuOpen === `bottom_cat_${ index } ` } onClose = { handleMenuClose } >
208
- { props . categoryContextMenu . filter ( m => m !== undefined ) . map ( ( menuItem , index ) => < MenuItem onClick = { ( ) => { handleMenuClose ( ) ; menuItem ?. cb ( props . data , effectIndex , category ) ; } } > { menuItem . text } </ MenuItem > ) }
209
- </ Menu >
210
- </ React . Fragment >
211
- }
212
- </ div >
213
- </ div >
214
- ) ;
215
- }
216
- } ) ;
217
- return ( < div className = "causesGroup" > { halfCauses } </ div > ) ;
218
169
}
170
+ // top ? causes.slice(0, middle) : causes.slice(middle);
171
+
172
+ const color = effectIndexColor ;
173
+ const halfCauses = halfArray . map ( ( category , index ) => {
174
+ if ( top ) {
175
+ // todo optimize so that we do use only one menu instance?
176
+ return (
177
+ < div key = { `top_causes_${ category . name } _${ index } ` } className = "causeContent" >
178
+ < div className = { `cause top ${ color } _ ${ color } Border` } >
179
+ < OnBlurInputBase style = { { height : '1em' } } margin = 'dense' value = { category . name } onChange = { ( event ) => props . onChange ( category , event , 'name' ) } />
180
+ { props . categoryContextMenu && props . categoryContextMenu . length > 0 && /* todo race cond if all items are undefined... */
181
+ < React . Fragment >
182
+ < IconButton id = { `top_cat_${ index } ` } onClick = { handleMenuClick } color = "secondary" size = "small" style = { { color : vscodeStyles . getPropertyValue ( '--vscode-button-secondaryForeground' ) , backgroundColor : vscodeStyles . getPropertyValue ( '--vscode-button-secondaryBackground' ) , } } > < MoreVertIcon fontSize = "small" /> </ IconButton >
183
+ < Menu id = { `top_cat_${ index } ` } anchorEl = { menuAnchorEl } keepMounted open = { menuOpen === `top_cat_${ index } ` } onClose = { handleMenuClose } >
184
+ { props . categoryContextMenu . filter ( m => m !== undefined ) . map ( ( menuItem , index ) => < MenuItem onClick = { ( ) => { handleMenuClose ( ) ; menuItem ?. cb ( props . data , effectIndex , category ) ; } } > { menuItem . text } </ MenuItem > ) }
185
+ </ Menu >
186
+ </ React . Fragment >
187
+ }
188
+
189
+ </ div >
190
+ < div className = "causeAndLine" >
191
+ { getRootCauses ( category . rootCauses , category ) }
192
+ < div className = { `diagonalLine ${ color } TopBottom` } />
193
+ </ div >
194
+ </ div >
195
+ ) ;
196
+ } else {
197
+ return (
198
+ < div key = { `bottom_causes_${ category . name } _${ index } ` } className = "causeContent" >
199
+ < div className = "causeAndLine" >
200
+ { getRootCauses ( category . rootCauses , category ) }
201
+ < div className = { `diagonalLine ${ color } BottomTop` } />
202
+ </ div >
203
+ < div className = { `cause bottom ${ color } _ ${ color } Border` } >
204
+ < OnBlurInputBase style = { { height : '1em' } } margin = 'dense' value = { category . name } onChange = { ( event ) => props . onChange ( category , event , 'name' ) } />
205
+ { props . categoryContextMenu && props . categoryContextMenu . length > 0 &&
206
+ < React . Fragment >
207
+ < IconButton id = { `bottom_cat_${ index } ` } onClick = { handleMenuClick } color = "secondary" size = "small" style = { { color : vscodeStyles . getPropertyValue ( '--vscode-button-secondaryForeground' ) , backgroundColor : vscodeStyles . getPropertyValue ( '--vscode-button-secondaryBackground' ) , } } > < MoreVertIcon fontSize = "small" /> </ IconButton >
208
+ < Menu id = { `bottom_cat_${ index } ` } anchorEl = { menuAnchorEl } keepMounted open = { menuOpen === `bottom_cat_${ index } ` } onClose = { handleMenuClose } >
209
+ { props . categoryContextMenu . filter ( m => m !== undefined ) . map ( ( menuItem , index ) => < MenuItem onClick = { ( ) => { handleMenuClose ( ) ; menuItem ?. cb ( props . data , effectIndex , category ) ; } } > { menuItem . text } </ MenuItem > ) }
210
+ </ Menu >
211
+ </ React . Fragment >
212
+ }
213
+ </ div >
214
+ </ div >
215
+ ) ;
216
+ }
217
+ } ) ;
218
+ return ( < div className = "causesGroup" > { halfCauses } </ div > ) ;
219
+ }
219
220
220
221
const getCauses = ( ) => {
221
222
const color = effectIndexColor ;
@@ -237,7 +238,7 @@ export default function FishboneChart(props) {
237
238
</ div >
238
239
{ props . effectContextMenu && props . effectContextMenu . length > 0 &&
239
240
< React . Fragment >
240
- < IconButton id = { `effect_${ effectIndex } ` } onClick = { handleMenuClick } color = "secondary" size = "small" > < MoreVertIcon fontSize = "small" /> </ IconButton >
241
+ < IconButton id = { `effect_${ effectIndex } ` } onClick = { handleMenuClick } color = "secondary" size = "small" style = { { color : vscodeStyles . getPropertyValue ( '--vscode-button-secondaryForeground' ) , backgroundColor : vscodeStyles . getPropertyValue ( '--vscode-button-secondaryBackground' ) , } } > < MoreVertIcon fontSize = "small" /> </ IconButton >
241
242
< Menu anchorEl = { menuAnchorEl } keepMounted open = { menuOpen === `effect_${ effectIndex } ` } onClose = { handleMenuClose } >
242
243
{ props . effectContextMenu . filter ( e => e !== undefined ) . map ( ( menuItem , index ) => < MenuItem onClick = { ( ) => { handleMenuClose ( ) ; menuItem ?. cb ( props . data , effectIndex ) ; } } > { menuItem . text } </ MenuItem > ) }
243
244
</ Menu >
0 commit comments