2022-12-27 01:57:59 +01:00
|
|
|
import Page from 'components/layout/Page';
|
|
|
|
import PageHeader from 'components/layout/PageHeader';
|
|
|
|
import ProfileDetails from 'components/settings/ProfileDetails';
|
|
|
|
import { useState } from 'react';
|
2022-12-28 21:56:22 +01:00
|
|
|
import { Breadcrumbs, Icon, Item, Tabs, useToast, Modal, Button } from 'react-basics';
|
2022-12-27 01:57:59 +01:00
|
|
|
import UserPasswordForm from 'components/forms/UserPasswordForm';
|
2022-12-28 21:37:09 +01:00
|
|
|
import Pen from 'assets/pen.svg';
|
2022-12-27 01:57:59 +01:00
|
|
|
|
|
|
|
export default function ProfileSettings() {
|
2022-12-28 21:37:09 +01:00
|
|
|
const [edit, setEdit] = useState(false);
|
2022-12-27 01:57:59 +01:00
|
|
|
const [tab, setTab] = useState('general');
|
|
|
|
const { toast, showToast } = useToast();
|
|
|
|
|
|
|
|
const handleSave = () => {
|
|
|
|
showToast({ message: 'Saved successfully.', variant: 'success' });
|
2022-12-28 21:37:09 +01:00
|
|
|
setEdit(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleAdd = () => {
|
|
|
|
setEdit(true);
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleClose = () => {
|
|
|
|
setEdit(false);
|
2022-12-27 01:57:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Page>
|
|
|
|
{toast}
|
|
|
|
<PageHeader>
|
|
|
|
<Breadcrumbs>
|
|
|
|
<Item>Profile</Item>
|
|
|
|
</Breadcrumbs>
|
2022-12-28 21:37:09 +01:00
|
|
|
<Button onClick={handleAdd}>
|
|
|
|
<Icon>
|
|
|
|
<Pen />
|
|
|
|
</Icon>
|
|
|
|
Change Password
|
|
|
|
</Button>
|
2022-12-27 01:57:59 +01:00
|
|
|
</PageHeader>
|
|
|
|
<Tabs selectedKey={tab} onSelect={setTab} style={{ marginBottom: 30, fontSize: 14 }}>
|
|
|
|
<Item key="general">General</Item>
|
|
|
|
</Tabs>
|
|
|
|
{tab === 'general' && <ProfileDetails />}
|
2022-12-28 21:37:09 +01:00
|
|
|
{edit && (
|
|
|
|
<Modal title="Add website" onClose={handleClose}>
|
|
|
|
{close => <UserPasswordForm onSave={handleSave} onClose={close} />}
|
|
|
|
</Modal>
|
|
|
|
)}
|
2022-12-27 01:57:59 +01:00
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
}
|