feat(client-Header): add userEdit on header

This commit is contained in:
Vladislav Syrochkin 2025-06-26 15:26:49 +05:00
parent 692461e266
commit 7127d88524
2 changed files with 21 additions and 1 deletions

View File

@ -11,7 +11,7 @@ interface ContentDrawerProps {
type: 'create' | 'edit';
login?: string;
name?: string;
email?: string;
email?: string | null;
}
export default function ContentDrawer({

View File

@ -1,6 +1,9 @@
import { useUserSelector } from '@/store/userStore';
import { Avatar } from 'antd';
import Title from 'antd/es/typography/Title';
import { useState } from 'react';
import ContentDrawer from './ContentDrawer';
import UserEdit from './UserEdit';
interface HeaderProps {
title: string;
@ -8,6 +11,12 @@ interface HeaderProps {
}
export default function Header({ title, additionalContent }: HeaderProps) {
const [openEdit, setOpenEdit] = useState(false);
const showEditDrawer = () => setOpenEdit(true);
const closeEditDrawer = () => {
setOpenEdit(false);
};
const user = useUserSelector();
return (
<div
@ -45,6 +54,7 @@ export default function Header({ title, additionalContent }: HeaderProps) {
alignItems: 'center',
justifyContent: 'center',
}}
onClick={showEditDrawer}
>
<Avatar
size={25.77}
@ -52,6 +62,16 @@ export default function Header({ title, additionalContent }: HeaderProps) {
/>
</div>
</div>
<ContentDrawer
login={user?.login}
name={user?.name}
email={user?.email}
open={openEdit}
closeDrawer={closeEditDrawer}
type="edit"
>
{user?.id && <UserEdit userId={user?.id} />}
</ContentDrawer>
</div>
);
}