1
- import { useEffect , useMemo , useState } from 'react'
1
+ import { useEffect , useState } from 'react'
2
2
import { useParams } from 'react-router'
3
3
import { APIResponseHandler } from '../APIResponseHandler'
4
4
import PluginTagSelect from './PluginTagSelect'
@@ -15,8 +15,6 @@ import {
15
15
PluginListItemType ,
16
16
} from './types'
17
17
import { DEFAULT_PLUGIN_LIST_FILTERS } from './constants'
18
- import { ReactComponent as ICCross } from '../../../Assets/Icon/ic-cross.svg'
19
- import { ReactComponent as ICVisibility } from '../../../Assets/Icon/ic-visibility-on.svg'
20
18
import './pluginListContainer.scss'
21
19
22
20
const PluginListContainer = ( {
@@ -67,7 +65,7 @@ const PluginListContainer = ({
67
65
handleUpdateParentFilters ?.( updatedFilters )
68
66
}
69
67
70
- const { searchKey, selectedTags, showSelectedPlugins } = filters || { }
68
+ const { searchKey, selectedTags } = filters || { }
71
69
72
70
// TODO: Add abortController as well
73
71
const [ isLoadingPluginData , pluginData , pluginDataError , reloadPluginData ] = useAsync (
@@ -159,7 +157,6 @@ const PluginListContainer = ({
159
157
handleUpdateFilters ( {
160
158
searchKey : '' ,
161
159
selectedTags : [ ] ,
162
- showSelectedPlugins : false ,
163
160
} )
164
161
165
162
setClearSearchTrigger ( ( prev ) => ! prev )
@@ -195,34 +192,10 @@ const PluginListContainer = ({
195
192
handlePersistFiltersChange ( )
196
193
}
197
194
198
- const handleShowSelectedPlugins = ( ) => {
199
- handleUpdateFilters ( {
200
- ...filters ,
201
- showSelectedPlugins : true ,
202
- } )
203
- }
204
-
205
- const handleHideSelectedPlugins = ( ) => {
206
- handleUpdateFilters ( {
207
- ...filters ,
208
- showSelectedPlugins : false ,
209
- } )
210
- }
211
-
212
195
const handlePluginSelectionWrapper : PluginListProps [ 'handlePluginSelection' ] = ( parentPluginId ) => {
213
- const isCurrentPluginSelected = isSelectable && selectedPluginsMap [ parentPluginId ]
214
- if ( isCurrentPluginSelected && Object . keys ( selectedPluginsMap ) . length === 1 ) {
215
- handleHideSelectedPlugins ( )
216
- }
217
-
218
196
handlePluginSelection ( parentPluginId )
219
197
}
220
198
221
- const showSelectedPluginFilter = useMemo (
222
- ( ) => isSelectable && selectedPluginsMap && Object . keys ( selectedPluginsMap ) . length > 0 ,
223
- [ selectedPluginsMap , isSelectable ] ,
224
- )
225
-
226
199
return (
227
200
< div className = { `flexbox-col w-100 ${ rootClassName } ` } >
228
201
{ /* Filters section */ }
@@ -245,24 +218,6 @@ const PluginListContainer = ({
245
218
hasError = { ! ! tagsError }
246
219
reloadTags = { reloadTags }
247
220
/>
248
-
249
- { showSelectedPluginFilter && (
250
- < button
251
- className = { `py-6 px-8 dc__gap-12 flex dc__outline-none-imp dc__tab-focus dc__tab-focus dc__no-shrink ${
252
- showSelectedPlugins ? 'bc-n50 dc__border-n1' : 'en-0 bw-1 dc__no-background'
253
- } `}
254
- data-testid = "view-only-selected"
255
- type = "button"
256
- onClick = { showSelectedPlugins ? handleHideSelectedPlugins : handleShowSelectedPlugins }
257
- >
258
- { showSelectedPlugins ? (
259
- < ICCross className = "icon-dim-16 dc__no-shrink" />
260
- ) : (
261
- < ICVisibility className = "icon-dim-16 dc__no-shrink" />
262
- ) }
263
- View only selected
264
- </ button >
265
- ) }
266
221
</ div >
267
222
268
223
{ ! ! selectedTags . length && (
0 commit comments