mirror of
https://github.com/langgenius/dify.git
synced 2026-02-25 02:35:12 +00:00
chore: blank add to template link
This commit is contained in:
@@ -5,7 +5,7 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { trackEvent } from '@/app/components/base/amplitude'
|
||||
|
||||
import { ToastContext } from '@/app/components/base/toast'
|
||||
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 { useProviderContext } from '@/context/provider-context'
|
||||
import { createApp } from '@/service/apps'
|
||||
@@ -159,4 +159,16 @@ describe('CreateAppModal', () => {
|
||||
expect(mockNotify).toHaveBeenCalledWith({ type: 'error', message: 'boom' })
|
||||
expect(onClose).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('renders community explore link with marketplace templates URL', async () => {
|
||||
renderModal()
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole('link', { name: 'app.newApp.orExploreCommunity' })).toBeInTheDocument()
|
||||
})
|
||||
const link = screen.getByRole('link', { name: 'app.newApp.orExploreCommunity' })
|
||||
expect(link).toHaveAttribute('href', `${MARKETPLACE_URL_PREFIX.replace(/\/$/, '')}/templates`)
|
||||
expect(link).toHaveAttribute('target', '_blank')
|
||||
expect(link).toHaveAttribute('rel', 'noopener noreferrer')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ import CustomSelect from '@/app/components/base/select/custom'
|
||||
import Textarea from '@/app/components/base/textarea'
|
||||
import { ToastContext } from '@/app/components/base/toast'
|
||||
import AppsFull from '@/app/components/billing/apps-full-in-dialog'
|
||||
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
||||
import { MARKETPLACE_URL_PREFIX, NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
||||
import { STORAGE_KEYS } from '@/config/storage-keys'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useProviderContext } from '@/context/provider-context'
|
||||
@@ -49,6 +49,8 @@ type RuntimeOption = {
|
||||
recommended?: boolean
|
||||
}
|
||||
|
||||
const marketplaceTemplatesUrl = `${MARKETPLACE_URL_PREFIX.replace(/\/$/, '')}/templates`
|
||||
|
||||
function CreateApp({ onClose, onSuccess, onCreateFromTemplate, defaultAppMode }: CreateAppProps) {
|
||||
const { t } = useTranslation()
|
||||
const { push } = useRouter()
|
||||
@@ -332,11 +334,21 @@ function CreateApp({ onClose, onSuccess, onCreateFromTemplate, defaultAppMode }:
|
||||
</div>
|
||||
{isAppsFull && <AppsFull className="mt-4" loc="app-create" />}
|
||||
<div className="flex items-center justify-between pb-10 pt-5">
|
||||
<div className="flex cursor-pointer items-center gap-1 text-text-tertiary system-xs-regular" onClick={onCreateFromTemplate}>
|
||||
<span>{t('newApp.noIdeaTip', { ns: 'app' })}</span>
|
||||
<div className="p-[1px]">
|
||||
<RiArrowRightLine className="h-3.5 w-3.5" />
|
||||
<div className="flex items-center gap-2 system-xs-regular">
|
||||
<div className="flex cursor-pointer items-center gap-1 text-text-tertiary" onClick={onCreateFromTemplate}>
|
||||
<span>{t('newApp.noIdeaTip', { ns: 'app' })}</span>
|
||||
<div className="p-[1px]">
|
||||
<RiArrowRightLine className="h-3.5 w-3.5" />
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
href={marketplaceTemplatesUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-text-tertiary hover:text-text-secondary hover:underline"
|
||||
>
|
||||
{t('newApp.orExploreCommunity', { ns: 'app' })}
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button onClick={onClose}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
||||
|
||||
@@ -176,6 +176,7 @@
|
||||
"newApp.noTemplateFound": "No templates found",
|
||||
"newApp.noTemplateFoundTip": "Try searching using different keywords.",
|
||||
"newApp.optional": "Optional",
|
||||
"newApp.orExploreCommunity": "or explore the community",
|
||||
"newApp.previewDemo": "Preview demo",
|
||||
"newApp.recommended": "RECOMMENDED",
|
||||
"newApp.runtimeLabel": "Runtime",
|
||||
|
||||
@@ -174,6 +174,7 @@
|
||||
"newApp.noTemplateFound": "未找到模板",
|
||||
"newApp.noTemplateFoundTip": "请尝试使用不同的关键字进行搜索。",
|
||||
"newApp.optional": "可选",
|
||||
"newApp.orExploreCommunity": "或探索社区",
|
||||
"newApp.previewDemo": "预览 Demo",
|
||||
"newApp.recommended": "推荐",
|
||||
"newApp.runtimeLabel": "运行时",
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
"newApp.noTemplateFound": "未找到範本",
|
||||
"newApp.noTemplateFoundTip": "嘗試使用不同的關鍵字進行搜索。",
|
||||
"newApp.optional": "自選",
|
||||
"newApp.orExploreCommunity": "或探索社群",
|
||||
"newApp.previewDemo": "預覽 Demo",
|
||||
"newApp.showTemplates": "我想從範例模板中選擇",
|
||||
"newApp.startFromBlank": "建立空白應用",
|
||||
|
||||
Reference in New Issue
Block a user