From b9c783cee1ea7fc4f8c587915e2999cdfb64edd3 Mon Sep 17 00:00:00 2001 From: bipproduction Date: Tue, 7 Oct 2025 16:51:02 +0800 Subject: [PATCH] ok --- package.json | 3 +- src/pages/dashboard/dashboard_layout.tsx | 252 ++++++++++++----------- 2 files changed, 137 insertions(+), 118 deletions(-) diff --git a/package.json b/package.json index a54a0d5..0d1368b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "bun --hot src/index.tsx", "build": "bun build ./src/index.html --outdir=dist --sourcemap --target=browser --minify --define:process.env.NODE_ENV='\"production\"' --env='BUN_PUBLIC_*'", - "start": "NODE_ENV=production bun src/index.tsx" + "start": "NODE_ENV=production bun src/index.tsx", + "seed": "bun prisma/seed.ts" }, "dependencies": { "@elysiajs/cors": "^1.4.0", diff --git a/src/pages/dashboard/dashboard_layout.tsx b/src/pages/dashboard/dashboard_layout.tsx index c88428e..f043030 100644 --- a/src/pages/dashboard/dashboard_layout.tsx +++ b/src/pages/dashboard/dashboard_layout.tsx @@ -4,7 +4,9 @@ import { ActionIcon, AppShell, Avatar, + Button, Card, + Divider, Flex, Group, NavLink, @@ -22,142 +24,158 @@ import { IconDashboard } from '@tabler/icons-react' import type { User } from 'generated/prisma' -import { data, Outlet, useLocation, useNavigate } from 'react-router-dom' +import { Outlet, useLocation, useNavigate } from 'react-router-dom' import { default as clientRoute, default as clientRoutes } from '@/clientRoutes' import apiFetch from '@/lib/apiFetch' -import { showNotification } from '@mantine/notifications' + + +function Logout() { + return + + +} + export default function DashboardLayout() { - const [opened, setOpened] = useLocalStorage({ - key: 'nav_open', - defaultValue: true, - }) + const [opened, setOpened] = useLocalStorage({ + key: 'nav_open', + defaultValue: true, + }) - return ( - - - - - - setOpened(v => !v)} - aria-label="Toggle navigation" - radius="xl" - > - {opened ? : } - - - - + return ( + + + + + + setOpened(v => !v)} + aria-label="Toggle navigation" + radius="xl" + > + {opened ? : } + + + + - - - + + + - - - - + + + + - - - - - {!opened && ( - - setOpened(true)} - aria-label="Open navigation" - radius="xl" - > - - - - )} - - App Dashboard - - - - - - - - ) + + + + + {!opened && ( + + setOpened(true)} + aria-label="Open navigation" + radius="xl" + > + + + + )} + + App Dashboard + + + + + + + + ) } /* ----------------------- Host Info ----------------------- */ function HostView() { - const [host, setHost] = useState(null) + const [host, setHost] = useState(null) - useEffect(() => { - async function fetchHost() { - const {data} = await apiFetch.api.user.find.get() - setHost(data?.user ?? null) - } - fetchHost() - }, []) + useEffect(() => { + async function fetchHost() { + const { data } = await apiFetch.api.user.find.get() + setHost(data?.user ?? null) + } + fetchHost() + }, []) - return ( - - {host ? ( - - - {host.name?.[0]} - - - {host.name} - {host.email} - - - ) : ( - - No host information available - - )} - - ) + return ( + + {host ? ( + + + + {host.name?.[0]} + + + {host.name} + {host.email} + + + + + + ) : ( + + No host information available + + )} + + ) } + /* ----------------------- Navigation ----------------------- */ function NavigationDashboard() { - const navigate = useNavigate() - const location = useLocation() + const navigate = useNavigate() + const location = useLocation() - const isActive = (path: keyof typeof clientRoute) => - location.pathname.startsWith(clientRoute[path]) + const isActive = (path: keyof typeof clientRoute) => + location.pathname.startsWith(clientRoute[path]) - return ( - - } - label="Dashboard Overview" - description="Quick summary and activity highlights" - onClick={() => navigate(clientRoutes['/dashboard/landing'])} - /> - } - label="Dashboard Overview" - description="Quick summary and activity highlights" - onClick={() => navigate(clientRoutes['/dashboard/apikey'])} - /> - - ) + return ( + + } + label="Dashboard Overview" + description="Quick summary and activity highlights" + onClick={() => navigate(clientRoutes['/dashboard/landing'])} + /> + } + label="Dashboard Overview" + description="Quick summary and activity highlights" + onClick={() => navigate(clientRoutes['/dashboard/apikey'])} + /> + + ) }