From f96fbbe03a082b0838f71d41caab8ff05c2cb44a Mon Sep 17 00:00:00 2001 From: yessenia Date: Fri, 6 Feb 2026 01:53:37 +0800 Subject: [PATCH] feat: replace SearchBox with Input component in SearchBoxWrapper for improved search functionality --- .../marketplace/description/index.spec.tsx | 2 +- .../search-box/search-box-wrapper.tsx | 31 ++++++++++--------- .../components/plugins/plugin-page/index.tsx | 2 +- .../plugins/plugin-page/nav-operations.tsx | 11 ++++--- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/web/app/components/plugins/marketplace/description/index.spec.tsx b/web/app/components/plugins/marketplace/description/index.spec.tsx index 054949ee1f..26b2f3b4fb 100644 --- a/web/app/components/plugins/marketplace/description/index.spec.tsx +++ b/web/app/components/plugins/marketplace/description/index.spec.tsx @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' -import Description from './index' +import { Description } from './index' // ================================ // Mock external dependencies diff --git a/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx b/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx index 3cd5cff0be..ff5a192ff1 100644 --- a/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx +++ b/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx @@ -5,6 +5,7 @@ import { useTranslation } from '#i18n' import { useDebounce } from 'ahooks' import { useSetAtom } from 'jotai' import { useMemo, useState } from 'react' +import Input from '@/app/components/base/input' import { PortalToFollowElem, PortalToFollowElemContent, @@ -21,7 +22,6 @@ import { import { PLUGIN_TYPE_SEARCH_MAP } from '../constants' import { useMarketplacePlugins } from '../query' import { getMarketplaceListFilterType } from '../utils' -import SearchBox from './index' import SearchDropdown from './search-dropdown' type SearchBoxWrapperProps = { @@ -34,7 +34,7 @@ const SearchBoxWrapper = ({ }: SearchBoxWrapperProps) => { const { t } = useTranslation() const [searchPluginText, handleSearchPluginTextChange] = useSearchPluginText() - const [filterPluginTags, handleFilterPluginTagsChange] = useFilterPluginTags() + const [filterPluginTags] = useFilterPluginTags() const [activePluginType] = useActivePluginType() const sort = useMarketplaceSortValue() const setSearchMode = useSetAtom(searchModeAtom) @@ -84,24 +84,27 @@ const SearchBoxWrapper = ({ >
- { + { + setDraftSearch(e.target.value) + }} + onFocus={() => { setDraftSearch(committedSearch) setIsFocused(true) }} - onSearchBlur={() => { + onBlur={() => { if (!isHoveringDropdown) setIsFocused(false) }} - tags={filterPluginTags} - onTagsChange={handleFilterPluginTagsChange} - placeholder={t('searchPlugins', { ns: 'plugin' })} - usedInMarketplace + onKeyDown={(e) => { + if (e.key === 'Enter') + handleSubmit() + }} />
diff --git a/web/app/components/plugins/plugin-page/index.tsx b/web/app/components/plugins/plugin-page/index.tsx index b0cc76c295..85b095fad9 100644 --- a/web/app/components/plugins/plugin-page/index.tsx +++ b/web/app/components/plugins/plugin-page/index.tsx @@ -147,7 +147,7 @@ const PluginPage = ({ onChange={setActiveTab} options={options} /> - {!isPluginsTab && } + {!isPluginsTab && }
{isExploringMarketplace && } diff --git a/web/app/components/plugins/plugin-page/nav-operations.tsx b/web/app/components/plugins/plugin-page/nav-operations.tsx index a638f8deb8..ca943e77f7 100644 --- a/web/app/components/plugins/plugin-page/nav-operations.tsx +++ b/web/app/components/plugins/plugin-page/nav-operations.tsx @@ -1,5 +1,5 @@ 'use client' -import { RiBookOpenLine, RiGithubLine, RiLayoutGridLine, RiPuzzle2Line } from '@remixicon/react' +import { RiAddLine, RiBookOpenLine, RiGithubLine, RiLayoutGridLine, RiPuzzle2Line } from '@remixicon/react' import Link from 'next/link' import { useSearchParams } from 'next/navigation' import { useState } from 'react' @@ -53,7 +53,8 @@ export const SubmitRequestDropdown = () => { open && 'bg-state-base-hover text-text-secondary', )} > - + + {t('requestSubmitPlugin', { ns: 'plugin' })} @@ -98,7 +99,7 @@ export const CreationTypeTabs = ({ creationType: creationTypeProp }: CreationTyp )} > - + {t('plugins', { ns: 'plugin' })} @@ -111,10 +112,10 @@ export const CreationTypeTabs = ({ creationType: creationTypeProp }: CreationTyp )} > - + {t('templates', { ns: 'plugin' })} - + NEW