diff --git a/web/app/components/plugins/plugin-page/index.tsx b/web/app/components/plugins/plugin-page/index.tsx index bed200e9f0..962388babc 100644 --- a/web/app/components/plugins/plugin-page/index.tsx +++ b/web/app/components/plugins/plugin-page/index.tsx @@ -22,6 +22,7 @@ import TabSlider from '@/app/components/base/tab-slider' import Tooltip from '@/app/components/base/tooltip' import cn from '@/utils/classnames' import PermissionSetModal from '@/app/components/plugins/permission-setting-modal/modal' +import { useSelector as useAppContextSelector } from '@/context/app-context' export type PluginPageProps = { plugins: React.ReactNode @@ -45,12 +46,17 @@ const PluginPage = ({ }] = useBoolean() const [currentFile, setCurrentFile] = useState(null) const containerRef = usePluginPageContext(v => v.containerRef) + const { enable_marketplace } = useAppContextSelector(s => s.systemFeatures) const options = useMemo(() => { return [ { value: 'plugins', text: t('common.menus.plugins') }, - { value: 'discover', text: 'Explore Marketplace' }, + ...( + !enable_marketplace + ? [{ value: 'discover', text: 'Explore Marketplace' }] + : [] + ), ] - }, [t]) + }, [t, enable_marketplace]) const [activeTab, setActiveTab] = useTabSearchParams({ defaultTab: options[0].value, }) @@ -137,7 +143,7 @@ const PluginPage = ({ )} { - activeTab === 'discover' && marketplace + activeTab === 'discover' && !enable_marketplace && marketplace } {showPluginSettingModal && ( diff --git a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx index 962349c74a..e3c3a77755 100644 --- a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx +++ b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx @@ -15,12 +15,14 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' +import { useSelector as useAppContextSelector } from '@/context/app-context' const InstallPluginDropdown = () => { const fileInputRef = useRef(null) const [isMenuOpen, setIsMenuOpen] = useState(false) const [selectedAction, setSelectedAction] = useState(null) const [selectedFile, setSelectedFile] = useState(null) + const { enable_marketplace } = useAppContextSelector(s => s.systemFeatures) const handleFileChange = (event: React.ChangeEvent) => { const file = event.target.files?.[0] @@ -62,7 +64,11 @@ const InstallPluginDropdown = () => { />
{[ - { icon: MagicBox, text: 'Marketplace', action: 'marketplace' }, + ...( + enable_marketplace + ? [{ icon: MagicBox, text: 'Marketplace', action: 'marketplace' }] + : [] + ), { icon: Github, text: 'GitHub', action: 'github' }, { icon: FileZip, text: 'Local Package File', action: 'local' }, ].map(({ icon: Icon, text, action }) => ( diff --git a/web/app/components/tools/provider-list.tsx b/web/app/components/tools/provider-list.tsx index fa9074f3d1..e0ee954e62 100644 --- a/web/app/components/tools/provider-list.tsx +++ b/web/app/components/tools/provider-list.tsx @@ -19,11 +19,13 @@ import { fetchCollectionList } from '@/service/tools' import Card from '@/app/components/plugins/card' import { useGetLanguage } from '@/context/i18n' import CardMoreInfo from '@/app/components/plugins/card/card-more-info' +import { useSelector as useAppContextSelector } from '@/context/app-context' const ProviderList = () => { const { t } = useTranslation() const language = useGetLanguage() const containerRef = useRef(null) + const { enable_marketplace } = useAppContextSelector(s => s.systemFeatures) const [activeTab, setActiveTab] = useTabSearchParams({ defaultTab: 'builtin', @@ -109,6 +111,7 @@ const ProviderList = () => { 'border-[1.5px] border-transparent', currentProvider?.id === collection.id && 'border-components-option-card-option-selected-border', )} + hideCornerMark locale={language} payload={{ ...collection, @@ -116,7 +119,6 @@ const ProviderList = () => { } as any} footer={ } @@ -125,9 +127,13 @@ const ProviderList = () => { ))} {!filteredCollectionList.length &&
}
- { - containerRef.current?.scrollTo({ top: containerRef.current.scrollHeight, behavior: 'smooth' }) - }} /> + { + !enable_marketplace && ( + { + containerRef.current?.scrollTo({ top: containerRef.current.scrollHeight, behavior: 'smooth' }) + }} /> + ) + }