diff --git a/frontend/src/Route.tsx b/frontend/src/Route.tsx
index 78d15b4..1ce1a22 100644
--- a/frontend/src/Route.tsx
+++ b/frontend/src/Route.tsx
@@ -1,23 +1,24 @@
-import { Routes, Route, Outlet, createBrowserRouter, RouterProvider } from "react-router-dom";
+import { Routes, Route, createBrowserRouter, RouterProvider } from "react-router-dom";
import { ScrollRestoration } from "react-router-dom";
import Login from '@/views/Login'
import Register from '@/views/Register'
import User from '@/views/User'
+import Layout from '@/views/Layout'
const router = createBrowserRouter([
{ path: "*", Component: Root },
-]);
+])
function Root() {
return (
<>
}>
- } />
-
+ } />
+ } />
+ }>
+
- } />
- } />
>
@@ -28,17 +29,9 @@ function Root() {
export function PageRoute() {
return (
<>
- ;
+
>
)
}
-function Layout() {
- return (
- <>
-
我是头部
-
- >
- )
-}
diff --git a/frontend/src/apis/model.ts b/frontend/src/apis/model.ts
index cee32d3..3c62e73 100644
--- a/frontend/src/apis/model.ts
+++ b/frontend/src/apis/model.ts
@@ -2,6 +2,7 @@ export interface tokenData {
accessToken: string
selectedProfile: {
name: string
+ uuid: string
}
}
diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx
index c308be8..30c9a76 100644
--- a/frontend/src/main.tsx
+++ b/frontend/src/main.tsx
@@ -5,8 +5,7 @@ import CssBaseline from '@mui/material/CssBaseline';
ReactDOM.createRoot(document.getElementById('root')!).render(
-
-
-
+
+
)
diff --git a/frontend/src/store/store.ts b/frontend/src/store/store.ts
index d3fc432..9162eb1 100644
--- a/frontend/src/store/store.ts
+++ b/frontend/src/store/store.ts
@@ -1,4 +1,7 @@
import { atomWithStorage } from 'jotai/utils'
export const token = atomWithStorage("token", "")
-export const username = atomWithStorage("username", "")
\ No newline at end of file
+export const user = atomWithStorage("username", {
+ name: "",
+ uuid: ""
+})
\ No newline at end of file
diff --git a/frontend/src/views/Layout.tsx b/frontend/src/views/Layout.tsx
new file mode 100644
index 0000000..e57ea2f
--- /dev/null
+++ b/frontend/src/views/Layout.tsx
@@ -0,0 +1,153 @@
+import * as React from 'react';
+import { styled, useTheme } from '@mui/material/styles';
+import Box from '@mui/material/Box';
+import Drawer from '@mui/material/Drawer';
+import Toolbar from '@mui/material/Toolbar';
+import List from '@mui/material/List';
+import Divider from '@mui/material/Divider';
+import IconButton from '@mui/material/IconButton';
+import MenuIcon from '@mui/icons-material/Menu';
+import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
+import ChevronRightIcon from '@mui/icons-material/ChevronRight';
+import ListItem from '@mui/material/ListItem';
+import ListItemButton from '@mui/material/ListItemButton';
+import ListItemIcon from '@mui/material/ListItemIcon';
+import ListItemText from '@mui/material/ListItemText';
+import InboxIcon from '@mui/icons-material/MoveToInbox';
+import MailIcon from '@mui/icons-material/Mail';
+import AppBar from '@mui/material/AppBar';
+import { Outlet } from 'react-router-dom';
+import { AccountCircle } from '@mui/icons-material';
+import Menu from '@mui/material/Menu';
+import MenuItem from '@mui/material/MenuItem';
+import { user } from '@/store/store';
+import { useAtom } from 'jotai';
+import Button from '@mui/material/Button';
+import { useNavigate } from "react-router-dom";
+
+
+const drawerWidth = 240;
+
+const DrawerHeader = styled('div')(({ theme }) => ({
+ display: 'flex',
+ alignItems: 'center',
+ padding: theme.spacing(0, 1),
+ // necessary for content to be below app bar
+ ...theme.mixins.toolbar,
+ justifyContent: 'flex-end',
+}));
+
+
+export default function Layout() {
+ const theme = useTheme();
+ const [open, setOpen] = React.useState(false);
+ const [anchorEl, setAnchorEl] = React.useState(null);
+ const [nowUser, setNowUser] = useAtom(user)
+ const navigate = useNavigate();
+
+ const handleLogOut = () => {
+ setAnchorEl(null);
+ setNowUser({ name: "", uuid: "" })
+ };
+
+
+ return (<>
+
+
+
+ setOpen(true)}
+ >
+
+
+
+ {nowUser.name != "" && (
+
+
setAnchorEl(event.currentTarget)}
+ color="inherit"
+ >
+
+
+
+
+ )}
+ {nowUser.name == "" && (
+
+ )}
+
+
+
+
+
+ setOpen(false)}>
+ {theme.direction === 'ltr' ? : }
+
+
+
+
+ {['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) => (
+
+
+
+ {index % 2 === 0 ? : }
+
+
+
+
+ ))}
+
+
+
+ {['All mail', 'Trash', 'Spam'].map((text, index) => (
+
+
+
+ {index % 2 === 0 ? : }
+
+
+
+
+ ))}
+
+
+
+ >)
+}
\ No newline at end of file
diff --git a/frontend/src/views/Login.tsx b/frontend/src/views/Login.tsx
index c83a750..afc8e2c 100644
--- a/frontend/src/views/Login.tsx
+++ b/frontend/src/views/Login.tsx
@@ -12,7 +12,7 @@ import Container from '@mui/material/Container';
import Snackbar from '@mui/material/Snackbar';
import Alert from '@mui/material/Alert';
import { useSetAtom } from 'jotai';
-import { token, username } from '@/store/store'
+import { token, user } from '@/store/store'
import { login } from '@/apis/apis'
import { Link as RouterLink, useNavigate } from "react-router-dom";
import Loading from '@/components/Loading'
@@ -24,7 +24,7 @@ export default function SignIn() {
const [err, setErr] = useState("");
const [loading, setLoading] = useState(false);
const setToken = useSetAtom(token)
- const setUsername = useSetAtom(username)
+ const setUserInfo = useSetAtom(user)
const checkList = React.useRef