Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:chat2db/Chat2DB into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryFan626 committed Oct 22, 2023
2 parents d541c2f + 9bd8922 commit c8efaf0
Show file tree
Hide file tree
Showing 29 changed files with 715 additions and 136 deletions.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"bgcolor",
"blockmap",
"cascader",
"charsets",
"chmod",
"CLOB",
"datasource",
Expand Down Expand Up @@ -40,6 +41,7 @@
"pgsql",
"pnpm",
"Popconfirm",
"redownload",
"remaininguses",
"RESTAI",
"samuelmeuli",
Expand Down
1 change: 0 additions & 1 deletion chat2db-client/.umirc.prod.desktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const chainWebpack = (config: any, { webpack }: any) => {
languages: ['mysql', 'pgsql', 'sql'],
},
]);
config.output.filename(`[name].${yarn_config.app_version || new Date().getTime()}.js`);
};

export default defineConfig({
Expand Down
1 change: 0 additions & 1 deletion chat2db-client/.umirc.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const chainWebpack = (config: any, { webpack }: any) => {
languages: ['mysql', 'pgsql', 'sql'],
},
]);
config.output.filename(`[name].${yarn_config.app_version || new Date().getTime()}.js`);
};

export default defineConfig({
Expand Down
5 changes: 2 additions & 3 deletions chat2db-client/.umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ const chainWebpack = (config: any, { webpack }: any) => {
languages: ['mysql', 'pgsql', 'sql'],
},
]);
config.output.filename(`[name].${yarn_config.app_version || new Date().getTime()}.js`);
};

