mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 23:56:39 +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
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
# push:
|
||||
# branches:
|
||||
# - dev
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useState, Dispatch, SetStateAction } from "react";
|
||||
|
||||
import * as echarts from "echarts";
|
||||
import { DatePicker, DatePickerValue } from "@tremor/react";
|
||||
@ -7,8 +7,25 @@ import { zhCN } from "date-fns/locale";
|
||||
import { EChartsOption } from "echarts";
|
||||
import { essos, walden } from "@/lib/charts_theme";
|
||||
|
||||
export default function UsageByModelChart() {
|
||||
const [currentDate, setCurrentDate] = useState(new Date());
|
||||
interface ComponentProps {
|
||||
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("");
|
||||
|
||||
useEffect(() => {
|
||||
@ -68,20 +85,27 @@ export default function UsageByModelChart() {
|
||||
};
|
||||
}, [currentDate, searchDate]); // 空数组作为第二个参数,表示仅在组件挂载和卸载时执行
|
||||
|
||||
return (
|
||||
<div
|
||||
id="usage-by-model-chart"
|
||||
style={{ width: "100%", height: "400px" }}
|
||||
></div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function UsageByModelChart() {
|
||||
const [currentDate, setCurrentDate] = useState(new Date());
|
||||
|
||||
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()}
|
||||
<DateSelectComponent
|
||||
currentDate={currentDate}
|
||||
setCurrentDate={setCurrentDate}
|
||||
/>
|
||||
<EchartsComponent
|
||||
currentDate={currentDate}
|
||||
setCurrentDate={setCurrentDate}
|
||||
/>
|
||||
<div
|
||||
id="usage-by-model-chart"
|
||||
style={{ width: "100%", height: "400px" }}
|
||||
></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user