2020-08-09 08:48:43 +02:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
2020-08-12 07:24:41 +02:00
|
|
|
import PageHeader from 'components/layout/PageHeader';
|
|
|
|
import Button from 'components/common/Button';
|
2020-08-09 08:48:43 +02:00
|
|
|
import ChangePasswordForm from './forms/ChangePasswordForm';
|
2020-08-12 07:24:41 +02:00
|
|
|
import Modal from 'components/common/Modal';
|
2020-08-15 10:17:15 +02:00
|
|
|
import Dots from 'assets/ellipsis-h.svg';
|
2020-08-09 08:48:43 +02:00
|
|
|
|
|
|
|
export default function ProfileSettings() {
|
|
|
|
const user = useSelector(state => state.user);
|
|
|
|
const [changePassword, setChangePassword] = useState(false);
|
2020-08-09 11:03:37 +02:00
|
|
|
const { user_id } = user;
|
2020-08-09 08:48:43 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<PageHeader>
|
|
|
|
<div>Profile</div>
|
2020-08-15 10:17:15 +02:00
|
|
|
<Button icon={<Dots />} size="small" onClick={() => setChangePassword(true)}>
|
|
|
|
<div>Change password</div>
|
2020-08-09 08:48:43 +02:00
|
|
|
</Button>
|
|
|
|
</PageHeader>
|
2020-08-09 11:03:37 +02:00
|
|
|
<dl>
|
|
|
|
<dt>Username</dt>
|
|
|
|
<dd>{user.username}</dd>
|
|
|
|
</dl>
|
2020-08-09 08:48:43 +02:00
|
|
|
{changePassword && (
|
|
|
|
<Modal title="Change password">
|
2020-08-09 11:03:37 +02:00
|
|
|
<ChangePasswordForm
|
|
|
|
values={{ user_id }}
|
|
|
|
onSave={() => setChangePassword(false)}
|
|
|
|
onClose={() => setChangePassword(false)}
|
|
|
|
/>
|
2020-08-09 08:48:43 +02:00
|
|
|
</Modal>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|