mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-19 07:23:46 +08:00
整体优化认证
This commit is contained in:
@@ -1,18 +1,9 @@
|
||||
import UsageByModel from "./usage-by-model-chart";
|
||||
import UserByMap from "./user-by-map";
|
||||
// import { getSession } from "@/lib/auth";
|
||||
// import { isName, ADMIN_LIST } from "@/lib/auth_list";
|
||||
// import { redirect } from "next/navigation";
|
||||
|
||||
import { Flex } from "antd";
|
||||
|
||||
export default async function AdminPage() {
|
||||
// const session = await getSession();
|
||||
// const name = session?.user?.email || session?.user?.name;
|
||||
// if (!(name && ADMIN_LIST.includes(name))) {
|
||||
// // Replace '/dashboard' with the desired redirect path
|
||||
// redirect("/");
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex gap="middle" vertical>
|
||||
|
||||
@@ -9,9 +9,8 @@ import React, {
|
||||
} from "react";
|
||||
|
||||
import * as echarts from "echarts";
|
||||
// import { DatePicker } from "@tremor/react";
|
||||
import { DatePicker } from "antd";
|
||||
import { Col, Row } from "antd";
|
||||
import { Row } from "antd";
|
||||
|
||||
import locale from "antd/es/date-picker/locale/zh_CN";
|
||||
import "dayjs/locale/zh-cn";
|
||||
@@ -21,10 +20,6 @@ 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>>;
|
||||
|
||||
@@ -11,10 +11,7 @@ import React, {
|
||||
import Script from "next/script";
|
||||
|
||||
import * as echarts from "echarts";
|
||||
// var echarts = require('echarts');
|
||||
import "echarts/extension/bmap/bmap";
|
||||
// require("echarts");
|
||||
// require("echarts/extension/bmap/bmap");
|
||||
|
||||
interface DataItem {
|
||||
name: string;
|
||||
|
||||
@@ -4,13 +4,7 @@ import { useSession } from "next-auth/react";
|
||||
import { redirect } from "next/navigation";
|
||||
import { ADMIN_LIST } from "@/lib/auth_list";
|
||||
import React, { ReactNode, useEffect, useState } from "react";
|
||||
import {
|
||||
MenuFoldOutlined,
|
||||
MenuUnfoldOutlined,
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons";
|
||||
import { Layout, Menu, Button, theme, ConfigProvider, ThemeConfig } from "antd";
|
||||
import SideBar from "../components/sidebar";
|
||||
|
||||
|
||||
@@ -1,20 +1,7 @@
|
||||
import { Flex } from "antd";
|
||||
import prisma from "@/lib/prisma";
|
||||
import { User } from "@prisma/client";
|
||||
import UsersTablePart from "../../components/users-table";
|
||||
|
||||
// async function getData() {
|
||||
// return await prisma.user.findMany({
|
||||
// orderBy: {
|
||||
// createdAt: "desc",
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
export default async function UsersPage() {
|
||||
// const users: User[] = await getData();
|
||||
|
||||
// console.log("data", data);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex gap="middle" vertical>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
// import Link from "next/link";
|
||||
import { useRouter, usePathname } from "next/navigation";
|
||||
|
||||
import {
|
||||
AppstoreOutlined,
|
||||
MailOutlined,
|
||||
SettingOutlined,
|
||||
DashboardTwoTone,
|
||||
// MailOutlined,
|
||||
// SettingOutlined,
|
||||
// DashboardTwoTone,
|
||||
} from "@ant-design/icons";
|
||||
import type { MenuProps, MenuTheme } from "antd";
|
||||
import { Menu, Switch } from "antd";
|
||||
import { Menu } from "antd";
|
||||
|
||||
type MenuItem = Required<MenuProps>["items"][number];
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React, {
|
||||
Dispatch,
|
||||
SetStateAction,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import React, { Dispatch, SetStateAction, useEffect, useState } from "react";
|
||||
import { User } from "@prisma/client";
|
||||
import { Space, Table, Tag, Input, Button, notification } from "antd";
|
||||
import type { GetRef, TableColumnsType } from "antd";
|
||||
|
||||
@@ -3,20 +3,13 @@
|
||||
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 { useState } from "react";
|
||||
|
||||
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]);
|
||||
|
||||
return (
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user