From e21c9cb4a605eda54aad96d4ccbcb56d45bb7147 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 13 Feb 2026 11:55:28 +0800 Subject: [PATCH] chore: create from template add community --- .../create-app-dialog/app-list/index.spec.tsx | 10 ++++++++++ .../app/create-app-dialog/app-list/index.tsx | 16 +++++++++++++++- web/i18n/en-US/app.json | 1 + web/i18n/zh-Hans/app.json | 1 + web/i18n/zh-Hant/app.json | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/web/app/components/app/create-app-dialog/app-list/index.spec.tsx b/web/app/components/app/create-app-dialog/app-list/index.spec.tsx index e0f459ee75..3f6073a552 100644 --- a/web/app/components/app/create-app-dialog/app-list/index.spec.tsx +++ b/web/app/components/app/create-app-dialog/app-list/index.spec.tsx @@ -1,4 +1,5 @@ import { fireEvent, render, screen } from '@testing-library/react' +import { MARKETPLACE_URL_PREFIX } from '@/config' import { AppModeEnum } from '@/types/app' import Apps from './index' @@ -124,4 +125,13 @@ describe('Apps', () => { expect(screen.getByText('app.newApp.noTemplateFound')).toBeInTheDocument() expect(screen.getByText('app.newApp.noTemplateFoundTip')).toBeInTheDocument() }) + + it('renders explore community link', () => { + render() + + const link = screen.getByRole('link', { name: 'app.newApp.exploreCommunity' }) + expect(link).toHaveAttribute('href', `${MARKETPLACE_URL_PREFIX.replace(/\/$/, '')}/templates`) + expect(link).toHaveAttribute('target', '_blank') + expect(link).toHaveAttribute('rel', 'noopener noreferrer') + }) }) diff --git a/web/app/components/app/create-app-dialog/app-list/index.tsx b/web/app/components/app/create-app-dialog/app-list/index.tsx index 8ab5eb2d73..4b508e1822 100644 --- a/web/app/components/app/create-app-dialog/app-list/index.tsx +++ b/web/app/components/app/create-app-dialog/app-list/index.tsx @@ -10,13 +10,14 @@ import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import AppTypeSelector from '@/app/components/app/type-selector' import { trackEvent } from '@/app/components/base/amplitude' +import { buttonVariants } from '@/app/components/base/button' import Divider from '@/app/components/base/divider' import Input from '@/app/components/base/input' import Loading from '@/app/components/base/loading' import Toast from '@/app/components/base/toast' import CreateAppModal from '@/app/components/explore/create-app-modal' import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks' -import { NEED_REFRESH_APP_LIST_KEY } from '@/config' +import { MARKETPLACE_URL_PREFIX, NEED_REFRESH_APP_LIST_KEY } from '@/config' import { useAppContext } from '@/context/app-context' import { DSLImportMode } from '@/models/app' import { importDSL } from '@/service/apps' @@ -33,6 +34,8 @@ type AppsProps = { onCreateFromBlank?: () => void } +const marketplaceTemplatesUrl = `${MARKETPLACE_URL_PREFIX.replace(/\/$/, '')}/templates` + // export enum PageType { // EXPLORE = 'explore', // CREATE = 'create', @@ -166,6 +169,17 @@ const Apps = ({
{t('newApp.startFromTemplate', { ns: 'app' })} + + {t('newApp.exploreCommunity', { ns: 'app' })} +
diff --git a/web/i18n/en-US/app.json b/web/i18n/en-US/app.json index 6e4a094351..07e58910f3 100644 --- a/web/i18n/en-US/app.json +++ b/web/i18n/en-US/app.json @@ -162,6 +162,7 @@ "newApp.completionUserDescription": "Quickly build an AI assistant for text generation tasks with simple configuration.", "newApp.dropDSLToCreateApp": "Drop DSL file here to create app", "newApp.enableSandboxRuntime": "Enable sandbox runtime (supports Command node)", + "newApp.exploreCommunity": "Explore Community", "newApp.forAdvanced": "FOR ADVANCED USERS", "newApp.forBeginners": "More basic app types", "newApp.foundResult": "{{count}} Result", diff --git a/web/i18n/zh-Hans/app.json b/web/i18n/zh-Hans/app.json index 0b8f99ba9c..deadcc2f9e 100644 --- a/web/i18n/zh-Hans/app.json +++ b/web/i18n/zh-Hans/app.json @@ -160,6 +160,7 @@ "newApp.completionShortDescription": "用于文本生成任务的 AI 助手", "newApp.completionUserDescription": "通过简单的配置快速搭建一个面向文本生成类任务的 AI 助手。", "newApp.dropDSLToCreateApp": "拖放 DSL 文件到此处创建应用", + "newApp.exploreCommunity": "探索社区", "newApp.forAdvanced": "进阶用户适用", "newApp.forBeginners": "新手适用", "newApp.foundResult": "{{count}} 个结果", diff --git a/web/i18n/zh-Hant/app.json b/web/i18n/zh-Hant/app.json index 103accb90e..9e5794529f 100644 --- a/web/i18n/zh-Hant/app.json +++ b/web/i18n/zh-Hant/app.json @@ -159,6 +159,7 @@ "newApp.completionShortDescription": "用於文本生成任務的 AI 助手", "newApp.completionUserDescription": "通過簡單的配置快速構建用於文本生成任務的 AI 助手。", "newApp.dropDSLToCreateApp": "將 DSL 檔案拖放到此處以創建應用程式", + "newApp.exploreCommunity": "探索社群", "newApp.forAdvanced": "對於高級使用者", "newApp.forBeginners": "對於初學者", "newApp.foundResult": "{{count}}結果",