export default defineConfig({
title: 'Chat2DB',
base: '/',
publicPath: '/',
hash: false,
hash: true,
routes: [
{ path: '/demo', component: '@/pages/demo' },
{ path: '/connections', component: 'main' },
Expand Down Expand Up @@ -98,7 +97,7 @@ export default defineConfig({
define: {
__ENV__: process.env.UMI_ENV,
__BUILD_TIME__: transitionTimezoneTimestamp(new Date().getTime()),
__APP_VERSION__: yarn_config.app_version || '0.0.0',
__APP_VERSION__: yarn_config.app_version || '9.9.9',
__APP_PORT__: yarn_config.app_port,
},
esbuildMinifyIIFE: true
Expand Down
1 change: 1 addition & 0 deletions chat2db-client/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"uuidv",
"VARCHAR",
"VIEWCOLUMN",
"webp",
"wireframe",
"Wppk",
"yapi"
Expand Down
Binary file not shown.
Binary file modified chat2db-client/src/assets/logo/logo.webp
Binary file not shown.
57 changes: 48 additions & 9 deletions chat2db-client/src/blocks/Setting/About/index.less
Original file line number Diff line number Diff line change
@@ -1,16 +1,55 @@
.aboutUs {
display: flex;
flex-direction: column;
align-items: center;

.brief {
.versionsInfo {
display: flex;
flex-direction: column;
align-items: center;

padding-bottom: 10px;
border-bottom: 1px solid var(--color-border);
margin-bottom: 10px;
}
.brandLogo {
margin-right: 15px;
}
.currentVersion {
font-size: 20px;
line-height: 24px;
.appName {
font-size: 20px;
margin-right: 10px;
}
}
.newVersion {
color: var(--color-text-tertiary);
font-size: 14px;
margin-top: 2px;
}
.updateButton {
margin-top: 10px;
button:nth-of-type(1) {
margin-right: 20px;
}
}
.updateRule {
.updateRuleTitle {
font-size: 16px;
margin-bottom: 10px;
}
.updateRuleGroup {
display: flex;
flex-direction: column;
.updateRuleRadioContent {
display: flex;
align-items: center;
i {
margin-left: 4px;
color: var(--color-text-tertiary);
font-size: 12px;
}
}
}
}
.brief {
display: flex;
flex-direction: column;
align-items: center;

.env,
.version {
Expand All @@ -28,4 +67,4 @@
}
}
}
}
}
129 changes: 121 additions & 8 deletions chat2db-client/src/blocks/Setting/About/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,129 @@
import React, { useEffect, useMemo } from 'react';
import styles from './index.less';
// import i18n from '@/i18n';
import BrandLogo from '@/components/BrandLogo';
import { APP_NAME, GITHUB_URL } from '@/constants/appConfig';
import { APP_NAME, WEBSITE_DOC } from '@/constants/appConfig';
// import { formatDate, getUserTimezoneTimestamp } from '@/utils/date';
import { Button, Radio, Space } from 'antd';
import configService from '@/service/config';
import { DownloadOutlined,RedoOutlined } from '@ant-design/icons';
import { IUpdateDetectionData } from '../index';
import { IUpdateDetectionRef, UpdatedStatusEnum } from '../UpdateDetection';
import i18n from '@/i18n';
import React from 'react';
import styles from './index.less';
import { formatDate, getUserTimezoneTimestamp } from '@/utils/date';

interface IProps {
updateDetectionData: IUpdateDetectionData | null;
updateDetectionRef: React.MutableRefObject<IUpdateDetectionRef> | null;
}

// 关于我们
export default function AboutUs() {
export default function AboutUs(props: IProps) {
const { updateDetectionData, updateDetectionRef } = props;
const [updateRule, setUpdateRule] = React.useState<'manual' | 'auto'>(updateDetectionData?.type || 'manual');

const onChangeUpdateRul = (e) => {
configService.setAppUpdateType(e.target.value).then(() => {
setUpdateRule(e.target.value);
});
};

useEffect(()=>{
setUpdateRule(updateDetectionData?.type || 'manual');
},[updateDetectionData?.type])

const jumpDoc = () => {
window.open(WEBSITE_DOC, '_blank');
};

const updateButton = useMemo(() => {
if (!updateDetectionData?.needUpdate) {
return false;
}
switch (updateDetectionData?.updatedStatusEnum) {
case UpdatedStatusEnum.NOT_UPDATED:
return (
<Button
onClick={() => {
updateDetectionRef?.current?.openDownload();
}}
icon={<DownloadOutlined />}
type="primary"
>
{i18n('setting.button.startDownloading')}
</Button>
);
case UpdatedStatusEnum.UPDATING:
return (
<Button type="primary" loading>
{i18n('setting.button.beDownloading')}
</Button>
);
// 超时后端如何处理 TODO:
case UpdatedStatusEnum.TIMEOUT:
return (
<Button
onClick={() => {
updateDetectionRef?.current?.openDownload();
}}
icon={<DownloadOutlined />}
type="primary"
loading
>
{i18n('setting.button.redownload')}
</Button>
);
// case UpdatedStatusEnum.UPDATED:
// return (
// <Button icon={<RedoOutlined />} type="primary">
// {i18n('setting.button.restart')}
// </Button>
// );
default:
return false;
}
}, [updateDetectionData]);

return (
<div className={styles.aboutUs}>
<BrandLogo size={60} className={styles.brandLogo} />
<div className={styles.brief}>
<div className={styles.versionsInfo}>
<BrandLogo size={98} className={styles.brandLogo} />
<div>
<div className={styles.currentVersion}>
<span className={styles.appName}>{APP_NAME}</span>
<span>{__APP_VERSION__}</span>
</div>
<div className={styles.newVersion}>
{updateDetectionData?.needUpdate ? (
UpdatedStatusEnum.UPDATED === updateDetectionData?.updatedStatusEnum ?
<span>{i18n('setting.text.RestartingInstall')}</span>
:
<span>{i18n('setting.text.discoverNewVersion', updateDetectionData?.version)}</span>
) : (
<span>{i18n('setting.text.isLatestVersion')}</span>
)}
</div>
{updateDetectionData?.desktop && (
<div className={styles.updateButton}>
{updateButton}
<Button onClick={jumpDoc}>{i18n('setting.button.changeLog')}</Button>
</div>
)}
</div>
</div>
<div className={styles.updateRule}>
<div className={styles.updateRuleTitle}>{i18n('setting.title.updateRule')}</div>
<Radio.Group className={styles.updateRuleGroup} onChange={onChangeUpdateRul} value={updateRule}>
<Space direction="vertical">
<Radio className={styles.updateRuleRadio} value="auto">
{i18n('setting.text.autoUpdate')}
</Radio>
<Radio className={styles.updateRuleRadio} value="manual">
{i18n('setting.text.manualUpdate')}
</Radio>
</Space>
</Radio.Group>
</div>
{/* <div className={styles.brief}>
<div className={styles.appName}>{APP_NAME}</div>
<div className={styles.env}>
{i18n('setting.text.currentEnv')}:{__ENV__}
Expand All @@ -22,7 +135,7 @@ export default function AboutUs() {
<a target="blank" href={GITHUB_URL} className={styles.log}>
{i18n('setting.text.viewingUpdateLogs')}
</a>
</div>
</div> */}
</div>
);
}
Loading

0 comments on commit c8efaf0

Please sign in to comment.