mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
import React, { useState } from 'react';
|
|
import { useSelector } from 'react-redux';
|
|
import PageHeader from 'components/layout/PageHeader';
|
|
import Button from 'components/common/Button';
|
|
import ChangePasswordForm from './forms/ChangePasswordForm';
|
|
import Modal from 'components/common/Modal';
|
|
|
|
export default function ProfileSettings() {
|
|
const user = useSelector(state => state.user);
|
|
const [changePassword, setChangePassword] = useState(false);
|
|
const { user_id } = user;
|
|
|
|
return (
|
|
<>
|
|
<PageHeader>
|
|
<div>Profile</div>
|
|
<Button size="small" onClick={() => setChangePassword(true)}>
|
|
Change password
|
|
</Button>
|
|
</PageHeader>
|
|
<dl>
|
|
<dt>Username</dt>
|
|
<dd>{user.username}</dd>
|
|
</dl>
|
|
{changePassword && (
|
|
<Modal title="Change password">
|
|
<ChangePasswordForm
|
|
values={{ user_id }}
|
|
onSave={() => setChangePassword(false)}
|
|
onClose={() => setChangePassword(false)}
|
|
/>
|
|
</Modal>
|
|
)}
|
|
</>
|
|
);
|
|
}
|