MSP-3104 create ProfilePage
This commit is contained in:
1 parent
d7095f67f1
commit
903ca9f67e
3 files changed
+83
-1
No files matched your search
@@ -0,0 +1,58 @@
|
|||||||
|
import { Button, Descriptions } from 'antd'
|
||||||
|
import { useState } from 'react'
|
||||||
|
|
||||||
|
import PermissionList from '@widgets/PermissionList'
|
||||||
|
|
||||||
|
import ChangePasswordModal from '@components/ChangePasswordModal'
|
||||||
|
import RoleList from '@components/RoleList'
|
||||||
|
|
||||||
|
import { useAppSelector } from '@hooks/redux.ts'
|
||||||
|
import useLogout from '@hooks/useLogout.tsx'
|
||||||
|
|
||||||
|
import './profile-page.scss'
|
||||||
|
|
||||||
|
|
||||||
|
const ProfilePage = () => {
|
||||||
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false)
|
||||||
|
const { profile } = useAppSelector((state) => state.profileReducer)
|
||||||
|
const { logoutUser, isLoading } = useLogout()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="profile-page">
|
||||||
|
<ChangePasswordModal
|
||||||
|
onClose={() => setIsModalOpen(false)}
|
||||||
|
open={isModalOpen}
|
||||||
|
/>
|
||||||
|
<h1 className="profile-page__title">{`${profile.lastName} ${profile.firstName}`}</h1>
|
||||||
|
<div className="profile-page__user-info">
|
||||||
|
<div className="profile-page__user-info__email-wrapper">
|
||||||
|
<Descriptions>
|
||||||
|
<Descriptions.Item label="Email">{profile.email}</Descriptions.Item>
|
||||||
|
</Descriptions>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<RoleList userRoles={profile.roles} />
|
||||||
|
<PermissionList permissions={profile.permissions} />
|
||||||
|
<div className="profile-page__actions">
|
||||||
|
<Button
|
||||||
|
loading={isLoading}
|
||||||
|
disabled={isLoading}
|
||||||
|
className="profile-page__actions__exit-btn"
|
||||||
|
type="primary"
|
||||||
|
onClick={logoutUser}
|
||||||
|
>
|
||||||
|
Выход
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
className="profile-page__actions__change-pass-btn"
|
||||||
|
type="primary"
|
||||||
|
onClick={() => setIsModalOpen(true)}
|
||||||
|
>
|
||||||
|
Сменить пароль
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProfilePage
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
@import '../../constants/style/styleConst';
|
||||||
|
|
||||||
|
.profile-page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: start;
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: $text-size-header1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__user-info {
|
||||||
|
margin-top: $basic-padding;
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-size: $text-size !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__actions {
|
||||||
|
display: flex;
|
||||||
|
gap: $basic-margin
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { StateProfileStatus } from '../stores/redusers/ProfileSlice.ts'
|
import { StateProfileStatus } from '@stores/redusers/ProfileSlice.ts'
|
||||||
|
|
||||||
export type ProfileDataType = {
|
export type ProfileDataType = {
|
||||||
email: string
|
email: string
|
||||||
Reference in new issue
Block a user