From aee9a8366ffee854864924ebaee90d8ac0863eb8 Mon Sep 17 00:00:00 2001 From: lyzno1 Date: Fri, 24 Oct 2025 10:07:02 +0800 Subject: [PATCH] refactor: move marketplace footer outside scroll containers --- .../block-selector/all-start-blocks.tsx | 13 +- .../workflow/block-selector/all-tools.tsx | 170 ++++++++++-------- .../market-place-plugin/list.tsx | 5 + 3 files changed, 104 insertions(+), 84 deletions(-) diff --git a/web/app/components/workflow/block-selector/all-start-blocks.tsx b/web/app/components/workflow/block-selector/all-start-blocks.tsx index 47ebf0ca27..c700dd8b75 100644 --- a/web/app/components/workflow/block-selector/all-start-blocks.tsx +++ b/web/app/components/workflow/block-selector/all-start-blocks.tsx @@ -2,7 +2,6 @@ import { useCallback, useEffect, - useRef, useState, } from 'react' import { useTranslation } from 'react-i18next' @@ -19,6 +18,8 @@ import Button from '@/app/components/base/button' import { SearchMenu } from '@/app/components/base/icons/src/vender/line/general' import { BlockEnum as BlockEnumValue } from '../types' +const marketplaceFooterClassName = 'system-sm-medium z-10 flex h-8 flex-none cursor-pointer items-center rounded-b-lg border-[0.5px] border-t border-components-panel-border bg-components-panel-bg-blur px-4 py-1 text-text-accent-light-mode-only shadow-lg' + type AllStartBlocksProps = { className?: string searchText: string @@ -35,7 +36,6 @@ const AllStartBlocks = ({ tags = [], }: AllStartBlocksProps) => { const { t } = useTranslation() - const wrapElemRef = useRef(null) const [hasStartBlocksContent, setHasStartBlocksContent] = useState(false) const [hasPluginContent, setHasPluginContent] = useState(false) @@ -62,11 +62,8 @@ const AllStartBlocks = ({ return (
-
-
+
+
diff --git a/web/app/components/workflow/block-selector/all-tools.tsx b/web/app/components/workflow/block-selector/all-tools.tsx index 97e18c43c3..8fe9a67f86 100644 --- a/web/app/components/workflow/block-selector/all-tools.tsx +++ b/web/app/components/workflow/block-selector/all-tools.tsx @@ -32,6 +32,10 @@ import RAGToolSuggestions from './rag-tool-suggestions' import FeaturedTools from './featured-tools' import Link from 'next/link' import Divider from '@/app/components/base/divider' +import { RiArrowRightUpLine } from '@remixicon/react' +import { getMarketplaceUrl } from '@/utils/var' + +const marketplaceFooterClassName = 'system-sm-medium z-10 flex h-8 flex-none cursor-pointer items-center rounded-b-lg border-[0.5px] border-t border-components-panel-border bg-components-panel-bg-blur px-4 py-1 text-text-accent-light-mode-only shadow-lg' type AllToolsProps = { className?: string @@ -173,6 +177,7 @@ const AllTools = ({ && activeTab === ToolTypeEnum.All && !hasFilter && (featuredLoading || featuredPlugins.length > 0) + const shouldShowMarketplaceFooter = enable_marketplace && !hasFilter return (
@@ -198,90 +203,103 @@ const AllTools = ({ )}
-
-
- {isShowRAGRecommendations && onTagsChange && ( - - )} - {shouldShowFeatured && ( - <> - +
+
+ {isShowRAGRecommendations && onTagsChange && ( + { - await onFeaturedInstallSuccess?.() - }} + onTagsChange={onTagsChange} /> -
- -
- - )} - {(hasToolsListContent || enable_marketplace) && ( - <> -
- {t('tools.allTools')} -
- {hasToolsListContent && ( - + { + await onFeaturedInstallSuccess?.() + }} /> - )} - {enable_marketplace && ( - } - list={notInstalledPlugins} - searchText={searchText} - toolContentClassName={toolContentClassName} - tags={tags} - /> - )} - +
+ +
+ + )} + {(hasToolsListContent || enable_marketplace) && ( + <> +
+ {t('tools.allTools')} +
+ {hasToolsListContent && ( + + )} + {enable_marketplace && ( + } + list={notInstalledPlugins} + searchText={searchText} + toolContentClassName={toolContentClassName} + tags={tags} + hideFindMoreFooter + /> + )} + + )} +
+ + {shouldShowEmptyState && ( +
+ +
+ {t('workflow.tabs.noPluginsFound')} +
+ + + +
)}
- - {shouldShowEmptyState && ( -
- -
- {t('workflow.tabs.noPluginsFound')} -
- - - -
+ {shouldShowMarketplaceFooter && ( + + {t('plugin.findMoreInMarketplace')} + + )}
diff --git a/web/app/components/workflow/block-selector/market-place-plugin/list.tsx b/web/app/components/workflow/block-selector/market-place-plugin/list.tsx index 97084e0b5b..879f5c049d 100644 --- a/web/app/components/workflow/block-selector/market-place-plugin/list.tsx +++ b/web/app/components/workflow/block-selector/market-place-plugin/list.tsx @@ -18,6 +18,7 @@ export type ListProps = { tags: string[] toolContentClassName?: string disableMaxWidth?: boolean + hideFindMoreFooter?: boolean ref?: React.Ref } @@ -30,6 +31,7 @@ const List = ({ list, toolContentClassName, disableMaxWidth = false, + hideFindMoreFooter = false, ref, }: ListProps) => { const { t } = useTranslation() @@ -70,6 +72,9 @@ const List = ({ } if (noFilter) { + if (hideFindMoreFooter) + return null + return (