style: usage chart style
This commit is contained in:
@@ -8,8 +8,8 @@ const SimpleCardItemWrapper = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
gap: 10px;
|
gap: 16px;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 16px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const useStyles = createStyles(({ css, token }) => ({
|
const useStyles = createStyles(({ css, token }) => ({
|
||||||
@@ -24,12 +24,16 @@ const useStyles = createStyles(({ css, token }) => ({
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: ${token.padding}px;
|
gap: ${token.padding}px;
|
||||||
|
&.bordered {
|
||||||
|
border: 1px solid ${token.colorBorder};
|
||||||
|
}
|
||||||
.title {
|
.title {
|
||||||
font-size: ${token.fontSize}px;
|
font-size: ${token.fontSize}px;
|
||||||
font-weight: var(--font-weight-medium);
|
font-weight: var(--font-weight-medium);
|
||||||
}
|
}
|
||||||
.content {
|
.content {
|
||||||
font-weight: var(--font-weight-500);
|
font-size: ${token.fontSize}px;
|
||||||
|
color: ${token.colorTextSecondary};
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
}));
|
}));
|
||||||
@@ -37,13 +41,14 @@ export const SimpleCardItem: React.FC<{
|
|||||||
title?: string;
|
title?: string;
|
||||||
content?: React.ReactNode;
|
content?: React.ReactNode;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
|
bordered?: boolean;
|
||||||
}> = (props) => {
|
}> = (props) => {
|
||||||
const { styles } = useStyles();
|
const { styles, cx } = useStyles();
|
||||||
|
|
||||||
const { title, content, style } = props;
|
const { title, content, style, bordered } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper} style={style}>
|
<div className={cx({ bordered: bordered }, styles.wrapper)} style={style}>
|
||||||
<div className="title">{title}</div>
|
<div className="title">{title}</div>
|
||||||
<div className="content">{content}</div>
|
<div className="content">{content}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -53,8 +58,9 @@ export const SimpleCardItem: React.FC<{
|
|||||||
export const SimpleCard: React.FC<{
|
export const SimpleCard: React.FC<{
|
||||||
dataList: { label: string; value: React.ReactNode }[];
|
dataList: { label: string; value: React.ReactNode }[];
|
||||||
height?: string | number;
|
height?: string | number;
|
||||||
|
bordered?: boolean;
|
||||||
}> = (props) => {
|
}> = (props) => {
|
||||||
const { dataList } = props;
|
const { dataList, bordered } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SimpleCardItemWrapper style={{ height: props.height || '100%' }}>
|
<SimpleCardItemWrapper style={{ height: props.height || '100%' }}>
|
||||||
@@ -63,6 +69,7 @@ export const SimpleCard: React.FC<{
|
|||||||
key={index}
|
key={index}
|
||||||
title={item.label}
|
title={item.label}
|
||||||
content={item.value}
|
content={item.value}
|
||||||
|
bordered={bordered}
|
||||||
></SimpleCardItem>
|
></SimpleCardItem>
|
||||||
))}
|
))}
|
||||||
</SimpleCardItemWrapper>
|
</SimpleCardItemWrapper>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { SimpleCard } from '@/components/card-wrapper/simple-card';
|
||||||
import PageTools from '@/components/page-tools';
|
import PageTools from '@/components/page-tools';
|
||||||
import { ExportOutlined } from '@ant-design/icons';
|
import { ExportOutlined } from '@ant-design/icons';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
@@ -18,10 +19,21 @@ const FilterWrapper = styled.div`
|
|||||||
.selection {
|
.selection {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const TitleWrapper = styled.div`
|
||||||
|
margin: 26px 0px;
|
||||||
|
font-weight: 700;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const dataList = [
|
||||||
|
{ label: '100M', value: 'Completion Tokens' },
|
||||||
|
{ label: '50M', value: 'Prompt Tokens' },
|
||||||
|
{ label: '120K', value: 'API Requests' }
|
||||||
|
];
|
||||||
|
|
||||||
const UsageInner: FC<{ paddingRight: string }> = ({ paddingRight }) => {
|
const UsageInner: FC<{ paddingRight: string }> = ({ paddingRight }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
@@ -40,14 +52,7 @@ const UsageInner: FC<{ paddingRight: string }> = ({ paddingRight }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PageTools
|
<PageTools style={{ margin: '0px 0px' }} left={false} />
|
||||||
style={{ margin: '26px 0px' }}
|
|
||||||
left={
|
|
||||||
<span className="font-700">
|
|
||||||
{intl.formatMessage({ id: 'dashboard.usage' })}
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Row style={{ width: '100%' }} gutter={[0, 20]}>
|
<Row style={{ width: '100%' }} gutter={[0, 20]}>
|
||||||
<Col
|
<Col
|
||||||
xs={24}
|
xs={24}
|
||||||
@@ -57,6 +62,9 @@ const UsageInner: FC<{ paddingRight: string }> = ({ paddingRight }) => {
|
|||||||
xl={16}
|
xl={16}
|
||||||
style={{ paddingRight: paddingRight }}
|
style={{ paddingRight: paddingRight }}
|
||||||
>
|
>
|
||||||
|
<TitleWrapper>
|
||||||
|
{intl.formatMessage({ id: 'dashboard.usage' })}
|
||||||
|
</TitleWrapper>
|
||||||
<FilterWrapper>
|
<FilterWrapper>
|
||||||
<div className="selection">
|
<div className="selection">
|
||||||
<DatePicker.RangePicker></DatePicker.RangePicker>
|
<DatePicker.RangePicker></DatePicker.RangePicker>
|
||||||
@@ -71,6 +79,11 @@ const UsageInner: FC<{ paddingRight: string }> = ({ paddingRight }) => {
|
|||||||
{intl.formatMessage({ id: 'common.button.export' })}
|
{intl.formatMessage({ id: 'common.button.export' })}
|
||||||
</Button>
|
</Button>
|
||||||
</FilterWrapper>
|
</FilterWrapper>
|
||||||
|
<SimpleCard
|
||||||
|
dataList={dataList}
|
||||||
|
height={80}
|
||||||
|
bordered={true}
|
||||||
|
></SimpleCard>
|
||||||
<RequestTokenInner
|
<RequestTokenInner
|
||||||
requestData={requestTokenData.requestData}
|
requestData={requestTokenData.requestData}
|
||||||
xAxisData={requestTokenData.xAxisData}
|
xAxisData={requestTokenData.xAxisData}
|
||||||
@@ -78,6 +91,9 @@ const UsageInner: FC<{ paddingRight: string }> = ({ paddingRight }) => {
|
|||||||
></RequestTokenInner>
|
></RequestTokenInner>
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={24} sm={24} md={24} lg={24} xl={8}>
|
<Col xs={24} sm={24} md={24} lg={24} xl={8}>
|
||||||
|
<TitleWrapper>
|
||||||
|
{intl.formatMessage({ id: 'dashboard.topusers' })}
|
||||||
|
</TitleWrapper>
|
||||||
<TopUser
|
<TopUser
|
||||||
userData={topUserData.userData}
|
userData={topUserData.userData}
|
||||||
topUserList={topUserData.topUserList}
|
topUserList={topUserData.topUserList}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import CardWrapper from '@/components/card-wrapper';
|
import CardWrapper from '@/components/card-wrapper';
|
||||||
import { SimpleCard } from '@/components/card-wrapper/simple-card';
|
|
||||||
import MixLineBar from '@/components/echarts/mix-line-bar';
|
import MixLineBar from '@/components/echarts/mix-line-bar';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
@@ -60,7 +59,7 @@ const RequestTokenInner: React.FC<RequestTokenInnerProps> = (props) => {
|
|||||||
></BarChart>
|
></BarChart>
|
||||||
</Col>
|
</Col>
|
||||||
</Row> */}
|
</Row> */}
|
||||||
<SimpleCard dataList={dataList} height={80}></SimpleCard>
|
{/* <SimpleCard dataList={dataList} height={80}></SimpleCard> */}
|
||||||
<MixLineBar
|
<MixLineBar
|
||||||
chartData={{
|
chartData={{
|
||||||
line: requestData,
|
line: requestData,
|
||||||
|
|||||||
@@ -13,12 +13,7 @@ const TopUser: React.FC<TopUserProps> = (props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<CardWrapper>
|
<CardWrapper>
|
||||||
<HBar
|
<HBar seriesData={userData} xAxisData={topUserList} height={512}></HBar>
|
||||||
title={intl.formatMessage({ id: 'dashboard.topusers' })}
|
|
||||||
seriesData={userData}
|
|
||||||
xAxisData={topUserList}
|
|
||||||
height={520}
|
|
||||||
></HBar>
|
|
||||||
</CardWrapper>
|
</CardWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user