feat(layout): username
This commit is contained in:
@@ -11,20 +11,14 @@ import {
|
|||||||
ScrollArea,
|
ScrollArea,
|
||||||
Space,
|
Space,
|
||||||
Stack,
|
Stack,
|
||||||
|
Text,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
UnstyledButton,
|
UnstyledButton,
|
||||||
useComputedColorScheme,
|
useComputedColorScheme,
|
||||||
useMantineColorScheme,
|
useMantineColorScheme,
|
||||||
} from "@mantine/core"
|
} from "@mantine/core"
|
||||||
import { useDisclosure, useMediaQuery } from "@mantine/hooks"
|
import { useDisclosure, useMediaQuery } from "@mantine/hooks"
|
||||||
import {
|
import { IconLogout, IconMoon, IconSun, IconUser } from "@tabler/icons-react"
|
||||||
IconLogout,
|
|
||||||
IconMessageCircle,
|
|
||||||
IconMoon,
|
|
||||||
IconSettings,
|
|
||||||
IconSun,
|
|
||||||
IconUser,
|
|
||||||
} from "@tabler/icons-react"
|
|
||||||
import cx from "clsx"
|
import cx from "clsx"
|
||||||
import { Suspense, useEffect, useMemo, useState } from "react"
|
import { Suspense, useEffect, useMemo, useState } from "react"
|
||||||
import actionToggleClasses from "./ActionToggle.module.css"
|
import actionToggleClasses from "./ActionToggle.module.css"
|
||||||
@@ -32,6 +26,7 @@ import headerLinkClasses from "./HeaderLink.module.css"
|
|||||||
|
|
||||||
import { useUserStore } from "@/app/store/user"
|
import { useUserStore } from "@/app/store/user"
|
||||||
import { usePathname, useRouter } from "next/navigation"
|
import { usePathname, useRouter } from "next/navigation"
|
||||||
|
import { usePermissionStore } from "../label/store/auth"
|
||||||
import { deleteCookie } from "../login/api"
|
import { deleteCookie } from "../login/api"
|
||||||
import { MenuItem, withoutLayoutRoutes } from "./common"
|
import { MenuItem, withoutLayoutRoutes } from "./common"
|
||||||
import { ClientIcon } from "./components/ClientIcon"
|
import { ClientIcon } from "./components/ClientIcon"
|
||||||
@@ -147,6 +142,7 @@ export default function AppLayout({
|
|||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
const matches = useMediaQuery("(min-width: 48em)")
|
const matches = useMediaQuery("(min-width: 48em)")
|
||||||
|
const userName = usePermissionStore((s) => s.user_name)
|
||||||
|
|
||||||
return isClient ? (
|
return isClient ? (
|
||||||
withoutLayout ? (
|
withoutLayout ? (
|
||||||
@@ -199,7 +195,7 @@ export default function AppLayout({
|
|||||||
/>
|
/>
|
||||||
</UnstyledButton>
|
</UnstyledButton>
|
||||||
<Divider orientation="vertical" mx={"0.5rem"} display="none" />
|
<Divider orientation="vertical" mx={"0.5rem"} display="none" />
|
||||||
<Menu shadow="md" width={200}>
|
<Menu shadow="md" width={220}>
|
||||||
<Menu.Target>
|
<Menu.Target>
|
||||||
<UnstyledButton>
|
<UnstyledButton>
|
||||||
<IconUser
|
<IconUser
|
||||||
@@ -210,13 +206,12 @@ export default function AppLayout({
|
|||||||
</UnstyledButton>
|
</UnstyledButton>
|
||||||
</Menu.Target>
|
</Menu.Target>
|
||||||
<Menu.Dropdown>
|
<Menu.Dropdown>
|
||||||
<Menu.Label>个人信息</Menu.Label>
|
<Menu.Label>用户信息</Menu.Label>
|
||||||
<Menu.Item leftSection={<IconSettings size={14} />}>
|
<Box px="sm" py={4}>
|
||||||
设置
|
<Text size="sm" fw={500} style={{ wordBreak: "break-all" }}>
|
||||||
</Menu.Item>
|
{userName || "-"}
|
||||||
<Menu.Item leftSection={<IconMessageCircle size={14} />}>
|
</Text>
|
||||||
通知
|
</Box>
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Divider />
|
<Menu.Divider />
|
||||||
<Menu.Label>操作</Menu.Label>
|
<Menu.Label>操作</Menu.Label>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
|
|||||||
Reference in New Issue
Block a user