mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-16 14:03:43 +08:00
优化导入组件
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { Grid, Col } from "@tremor/react";
|
||||
import UsageByModel from "./usage-by-model-chart";
|
||||
import UserByMap from "./user-by-map";
|
||||
import { getSession } from "@/lib/auth";
|
||||
|
||||
@@ -9,12 +9,22 @@ import React, {
|
||||
} from "react";
|
||||
|
||||
import * as echarts from "echarts";
|
||||
import { DatePicker } from "@tremor/react";
|
||||
import { zhCN } from "date-fns/locale";
|
||||
// import { DatePicker } from "@tremor/react";
|
||||
import { DatePicker } from "antd";
|
||||
import { Col, Row } from "antd";
|
||||
|
||||
import locale from "antd/es/date-picker/locale/zh_CN";
|
||||
import "dayjs/locale/zh-cn";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import { EChartsOption } from "echarts";
|
||||
import { essos } from "@/lib/charts_theme";
|
||||
import { subDays, addDays } from "date-fns";
|
||||
|
||||
// import customParseFormat from 'dayjs/plugin/customParseFormat';
|
||||
// dayjs.extend(customParseFormat);
|
||||
// const dateFormat = 'YYYY-MM-DD';
|
||||
|
||||
interface ComponentProps {
|
||||
currentDate: Date;
|
||||
setCurrentDate: Dispatch<SetStateAction<Date>>;
|
||||
@@ -64,14 +74,15 @@ function DateSelectComponent({ currentDate, setCurrentDate }: ComponentProps) {
|
||||
}, [changeCurrentDate, currentDate]);
|
||||
|
||||
return (
|
||||
<DatePicker
|
||||
className="max-w-sm mx-auto justify-center"
|
||||
value={currentDate}
|
||||
locale={zhCN}
|
||||
defaultValue={new Date()}
|
||||
onValueChange={(d) => d && changeCurrentDate(d)}
|
||||
maxDate={maxDate}
|
||||
/>
|
||||
<div className="max-w-sm mx-auto justify-center mb-1.5">
|
||||
<DatePicker
|
||||
value={dayjs(currentDate)}
|
||||
locale={locale}
|
||||
// defaultValue={dayjs(new Date())}
|
||||
onChange={(d, ds) => d && changeCurrentDate(d.toDate())}
|
||||
maxDate={dayjs(maxDate)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,14 +159,18 @@ export default function UsageByModelChart() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<DateSelectComponent
|
||||
currentDate={currentDate}
|
||||
setCurrentDate={setCurrentDate}
|
||||
/>
|
||||
<EchartsComponent
|
||||
currentDate={currentDate}
|
||||
setCurrentDate={setCurrentDate}
|
||||
/>
|
||||
<Row>
|
||||
<DateSelectComponent
|
||||
currentDate={currentDate}
|
||||
setCurrentDate={setCurrentDate}
|
||||
/>
|
||||
</Row>
|
||||
<Row>
|
||||
<EchartsComponent
|
||||
currentDate={currentDate}
|
||||
setCurrentDate={setCurrentDate}
|
||||
/>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ function MainLayout({ children }: { children: ReactNode }) {
|
||||
</Header>
|
||||
<Content
|
||||
style={{
|
||||
margin: "24px 16px",
|
||||
// margin: "24px 16px",
|
||||
padding: 24,
|
||||
minHeight: 280,
|
||||
background: colorBgLayout,
|
||||
|
||||
@@ -4,19 +4,19 @@ import LoadingDots from "@/app/components/icons/loading-dots";
|
||||
import { signIn } from "next-auth/react";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useState, useEffect } from "react";
|
||||
import { toast } from "sonner";
|
||||
// import { toast } from "sonner";
|
||||
|
||||
export default function LoginButton() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
// Get error message added by next/auth in URL.
|
||||
const searchParams = useSearchParams();
|
||||
const error = searchParams?.get("error");
|
||||
|
||||
useEffect(() => {
|
||||
const errorMessage = Array.isArray(error) ? error.pop() : error;
|
||||
errorMessage && toast.error(errorMessage);
|
||||
}, [error]);
|
||||
// const error = searchParams?.get("error");
|
||||
//
|
||||
// useEffect(() => {
|
||||
// const errorMessage = Array.isArray(error) ? error.pop() : error;
|
||||
// errorMessage && toast.error(errorMessage);
|
||||
// }, [error]);
|
||||
|
||||
return (
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user