mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-06-04 11:14:10 +08:00
feat: hide 'Find More in Marketplace in Tools' (#16955)
Co-authored-by: Xiaoba Yu <xb1823725853@gmail.com>
This commit is contained in:
parent
b3f4e90862
commit
3d76f09c3a
@ -20,6 +20,7 @@ import ActionButton from '../../base/action-button'
|
|||||||
import { RiAddLine } from '@remixicon/react'
|
import { RiAddLine } from '@remixicon/react'
|
||||||
import { PluginType } from '../../plugins/types'
|
import { PluginType } from '../../plugins/types'
|
||||||
import { useMarketplacePlugins } from '../../plugins/marketplace/hooks'
|
import { useMarketplacePlugins } from '../../plugins/marketplace/hooks'
|
||||||
|
import { useSelector as useAppContextSelector } from '@/context/app-context'
|
||||||
|
|
||||||
type AllToolsProps = {
|
type AllToolsProps = {
|
||||||
className?: string
|
className?: string
|
||||||
@ -82,7 +83,10 @@ const AllTools = ({
|
|||||||
plugins: notInstalledPlugins = [],
|
plugins: notInstalledPlugins = [],
|
||||||
} = useMarketplacePlugins()
|
} = useMarketplacePlugins()
|
||||||
|
|
||||||
|
const { enable_marketplace } = useAppContextSelector(s => s.systemFeatures)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (enable_marketplace) return
|
||||||
if (searchText || tags.length > 0) {
|
if (searchText || tags.length > 0) {
|
||||||
fetchPlugins({
|
fetchPlugins({
|
||||||
query: searchText,
|
query: searchText,
|
||||||
@ -91,7 +95,7 @@ const AllTools = ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [searchText, tags])
|
}, [searchText, tags, enable_marketplace])
|
||||||
|
|
||||||
const pluginRef = useRef(null)
|
const pluginRef = useRef(null)
|
||||||
const wrapElemRef = useRef<HTMLDivElement>(null)
|
const wrapElemRef = useRef<HTMLDivElement>(null)
|
||||||
@ -144,13 +148,13 @@ const AllTools = ({
|
|||||||
selectedTools={selectedTools}
|
selectedTools={selectedTools}
|
||||||
/>
|
/>
|
||||||
{/* Plugins from marketplace */}
|
{/* Plugins from marketplace */}
|
||||||
<PluginList
|
{enable_marketplace && <PluginList
|
||||||
wrapElemRef={wrapElemRef}
|
wrapElemRef={wrapElemRef}
|
||||||
list={notInstalledPlugins as any} ref={pluginRef}
|
list={notInstalledPlugins as any} ref={pluginRef}
|
||||||
searchText={searchText}
|
searchText={searchText}
|
||||||
toolContentClassName={toolContentClassName}
|
toolContentClassName={toolContentClassName}
|
||||||
tags={tags}
|
tags={tags}
|
||||||
/>
|
/>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user