Skip to content

Commit 59b7402

Browse files
committed
feat: remove show selected plugin filter
1 parent d933978 commit 59b7402

File tree

4 files changed

+3
-71
lines changed

4 files changed

+3
-71
lines changed

src/Shared/Components/Plugin/PluginList.tsx

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const PluginList = ({
1212
pluginList,
1313
totalCount,
1414
handleDataUpdateForPluginResponse,
15-
filters: { selectedTags, searchKey, showSelectedPlugins },
15+
filters: { selectedTags, searchKey },
1616
handlePluginSelection,
1717
selectedPluginsMap,
1818
isSelectable,
@@ -51,27 +51,6 @@ const PluginList = ({
5151
)
5252
}
5353

54-
// selectedPluginsMap should always be present if isSelectable is true
55-
if (showSelectedPlugins) {
56-
// TODO: Ask with product, filters and search can cause conflicting state
57-
58-
return (
59-
<>
60-
{Object.keys(selectedPluginsMap).map((parentPluginId) => (
61-
<PluginCard
62-
key={parentPluginId}
63-
parentPluginId={+parentPluginId}
64-
isSelectable={isSelectable}
65-
pluginDataStore={pluginDataStore}
66-
handlePluginSelection={handlePluginSelection}
67-
showCardBorder={showCardBorder}
68-
isSelected
69-
/>
70-
))}
71-
</>
72-
)
73-
}
74-
7554
return (
7655
<>
7756
{pluginList.map((plugin) => (

src/Shared/Components/Plugin/PluginListContainer.tsx

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useMemo, useState } from 'react'
1+
import { useEffect, useState } from 'react'
22
import { useParams } from 'react-router'
33
import { APIResponseHandler } from '../APIResponseHandler'
44
import PluginTagSelect from './PluginTagSelect'
@@ -15,8 +15,6 @@ import {
1515
PluginListItemType,
1616
} from './types'
1717
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'
2018
import './pluginListContainer.scss'
2119

2220
const PluginListContainer = ({
@@ -67,7 +65,7 @@ const PluginListContainer = ({
6765
handleUpdateParentFilters?.(updatedFilters)
6866
}
6967

70-
const { searchKey, selectedTags, showSelectedPlugins } = filters || {}
68+
const { searchKey, selectedTags } = filters || {}
7169

7270
// TODO: Add abortController as well
7371
const [isLoadingPluginData, pluginData, pluginDataError, reloadPluginData] = useAsync(
@@ -159,7 +157,6 @@ const PluginListContainer = ({
159157
handleUpdateFilters({
160158
searchKey: '',
161159
selectedTags: [],
162-
showSelectedPlugins: false,
163160
})
164161

165162
setClearSearchTrigger((prev) => !prev)
@@ -195,34 +192,10 @@ const PluginListContainer = ({
195192
handlePersistFiltersChange()
196193
}
197194

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-
212195
const handlePluginSelectionWrapper: PluginListProps['handlePluginSelection'] = (parentPluginId) => {
213-
const isCurrentPluginSelected = isSelectable && selectedPluginsMap[parentPluginId]
214-
if (isCurrentPluginSelected && Object.keys(selectedPluginsMap).length === 1) {
215-
handleHideSelectedPlugins()
216-
}
217-
218196
handlePluginSelection(parentPluginId)
219197
}
220198

221-
const showSelectedPluginFilter = useMemo(
222-
() => isSelectable && selectedPluginsMap && Object.keys(selectedPluginsMap).length > 0,
223-
[selectedPluginsMap, isSelectable],
224-
)
225-
226199
return (
227200
<div className={`flexbox-col w-100 ${rootClassName}`}>
228201
{/* Filters section */}
@@ -245,24 +218,6 @@ const PluginListContainer = ({
245218
hasError={!!tagsError}
246219
reloadTags={reloadTags}
247220
/>
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-
)}
266221
</div>
267222

268223
{!!selectedTags.length && (

src/Shared/Components/Plugin/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ export const DEFAULT_PLUGIN_DATA_STORE: PluginDataStoreType = {
88
export const DEFAULT_PLUGIN_LIST_FILTERS: PluginListFiltersType = {
99
searchKey: '',
1010
selectedTags: [],
11-
showSelectedPlugins: false,
1211
}

src/Shared/Components/Plugin/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ export interface PluginDetailPayloadType {
5858

5959
export interface PluginListFiltersType extends Pick<BaseFilterQueryParams<unknown>, 'searchKey'> {
6060
selectedTags: string[]
61-
showSelectedPlugins: boolean
6261
}
6362

6463
interface ParentPluginType extends Pick<ParentPluginDTO, 'id' | 'name' | 'description' | 'type' | 'icon'> {

0 commit comments

Comments
 (0)