From 188511a911d1d335f0aec4dba4d4e78cfc6e8dbf Mon Sep 17 00:00:00 2001 From: WangCham <651122857@qq.com> Date: Thu, 7 May 2026 13:34:26 +0800 Subject: [PATCH] feat: delete old filter --- .../plugin-market/PluginMarketComponent.tsx | 135 ++---------------- 1 file changed, 8 insertions(+), 127 deletions(-) diff --git a/web/src/app/home/plugins/components/plugin-market/PluginMarketComponent.tsx b/web/src/app/home/plugins/components/plugin-market/PluginMarketComponent.tsx index 6d4f028a..974f4d7d 100644 --- a/web/src/app/home/plugins/components/plugin-market/PluginMarketComponent.tsx +++ b/web/src/app/home/plugins/components/plugin-market/PluginMarketComponent.tsx @@ -22,12 +22,9 @@ import { Search, Wrench, AudioWaveform, - Hash, Book, SlidersHorizontal, X, - FileText, - PanelTop, } from 'lucide-react'; import PluginMarketCardComponent from './plugin-market-card/PluginMarketCardComponent'; import { PluginMarketCardVO } from './plugin-market-card/PluginMarketCardVO'; @@ -59,15 +56,6 @@ function MarketPageContent({ const { t } = useTranslation(); const [searchParams] = useSearchParams(); - const validCategories = [ - 'Tool', - 'Command', - 'EventListener', - 'KnowledgeEngine', - 'Parser', - 'Page', - ]; - const validTypes = ['plugin', 'mcp', 'skill']; const extensionTypeOptions = [ @@ -78,13 +66,6 @@ function MarketPageContent({ ]; const [searchQuery, setSearchQuery] = useState(''); - const [componentFilter, setComponentFilter] = useState(() => { - const category = searchParams.get('category'); - if (category && validCategories.includes(category)) { - return category; - } - return 'all'; - }); const [typeFilter, setTypeFilter] = useState(() => { const type = searchParams.get('type'); if (type && validTypes.includes(type)) { @@ -92,7 +73,7 @@ function MarketPageContent({ } return 'all'; }); - const activeAdvancedFilters = typeFilter === 'all' ? 0 : 1; + const activeAdvancedFilters = 0; const [selectedTags, setSelectedTags] = useState([]); const [availableTags, setAvailableTags] = useState([]); const [tagNames, setTagNames] = useState>({}); @@ -215,8 +196,6 @@ function MarketPageContent({ try { const { sortBy, sortOrder } = getCurrentSort(); - const filterValue = - componentFilter === 'all' ? undefined : componentFilter; const query = isSearch && searchQuery.trim() ? searchQuery.trim() : ''; let newPlugins: PluginMarketCardVO[] = []; @@ -237,7 +216,7 @@ function MarketPageContent({ pageSize, sortBy, sortOrder, - filterValue, + undefined, selectedTags.length > 0 ? selectedTags : undefined, 'plugin', ); @@ -259,7 +238,7 @@ function MarketPageContent({ pageSize, sortBy, sortOrder, - filterValue, + undefined, selectedTags.length > 0 ? selectedTags : undefined, 'mcp', ); @@ -276,7 +255,7 @@ function MarketPageContent({ pageSize, sortBy, sortOrder, - filterValue, + undefined, selectedTags.length > 0 ? selectedTags : undefined, 'skill', ); @@ -295,7 +274,7 @@ function MarketPageContent({ pageSize, sortBy, sortOrder, - filterValue, + undefined, selectedTags.length > 0 ? selectedTags : undefined, typeFilter === 'all' ? undefined : typeFilter, ); @@ -331,7 +310,6 @@ function MarketPageContent({ }, [ searchQuery, - componentFilter, selectedTags, pageSize, transformToVO, @@ -426,27 +404,6 @@ function MarketPageContent({ setSortOption(value); setCurrentPage(1); setPlugins([]); - // fetchPlugins will be called by useEffect when sortOption changes - }, []); - - // 组件筛选变化处理 - const handleComponentFilterChange = useCallback((value: string) => { - setComponentFilter(value); - setCurrentPage(1); - setPlugins([]); - - // Update URL query param to keep it in sync - const params = new URLSearchParams(window.location.search); - if (value === 'all') { - params.delete('category'); - } else { - params.set('category', value); - } - const newUrl = params.toString() - ? `${window.location.pathname}?${params.toString()}` - : window.location.pathname; - window.history.replaceState({}, '', newUrl); - // fetchPlugins will be called by useEffect when componentFilter changes }, []); // Handle type filter change @@ -468,10 +425,10 @@ function MarketPageContent({ window.history.replaceState({}, '', newUrl); }, []); - // 当排序选项或组件筛选变化时重新加载数据 + // 当排序选项或类型筛选变化时重新加载数据 useEffect(() => { fetchPlugins(1, !!searchQuery.trim(), true); - }, [sortOption, componentFilter, typeFilter]); + }, [sortOption, typeFilter]); // Tags 筛选变化时重新搜索 useEffect(() => { @@ -644,83 +601,8 @@ function MarketPageContent({ - {/* Component filter and sort */} + {/* Sort and more filters */}
- {/* Component filter */} -
- - {t('market.filterByComponent')}: - -
- { - if (value) handleComponentFilterChange(value); - }} - className="justify-start flex-nowrap" - > - - {t('market.allComponents')} - - - - {t('plugins.componentName.Tool')} - - - - {t('plugins.componentName.Command')} - - - - {t('plugins.componentName.EventListener')} - - - - {t('plugins.componentName.KnowledgeEngine')} - - - - {t('plugins.componentName.Parser')} - - - - {t('plugins.componentName.Page')} - - -
-
- {/* Sort dropdown */}
@@ -845,7 +727,6 @@ function MarketPageContent({ > {/* Recommendation Lists */} {!searchQuery && - componentFilter === 'all' && selectedTags.length === 0 && (