@@ -31,19 +31,16 @@ export namespace ConfigurationsList {
3131export const ConfigurationsList : React . FC < ConfigurationsList . Props > = (
3232 props
3333) => {
34- const sortable = props . on_reorder !== undefined
3534 const has_default = props . configurations . some ( ( c ) => c . is_default )
3635
3736 const render_item = (
3837 config : ConfigurationsList . Configuration ,
3938 index : number
4039 ) => (
4140 < div key = { config . id } className = { styles . row } >
42- { sortable && (
43- < div className = { cn ( styles [ 'drag-handle' ] , styles [ 'col-drag' ] ) } >
44- < span className = "codicon codicon-gripper" />
45- </ div >
46- ) }
41+ < div className = { cn ( styles [ 'drag-handle' ] , styles [ 'col-drag' ] ) } >
42+ < span className = "codicon codicon-gripper" />
43+ </ div >
4744 { props . on_set_default && (
4845 < Radio
4946 name = { props . radio_group_name ?? 'default_configuration' }
@@ -62,13 +59,11 @@ export const ConfigurationsList: React.FC<ConfigurationsList.Props> = (
6259 < span > { config . description } </ span >
6360 </ div >
6461 < div className = { styles [ 'col-actions' ] } >
65- { sortable && (
66- < IconButton
67- codicon_icon = "insert"
68- title = "Insert new configuration below/above"
69- on_click = { ( ) => props . on_add ( { insertion_index : index } ) }
70- />
71- ) }
62+ < IconButton
63+ codicon_icon = "insert"
64+ title = "Insert new configuration below/above"
65+ on_click = { ( ) => props . on_add ( { insertion_index : index } ) }
66+ />
7267 < IconButton
7368 codicon_icon = "edit"
7469 title = "Edit configuration"
@@ -114,33 +109,30 @@ export const ConfigurationsList: React.FC<ConfigurationsList.Props> = (
114109 return (
115110 < div className = { styles . container } >
116111 { render_header ( true ) }
117- < div className = { styles . list } >
118- { props . configurations . length > 0 &&
119- ( sortable ? (
120- < ReactSortable
121- list = { props . configurations }
122- setList = { ( new_list ) => {
123- const has_order_changed =
124- new_list . length != props . configurations . length ||
125- new_list . some (
126- ( item , index ) => item . id != props . configurations [ index ] . id
127- )
112+ { props . configurations . length > 0 && (
113+ < div className = { styles . list } >
114+ < ReactSortable
115+ list = { props . configurations }
116+ setList = { ( new_list ) => {
117+ const has_order_changed =
118+ new_list . length != props . configurations . length ||
119+ new_list . some (
120+ ( item , index ) => item . id != props . configurations [ index ] . id
121+ )
128122
129- if ( has_order_changed ) {
130- props . on_reorder ( new_list )
131- }
132- } }
133- tag = "div"
134- animation = { 150 }
135- >
136- { props . configurations . map ( ( item , index ) =>
137- render_item ( item , index )
138- ) }
139- </ ReactSortable >
140- ) : (
141- props . configurations . map ( ( item , index ) => render_item ( item , index ) )
142- ) ) }
143- </ div >
123+ if ( has_order_changed ) {
124+ props . on_reorder ( new_list )
125+ }
126+ } }
127+ tag = "div"
128+ animation = { 150 }
129+ >
130+ { props . configurations . map ( ( item , index ) =>
131+ render_item ( item , index )
132+ ) }
133+ </ ReactSortable >
134+ </ div >
135+ ) }
144136 { props . configurations . length > 0 && render_header ( false ) }
145137 </ div >
146138 )
0 commit comments