(improvement)(chat-sdk) set ant locale to zh-cn and optimize range picker style (#1489)

This commit is contained in:
williamhliu
2024-07-30 19:32:30 +08:00
committed by GitHub
parent 52a584b9a4
commit b5fa54a754
2 changed files with 143 additions and 138 deletions

View File

@@ -22,7 +22,12 @@ import { HistoryMsgItemType, MsgDataType, SendMsgParamsType } from '../common/ty
import { getHistoryMsg } from '../service';
import ShowCase from '../ShowCase';
import { jsonParse } from '../utils/utils';
import { Drawer, Modal, Row, Col, Space, Switch, Tooltip } from 'antd';
import { ConfigProvider, Drawer, Modal, Row, Col, Space, Switch, Tooltip } from 'antd';
import locale from 'antd/locale/zh_CN';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
dayjs.locale('zh-cn');
type Props = {
token?: string;
@@ -377,6 +382,7 @@ const Chat: ForwardRefRenderFunction<any, Props> = (
});
return (
<ConfigProvider locale={locale}>
<div className={chatClass}>
<div className={styles.chatSection}>
{!isMobile && agentList.length > 1 && agentListVisible && (
@@ -511,6 +517,7 @@ const Chat: ForwardRefRenderFunction<any, Props> = (
}}
/>
</div>
</ConfigProvider>
);
};

View File

@@ -9,8 +9,13 @@ import MarkDown from '../ChatMsg/MarkDown';
import classNames from 'classnames';
import { isMobile } from '../../utils/utils';
import dayjs, { Dayjs } from 'dayjs';
import locale from 'antd/locale/zh_CN';
import quarterOfYear from 'dayjs/plugin/quarterOfYear';
import 'dayjs/locale/zh-cn';
dayjs.extend(quarterOfYear);
dayjs.locale('zh-cn');
const { RangePicker } = DatePicker;
@@ -257,24 +262,17 @@ const ParseTip: React.FC<Props> = ({
<RangePicker
value={[dayjs(startDate), dayjs(endDate)]}
onChange={onDateInfoChange}
format="YYYY/MM/DD"
format="YYYY-MM-DD"
renderExtraFooter={() => (
<Row gutter={[28, 28]}>
{Object.keys(ranges).map(key => (
<Col key={key}>
<label
style={{
backgroundColor: '#F0FDFF',
borderColor: '#33BDFC',
color: '#33BDFC',
borderWidth: 1,
borderStyle: 'solid',
cursor: 'pointer',
}}
<Button
size="small"
onClick={() => handlePresetClick(ranges[key as RangeKeys])}
>
{key}
</label>
</Button>
</Col>
))}
</Row>