mirror of
https://github.com/langgenius/dify.git
synced 2026-02-24 09:55:09 +00:00
chore: create from template add community
This commit is contained in:
@@ -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(<Apps />)
|
||||
|
||||
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')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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 = ({
|
||||
<div className="flex items-center justify-between border-b border-divider-burn py-3">
|
||||
<div className="min-w-[180px] pl-5">
|
||||
<span className="text-text-primary title-xl-semi-bold">{t('newApp.startFromTemplate', { ns: 'app' })}</span>
|
||||
<a
|
||||
href={marketplaceTemplatesUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={cn(
|
||||
buttonVariants({ variant: 'primary', size: 'small' }),
|
||||
'ml-2 align-middle',
|
||||
)}
|
||||
>
|
||||
{t('newApp.exploreCommunity', { ns: 'app' })}
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex max-w-[548px] flex-1 items-center rounded-xl border border-components-panel-border bg-components-panel-bg-blur p-1.5 shadow-md">
|
||||
<AppTypeSelector value={currentType} onChange={setCurrentType} />
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
"newApp.completionShortDescription": "用于文本生成任务的 AI 助手",
|
||||
"newApp.completionUserDescription": "通过简单的配置快速搭建一个面向文本生成类任务的 AI 助手。",
|
||||
"newApp.dropDSLToCreateApp": "拖放 DSL 文件到此处创建应用",
|
||||
"newApp.exploreCommunity": "探索社区",
|
||||
"newApp.forAdvanced": "进阶用户适用",
|
||||
"newApp.forBeginners": "新手适用",
|
||||
"newApp.foundResult": "{{count}} 个结果",
|
||||
|
||||
@@ -159,6 +159,7 @@
|
||||
"newApp.completionShortDescription": "用於文本生成任務的 AI 助手",
|
||||
"newApp.completionUserDescription": "通過簡單的配置快速構建用於文本生成任務的 AI 助手。",
|
||||
"newApp.dropDSLToCreateApp": "將 DSL 檔案拖放到此處以創建應用程式",
|
||||
"newApp.exploreCommunity": "探索社群",
|
||||
"newApp.forAdvanced": "對於高級使用者",
|
||||
"newApp.forBeginners": "對於初學者",
|
||||
"newApp.foundResult": "{{count}}結果",
|
||||
|
||||
Reference in New Issue
Block a user