mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-02 08:06:38 +08:00
修改组件布局
This commit is contained in:
parent
d701e63a52
commit
a2070067b0
6
.github/workflows/dockerToHub-dev.yml
vendored
6
.github/workflows/dockerToHub-dev.yml
vendored
@ -1,9 +1,9 @@
|
|||||||
name: DEV DEPLOY TO TX
|
name: DEV DEPLOY TO TX
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
# push:
|
||||||
branches:
|
# branches:
|
||||||
- dev
|
# - dev
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState, Dispatch, SetStateAction } from "react";
|
||||||
|
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
import { DatePicker, DatePickerValue } from "@tremor/react";
|
import { DatePicker, DatePickerValue } from "@tremor/react";
|
||||||
@ -7,8 +7,25 @@ import { zhCN } from "date-fns/locale";
|
|||||||
import { EChartsOption } from "echarts";
|
import { EChartsOption } from "echarts";
|
||||||
import { essos, walden } from "@/lib/charts_theme";
|
import { essos, walden } from "@/lib/charts_theme";
|
||||||
|
|
||||||
export default function UsageByModelChart() {
|
interface ComponentProps {
|
||||||
const [currentDate, setCurrentDate] = useState(new Date());
|
currentDate: Date;
|
||||||
|
setCurrentDate: Dispatch<SetStateAction<Date>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function DateSelectComponent({ currentDate, setCurrentDate }: ComponentProps) {
|
||||||
|
return (
|
||||||
|
<DatePicker
|
||||||
|
className="max-w-sm mx-auto justify-center"
|
||||||
|
value={currentDate}
|
||||||
|
locale={zhCN}
|
||||||
|
defaultValue={new Date()}
|
||||||
|
onValueChange={(d) => d && setCurrentDate(d)}
|
||||||
|
maxDate={new Date()}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function EchartsComponent({ currentDate, setCurrentDate }: ComponentProps) {
|
||||||
const [searchDate, setSearchDate] = useState("");
|
const [searchDate, setSearchDate] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -69,19 +86,26 @@ export default function UsageByModelChart() {
|
|||||||
}, [currentDate, searchDate]); // 空数组作为第二个参数,表示仅在组件挂载和卸载时执行
|
}, [currentDate, searchDate]); // 空数组作为第二个参数,表示仅在组件挂载和卸载时执行
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
|
||||||
<DatePicker
|
|
||||||
className="max-w-sm mx-auto justify-center"
|
|
||||||
value={currentDate}
|
|
||||||
locale={zhCN}
|
|
||||||
defaultValue={new Date()}
|
|
||||||
onValueChange={(d) => d && setCurrentDate(d)}
|
|
||||||
maxDate={new Date()}
|
|
||||||
/>
|
|
||||||
<div
|
<div
|
||||||
id="usage-by-model-chart"
|
id="usage-by-model-chart"
|
||||||
style={{ width: "100%", height: "400px" }}
|
style={{ width: "100%", height: "400px" }}
|
||||||
></div>
|
></div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function UsageByModelChart() {
|
||||||
|
const [currentDate, setCurrentDate] = useState(new Date());
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<DateSelectComponent
|
||||||
|
currentDate={currentDate}
|
||||||
|
setCurrentDate={setCurrentDate}
|
||||||
|
/>
|
||||||
|
<EchartsComponent
|
||||||
|
currentDate={currentDate}
|
||||||
|
setCurrentDate={setCurrentDate}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user