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
78ed4f1cbb
commit
8d83e8ad16
39
app/app/(admin)/admin/page.tsx
Normal file
39
app/app/(admin)/admin/page.tsx
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
"use client";
|
||||||
|
import { Grid, Col, Card, Text, AreaChart, Metric } from "@tremor/react";
|
||||||
|
|
||||||
|
export default function AdminPage() {
|
||||||
|
return (
|
||||||
|
<Grid numItems={1} numItemsSm={2} numItemsLg={3} className="gap-2">
|
||||||
|
<Col numColSpan={1} numColSpanLg={2}>
|
||||||
|
<Card>
|
||||||
|
<Text>Title</Text>
|
||||||
|
{/*<AreaChart*/}
|
||||||
|
{/* className="mt-6 h-28"*/}
|
||||||
|
{/* data={data}*/}
|
||||||
|
{/* index="Month"*/}
|
||||||
|
{/* valueFormatter={(number: number) =>*/}
|
||||||
|
{/* `${Intl.NumberFormat("us").format(number).toString()}`*/}
|
||||||
|
{/* }*/}
|
||||||
|
{/* categories={["Total Visitors"]}*/}
|
||||||
|
{/* colors={["blue"]}*/}
|
||||||
|
{/* showXAxis={true}*/}
|
||||||
|
{/* showGridLines={false}*/}
|
||||||
|
{/* startEndOnly={true}*/}
|
||||||
|
{/* showYAxis={false}*/}
|
||||||
|
{/* showLegend={false}*/}
|
||||||
|
{/*/>*/}
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
<Card>
|
||||||
|
<Text>Title</Text>
|
||||||
|
<Metric>KPI 2</Metric>
|
||||||
|
</Card>
|
||||||
|
<Col>
|
||||||
|
<Card>
|
||||||
|
<Text>Title</Text>
|
||||||
|
<Metric>KPI 3</Metric>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
24
app/app/(admin)/layout.tsx
Normal file
24
app/app/(admin)/layout.tsx
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import "@/app/app/login.scss";
|
||||||
|
import { Metadata } from "next";
|
||||||
|
import { ReactNode } from "react";
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
title: "Admin | 管理页面",
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function AdminLayout({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className="flex max-w-screen-xl flex-col space-y-12 p-8">
|
||||||
|
<div className="flex flex-col space-y-6">
|
||||||
|
<h1 className="font-cal text-3xl font-bold dark:text-white">
|
||||||
|
Admin Page
|
||||||
|
</h1>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import "@/app/styles/login.scss";
|
import "@/app/app/login.scss";
|
||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
// import { useEffect } from "react";
|
// import { useEffect } from "react";
|
||||||
|
@ -29,6 +29,11 @@ export default async function middleware(req: NextRequest) {
|
|||||||
new URL(`/app${path}`, req.url),
|
new URL(`/app${path}`, req.url),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (path == "/admin") {
|
||||||
|
return NextResponse.rewrite(
|
||||||
|
new URL(`/app${path}`, req.url),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (req.method == 'POST' && (path.startsWith("/api/openai/") || path.startsWith("/api/midjourney"))) {
|
if (req.method == 'POST' && (path.startsWith("/api/openai/") || path.startsWith("/api/midjourney"))) {
|
||||||
// 重写header,添加用户名
|
// 重写header,添加用户名
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
"@next-auth/prisma-adapter": "^1.0.7",
|
"@next-auth/prisma-adapter": "^1.0.7",
|
||||||
"@prisma/client": "^5.7.0",
|
"@prisma/client": "^5.7.0",
|
||||||
"@svgr/webpack": "^8.1.0",
|
"@svgr/webpack": "^8.1.0",
|
||||||
|
"@tremor/react": "^3.12.1",
|
||||||
"@vercel/analytics": "^1.1.1",
|
"@vercel/analytics": "^1.1.1",
|
||||||
"emoji-picker-react": "^4.5.15",
|
"emoji-picker-react": "^4.5.15",
|
||||||
"fuse.js": "^7.0.0",
|
"fuse.js": "^7.0.0",
|
||||||
|
@ -5,6 +5,7 @@ module.exports = {
|
|||||||
content: [
|
content: [
|
||||||
// "./app/**/*.{js,ts,jsx,tsx,mdx}",
|
// "./app/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
"./app/app/**/*.{js,ts,jsx,tsx,mdx}",
|
"./app/app/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
"./node_modules/@tremor/**/*.{js,ts,jsx,tsx}", // Tremor module
|
||||||
],
|
],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
|
Loading…
Reference in New Issue
Block a user