创建账户信息组件
This commit is contained in:
@@ -33,6 +33,7 @@ import { useRouter } from "next/navigation"
|
||||
import SetPassword from "./nav-user/SetPassword"
|
||||
import { useState } from "react"
|
||||
import { User } from "@/lib/types/user"
|
||||
import UserProfile from "./nav-user/UserProfile"
|
||||
|
||||
export function NavUser({ user, isUserLoading }: { user: User | undefined, isUserLoading: boolean }) {
|
||||
const { isMobile } = useSidebar();
|
||||
@@ -50,6 +51,7 @@ export function NavUser({ user, isUserLoading }: { user: User | undefined, isUse
|
||||
}
|
||||
}
|
||||
|
||||
const [userProfileOpen, setUserProfileOpen] = useState(false);
|
||||
const [passwordOpen, setPasswordOpen] = useState(false);
|
||||
|
||||
return (
|
||||
@@ -117,11 +119,11 @@ export function NavUser({ user, isUserLoading }: { user: User | undefined, isUse
|
||||
}
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setTimeout(() => setUserProfileOpen(true), 0)}>
|
||||
<UserRoundCog />
|
||||
账户信息
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setTimeout(() => { setPasswordOpen(true) }, 0)}>
|
||||
<DropdownMenuItem onClick={() => setTimeout(() => setPasswordOpen(true), 0)}>
|
||||
<KeyRound />
|
||||
修改密码
|
||||
</DropdownMenuItem>
|
||||
@@ -135,6 +137,7 @@ export function NavUser({ user, isUserLoading }: { user: User | undefined, isUse
|
||||
</SidebarMenuItem>
|
||||
</SidebarMenu >
|
||||
|
||||
<UserProfile open={userProfileOpen} onOpenChange={setUserProfileOpen} />
|
||||
<SetPassword open={passwordOpen} onOpenChange={setPasswordOpen} />
|
||||
</>
|
||||
)
|
||||
|
||||
38
tone-page-web/components/nav-user/UserProfile.tsx
Normal file
38
tone-page-web/components/nav-user/UserProfile.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import { DialogProps } from "@radix-ui/react-dialog";
|
||||
import React, { FC } from "react";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog"
|
||||
import { Button } from "../ui/button";
|
||||
|
||||
interface UserProfileProps {
|
||||
|
||||
}
|
||||
|
||||
export default function ({ onOpenChange, ...props }: UserProfileProps & React.ComponentProps<FC<DialogProps>>) {
|
||||
return (
|
||||
<Dialog onOpenChange={onOpenChange} {...props}>
|
||||
<DialogContent className="sm:max-w-[425px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle>账户信息</DialogTitle>
|
||||
<DialogDescription>
|
||||
新密码长度在6-32位之间,且至少包含一个字母和一个数字,可以包含特殊字符
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div>
|
||||
开发中...
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" variant='secondary' onClick={() => onOpenChange?.(false)}>返回</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog >
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user