2023-01-28 06:53:13 +01:00
|
|
|
import { Button, Form, FormRow, Modal, ModalTrigger } from 'react-basics';
|
2023-01-25 16:42:46 +01:00
|
|
|
import { useIntl } from 'react-intl';
|
|
|
|
import WebsiteDeleteForm from 'components/pages/settings/websites/WebsiteDeleteForm';
|
|
|
|
import WebsiteResetForm from 'components/pages/settings/websites/WebsiteResetForm';
|
|
|
|
import { labels, messages } from 'components/messages';
|
2022-12-27 01:57:59 +01:00
|
|
|
|
|
|
|
export default function WebsiteReset({ websiteId, onSave }) {
|
2023-01-25 16:42:46 +01:00
|
|
|
const { formatMessage } = useIntl();
|
2022-12-27 01:57:59 +01:00
|
|
|
|
|
|
|
const handleReset = async () => {
|
2023-01-28 06:53:13 +01:00
|
|
|
onSave('reset');
|
2022-12-27 01:57:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleDelete = async () => {
|
2023-01-28 06:53:13 +01:00
|
|
|
onSave('delete');
|
2022-12-27 01:57:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Form>
|
2023-01-25 16:42:46 +01:00
|
|
|
<FormRow label={formatMessage(labels.resetWebsite)}>
|
|
|
|
<p>{formatMessage(messages.resetWebsiteWarning)}</p>
|
2023-01-28 06:53:13 +01:00
|
|
|
<ModalTrigger>
|
|
|
|
<Button>{formatMessage(labels.reset)}</Button>
|
|
|
|
<Modal title={formatMessage(labels.resetWebsite)}>
|
|
|
|
{close => (
|
|
|
|
<WebsiteResetForm websiteId={websiteId} onSave={handleReset} onClose={close} />
|
|
|
|
)}
|
|
|
|
</Modal>
|
|
|
|
</ModalTrigger>
|
2022-12-27 01:57:59 +01:00
|
|
|
</FormRow>
|
2023-01-25 16:42:46 +01:00
|
|
|
<FormRow label={formatMessage(labels.deleteWebsite)}>
|
|
|
|
<p>{formatMessage(messages.deleteWebsiteWarning)}</p>
|
2023-01-28 06:53:13 +01:00
|
|
|
<ModalTrigger>
|
|
|
|
<Button>Delete</Button>
|
|
|
|
<Modal title={formatMessage(labels.deleteWebsite)}>
|
|
|
|
{close => (
|
|
|
|
<WebsiteDeleteForm websiteId={websiteId} onSave={handleDelete} onClose={close} />
|
|
|
|
)}
|
|
|
|
</Modal>
|
|
|
|
</ModalTrigger>
|
2022-12-27 01:57:59 +01:00
|
|
|
</FormRow>
|
|
|
|
</Form>
|
|
|
|
);
|
|
|
|
}
|