feat: add zh translation and change title (#100)

This commit is contained in:
moonrailgun
2023-06-21 15:21:24 +08:00
committed by GitHub
parent 6fb312ccfd
commit 11ce10cd80
6 changed files with 2845 additions and 2150 deletions

2
admin/.gitignore vendored
View File

@@ -1 +1 @@
node_modules/
node_modules/

View File

@@ -2,13 +2,14 @@
## 项目原理
使用 tushan 项目做前端,然后构造了一个与 mongodb 做沟通的 API 做后端,可以做到创建、修改和删除用户
使用 [Tushan](https://tushan.msgbyte.com/) 项目做前端,然后构造了一个与 mongodb 做沟通的 API 做后端,可以做到创建、修改和删除用户
## 开发
1. 复制 .env.template 文件,添加环境变量
2. pnpm i
3. pnpm dev
1. `cp .env.template .env.local`: 复制 .env.template 文件,添加环境变量
2. `pnpm i`
3. `pnpm dev`
4. 打开 `http://localhost:5173/` 访问前端页面
## 部署
@@ -33,7 +34,7 @@ VITE_PUBLIC_SERVER_URL=http://localhost:3001 # 和server.js一致
1. 进入 sealos 官网: https://cloud.sealos.io/
2. 打开 App Launchpad(应用管理) 工具
3. 新建应用
1. 镜像名: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin:latest
1. 镜像名: `registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin:latest`
2. 容器端口: 3001
3. 环境变量: 参考上面
4. 打开外网访问开关

View File

@@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tushan</title>
<title>Fast GPT</title>
</head>
<body>
<div id="root"></div>

View File

@@ -25,7 +25,7 @@
"react-admin": "^4.11.0",
"react-dom": "^18.2.0",
"react-i18next": "^12.3.1",
"tushan": "^0.2.23"
"tushan": "^0.2.29"
},
"devDependencies": {
"@types/jsonexport": "^3.0.2",

4960
admin/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,16 +4,19 @@ import {
ListTable,
Resource,
Tushan,
fetchJSON
fetchJSON,
TushanContextProps,
HTTPClient
} from 'tushan';
import { authProvider } from './auth';
import { userFields, payFields, kbFields, ModelFields, SystemFields } from './fields';
import { Dashboard } from './Dashboard';
import { IconUser, IconApps, IconBook, IconStamp } from 'tushan/icon';
import { i18nZhTranslation } from 'tushan/client/i18n/resources/zh';
const authStorageKey = 'tushan:auth';
const httpClient: typeof fetchJSON = (url, options = {}) => {
const httpClient: HTTPClient = (url, options = {}) => {
try {
if (!options.headers) {
options.headers = new Headers({ Accept: 'application/json' });
@@ -29,11 +32,22 @@ const httpClient: typeof fetchJSON = (url, options = {}) => {
const dataProvider = jsonServerProvider(import.meta.env.VITE_PUBLIC_SERVER_URL, httpClient);
const i18n: TushanContextProps['i18n'] = {
languages: [
{
key: 'zh',
label: '简体中文',
translation: i18nZhTranslation
}
]
};
function App() {
return (
<Tushan
basename="/"
header={'FastGpt-Admin'}
i18n={i18n}
dataProvider={dataProvider}
authProvider={authProvider}
dashboard={<Dashboard />}