From f0abf1b9cba5d619ee6d6e66d605d4f316926fa6 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sat, 18 Feb 2023 16:42:26 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E5=BC=80=E6=94=BE=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E8=A1=A5=E5=85=A8=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/MainPanel/AppInfo/OAuth.tsx | 7 +- .../src/MainPanel/AppInfo/Profile.tsx | 5 +- .../src/MainPanel/AppInfo/index.tsx | 23 +++--- .../src/MainPanel/index.tsx | 9 +-- .../src/modals/CreateOpenApp.tsx | 13 ++-- .../com.msgbyte.openapi/src/translate.ts | 72 +++++++++++++++++++ website/docs/deployment/docker-compose.mdx | 2 +- 7 files changed, 104 insertions(+), 27 deletions(-) diff --git a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/OAuth.tsx b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/OAuth.tsx index f0c2c1fe..f1ffd19d 100644 --- a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/OAuth.tsx +++ b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/OAuth.tsx @@ -6,6 +6,7 @@ import { } from '@capital/component'; import { useOpenAppInfo } from '../context'; import { useOpenAppAction } from './useOpenAppAction'; +import { Translate } from '../../translate'; const OAuth: React.FC = React.memo(() => { const { capability, oauth } = useOpenAppInfo(); @@ -15,7 +16,7 @@ const OAuth: React.FC = React.memo(() => { return (
{ {capability.includes('oauth') && ( {(oauth?.redirectUrls ?? []).map((url, i) => ( diff --git a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/Profile.tsx b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/Profile.tsx index 71dcbdda..49bb227d 100644 --- a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/Profile.tsx +++ b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/Profile.tsx @@ -1,6 +1,7 @@ import { useOpenAppInfo } from '../context'; import React from 'react'; import { FullModalField, Divider, SensitiveText } from '@capital/component'; +import { Translate } from '../../translate'; import './Profile.less'; /** @@ -11,7 +12,7 @@ const Profile: React.FC = React.memo(() => { return (
-

应用凭证

+

{Translate.app.appcret}

@@ -23,7 +24,7 @@ const Profile: React.FC = React.memo(() => { -

基本信息

+

{Translate.app.basicInfo}

{/* TODO */}
diff --git a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/index.tsx b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/index.tsx index df1f1ff6..4e763047 100644 --- a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/index.tsx +++ b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/AppInfo/index.tsx @@ -2,9 +2,10 @@ import React, { useMemo } from 'react'; import { SidebarView } from '@capital/component'; import { Loadable } from '@capital/common'; import { useOpenAppInfo } from '../context'; +import { Translate } from '../../translate'; import './index.less'; -const Summary = Loadable(() => import('./Summary')); +// const Summary = Loadable(() => import('./Summary')); const Profile = Loadable(() => import('./Profile')); const Bot = Loadable(() => import('./Bot')); const Webpage = Loadable(() => import('./Webpage')); @@ -19,31 +20,31 @@ const AppInfo: React.FC = React.memo(() => { type: 'group', title: appName, children: [ + // { + // type: 'item', + // title: '总览', + // content: , + // isDev: true, + // }, { type: 'item', - title: '总览', - content: , - isDev: true, - }, - { - type: 'item', - title: '基础信息', + title: Translate.app.basicInfo, content: , }, { type: 'item', - title: '机器人', + title: Translate.app.bot, content: , }, { type: 'item', - title: '网页', + title: Translate.app.webpage, content: , isDev: true, }, { type: 'item', - title: '应用登录', + title: Translate.app.oauth, content: , }, ], diff --git a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/index.tsx b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/index.tsx index c3809e35..13d4a235 100644 --- a/client/web/plugins/com.msgbyte.openapi/src/MainPanel/index.tsx +++ b/client/web/plugins/com.msgbyte.openapi/src/MainPanel/index.tsx @@ -7,6 +7,7 @@ import { OpenAppInfoProvider } from './context'; import { CreateOpenApp } from '../modals/CreateOpenApp'; import { ServiceChecker } from '../components/ServiceChecker'; import { useOpenAppList } from './useOpenAppList'; +import { Translate } from '../translate'; import './index.less'; const OpenApiMainPanel: React.FC = React.memo(() => { @@ -16,16 +17,16 @@ const OpenApiMainPanel: React.FC = React.memo(() => { const columns = useMemo( () => [ { - title: '名称', + title: Translate.name, dataIndex: 'appName', }, { - title: '操作', + title: Translate.operation, key: 'action', render: (_, record: OpenApp) => ( ), @@ -59,7 +60,7 @@ const OpenApiMainPanel: React.FC = React.memo(() => { type="primary" onClick={handleCreateOpenApp} > - 创建应用 + {Translate.createApplication} diff --git a/client/web/plugins/com.msgbyte.openapi/src/modals/CreateOpenApp.tsx b/client/web/plugins/com.msgbyte.openapi/src/modals/CreateOpenApp.tsx index c37564af..1a3ca16b 100644 --- a/client/web/plugins/com.msgbyte.openapi/src/modals/CreateOpenApp.tsx +++ b/client/web/plugins/com.msgbyte.openapi/src/modals/CreateOpenApp.tsx @@ -8,21 +8,22 @@ import { } from '@capital/common'; import { WebFastForm } from '@capital/component'; import React from 'react'; +import { Translate } from '../translate'; const schema = createFastFormSchema({ appName: fieldSchema .string() - .required('应用名不能为空') - .max(20, '应用名过长'), + .required(Translate.appNameCannotBeEmpty) + .max(20, Translate.appNameTooLong), appDesc: fieldSchema.string(), }); const fields = [ - { type: 'text', name: 'appName', label: '应用名' }, + { type: 'text', name: 'appName', label: Translate.app.appName }, { type: 'textarea', name: 'appDesc', - label: '应用描述', + label: Translate.app.appDesc, }, ]; @@ -38,7 +39,7 @@ export const CreateOpenApp: React.FC = React.memo( appIcon: '', }); - showToasts('应用创建成功', 'success'); + showToasts(Translate.createApplicationSuccess, 'success'); props.onSuccess?.(); } catch (e) { showErrorToasts(e); @@ -46,7 +47,7 @@ export const CreateOpenApp: React.FC = React.memo( }; return ( - + ); diff --git a/client/web/plugins/com.msgbyte.openapi/src/translate.ts b/client/web/plugins/com.msgbyte.openapi/src/translate.ts index 7a6280f2..ccb96f69 100644 --- a/client/web/plugins/com.msgbyte.openapi/src/translate.ts +++ b/client/web/plugins/com.msgbyte.openapi/src/translate.ts @@ -10,6 +10,64 @@ export const Translate = { 'zh-CN': '开启机器人能力', 'en-US': 'Enable Bot Capability', }), + name: localTrans({ + 'zh-CN': '名称', + 'en-US': 'Name', + }), + operation: localTrans({ + 'zh-CN': '操作', + 'en-US': 'Operation', + }), + enter: localTrans({ + 'zh-CN': '进入', + 'en-US': 'Enter', + }), + createApplication: localTrans({ + 'zh-CN': '创建应用', + 'en-US': 'Create Application', + }), + createApplicationSuccess: localTrans({ + 'zh-CN': '创建应用成功', + 'en-US': 'Create Application Success', + }), + appNameCannotBeEmpty: localTrans({ + 'zh-CN': '应用名不能为空', + 'en-US': 'App Name Cannot be Empty', + }), + appNameTooLong: localTrans({ + 'zh-CN': '应用名过长', + 'en-US': 'App Name too Long', + }), + app: { + basicInfo: localTrans({ + 'zh-CN': '基础信息', + 'en-US': 'Basic Info', + }), + bot: localTrans({ + 'zh-CN': '机器人', + 'en-US': 'Bot', + }), + webpage: localTrans({ + 'zh-CN': '网页', + 'en-US': 'Web Page', + }), + oauth: localTrans({ + 'zh-CN': '第三方登录', + 'en-US': 'OAuth', + }), + appcret: localTrans({ + 'zh-CN': '应用凭证', + 'en-US': 'Application Credentials', + }), + appName: localTrans({ + 'zh-CN': '应用名称', + 'en-US': 'App Name', + }), + appDesc: localTrans({ + 'zh-CN': '应用描述', + 'en-US': 'App Desc', + }), + }, bot: { callback: localTrans({ 'zh-CN': '消息回调地址', @@ -22,4 +80,18 @@ export const Translate = { 'The bot will send a request to this address when it is mentioned (callback will be sent when the inbox receives new content)', }), }, + oauth: { + open: localTrans({ + 'zh-CN': '开启 OAuth', + 'en-US': 'Open OAuth', + }), + allowedCallbackUrls: localTrans({ + 'zh-CN': '允许的回调地址', + 'en-US': 'Allowed Callback Urls', + }), + allowedCallbackUrlsTip: localTrans({ + 'zh-CN': '多个回调地址单独一行', + 'en-US': 'Multiple callback addresses on a single line', + }), + }, }; diff --git a/website/docs/deployment/docker-compose.mdx b/website/docs/deployment/docker-compose.mdx index c1d545d8..9e6b9cf1 100644 --- a/website/docs/deployment/docker-compose.mdx +++ b/website/docs/deployment/docker-compose.mdx @@ -128,7 +128,7 @@ wget https://raw.githubusercontent.com/msgbyte/tailchat/master/docker-compose.en 修改 `docker-compose.env` 文件的配置,以下字段推荐修改: -- `API_URL` 对外可访问的url地址,用于文件服务访问, 可以是域名也可以是ip +- `API_URL` 对外可访问的url地址,用于文件服务访问, 可以是域名也可以是ip **如果出现发送图片不能正常显示就是这个变量没有设置** - `SECRET` 服务端加密秘钥,用于生成Token. 默认为 `tailchat`