From 64c4f7302d1a77d6aa31a0359edde52916400cd8 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 23 Jan 2026 14:24:23 +0800 Subject: [PATCH] chore: import app ui --- .../app/create-from-dsl-modal/index.tsx | 108 ++++++++++-------- .../app/create-from-dsl-modal/uploader.tsx | 17 ++- web/i18n/en-US/app.json | 9 +- 3 files changed, 77 insertions(+), 57 deletions(-) diff --git a/web/app/components/app/create-from-dsl-modal/index.tsx b/web/app/components/app/create-from-dsl-modal/index.tsx index 838e9cc03f..056bb185ad 100644 --- a/web/app/components/app/create-from-dsl-modal/index.tsx +++ b/web/app/components/app/create-from-dsl-modal/index.tsx @@ -1,7 +1,7 @@ 'use client' import type { MouseEventHandler } from 'react' -import { RiCloseLine, RiCommandLine, RiCornerDownLeftLine } from '@remixicon/react' +import { RiCloseLine, RiExternalLinkLine } from '@remixicon/react' import { useDebounceFn, useKeyPress } from 'ahooks' import { noop } from 'es-toolkit/function' import { useRouter } from 'next/navigation' @@ -17,6 +17,7 @@ import AppsFull from '@/app/components/billing/apps-full-in-dialog' import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks' import { NEED_REFRESH_APP_LIST_KEY } from '@/config' import { useAppContext } from '@/context/app-context' +import { useDocLink } from '@/context/i18n' import { useProviderContext } from '@/context/provider-context' import { DSLImportMode, @@ -47,6 +48,7 @@ export enum CreateFromDSLModalTab { const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDSLModalTab.FROM_FILE, dslUrl = '', droppedFile }: CreateFromDSLModalProps) => { const { push } = useRouter() const { t } = useTranslation() + const docLink = useDocLink() const { notify } = useContext(ToastContext) const [currentFile, setDSLFile] = useState(droppedFile) const [fileContent, setFileContent] = useState() @@ -223,6 +225,10 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS return !dslUrlValue return false }, [isAppsFull, currentTab, currentFile, dslUrlValue]) + const learnMoreLabel = t('importFromDSLModal.learnMore', { + ns: 'app', + defaultValue: t('newApp.learnMore', { ns: 'app' }), + }) return ( <> @@ -231,18 +237,20 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS isShow={show} onClose={noop} > -
- {t('importFromDSL', { ns: 'app' })} +
+
+ {t('importFromDSL', { ns: 'app' })} +
onClose()} > - +
-
- { - tabs.map(tab => ( +
+
+ {tabs.map(tab => (
setCurrentTab(tab.key)} > {tab.label} - { - currentTab === tab.key && ( -
- ) - } + {currentTab === tab.key && ( +
+ )}
- )) - } + ))} +
- { - currentTab === CreateFromDSLModalTab.FROM_FILE && ( - - ) - } - { - currentTab === CreateFromDSLModalTab.FROM_URL && ( -
-
DSL URL
- setDslUrlValue(e.target.value)} - /> + {currentTab === CreateFromDSLModalTab.FROM_FILE && ( + + )} + {currentTab === CreateFromDSLModalTab.FROM_URL && ( +
+
+ {t('importFromDSLUrl', { ns: 'app' })}
- ) - } + setDslUrlValue(e.target.value)} + /> +
+ )}
{isAppsFull && (
)} -
- - + {learnMoreLabel} + + +
+ + +
= ({ />
{!file && ( -
-
- -
+
+
+ +
{t('dslUploader.button', { ns: 'app' })} - {t('dslUploader.browse', { ns: 'app' })} + + {t('dslUploader.browse', { ns: 'app' })} +
{dragging &&
} diff --git a/web/i18n/en-US/app.json b/web/i18n/en-US/app.json index f4eb48e129..b99b5e19cb 100644 --- a/web/i18n/en-US/app.json +++ b/web/i18n/en-US/app.json @@ -37,8 +37,8 @@ "createFromConfigFile": "Create from DSL file", "deleteAppConfirmContent": "Deleting the app is irreversible. Users will no longer be able to access your app, and all prompt configurations and logs will be permanently deleted.", "deleteAppConfirmTitle": "Delete this app?", - "dslUploader.browse": "Browse", - "dslUploader.button": "Drag and drop file, or", + "dslUploader.browse": "browse", + "dslUploader.button": "Drag a DSL(.yml) or .zip file here, ", "duplicate": "Duplicate", "duplicateTitle": "Duplicate App", "editApp": "Edit Info", @@ -119,8 +119,9 @@ "iconPicker.ok": "OK", "importBundleFailed": "Import bundle failed.", "importDSL": "Import DSL file", - "importFromDSL": "Import from DSL", - "importFromDSLFile": "From DSL file", + "importFromDSL": "Import App", + "importFromDSLFile": "Local File", + "importFromDSLModal.learnMore": "Learn about DSL and ZIP formats", "importFromDSLUrl": "From URL", "importFromDSLUrlPlaceholder": "Paste DSL link here", "join": "Join the community",