2023-02-28 05:03:04 +01:00
|
|
|
import { Button, Modal, ModalTrigger, ActionForm } from 'react-basics';
|
2023-01-25 16:42:46 +01:00
|
|
|
import WebsiteDeleteForm from 'components/pages/settings/websites/WebsiteDeleteForm';
|
|
|
|
import WebsiteResetForm from 'components/pages/settings/websites/WebsiteResetForm';
|
2023-03-22 22:05:55 +01:00
|
|
|
import useMessages from 'hooks/useMessages';
|
2022-12-27 01:57:59 +01:00
|
|
|
|
2023-04-21 17:00:42 +02:00
|
|
|
export function WebsiteData({ websiteId, onSave }) {
|
2023-03-22 22:05:55 +01:00
|
|
|
const { formatMessage, labels, messages } = useMessages();
|
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 (
|
2023-02-28 05:03:04 +01:00
|
|
|
<>
|
|
|
|
<ActionForm
|
|
|
|
label={formatMessage(labels.resetWebsite)}
|
|
|
|
description={formatMessage(messages.resetWebsiteWarning)}
|
|
|
|
>
|
2023-01-28 06:53:13 +01:00
|
|
|
<ModalTrigger>
|
2023-02-28 05:03:04 +01:00
|
|
|
<Button variant="secondary">{formatMessage(labels.reset)}</Button>
|
2023-01-28 06:53:13 +01:00
|
|
|
<Modal title={formatMessage(labels.resetWebsite)}>
|
|
|
|
{close => (
|
|
|
|
<WebsiteResetForm websiteId={websiteId} onSave={handleReset} onClose={close} />
|
|
|
|
)}
|
|
|
|
</Modal>
|
|
|
|
</ModalTrigger>
|
2023-02-28 05:03:04 +01:00
|
|
|
</ActionForm>
|
|
|
|
<ActionForm
|
|
|
|
label={formatMessage(labels.deleteWebsite)}
|
|
|
|
description={formatMessage(messages.deleteWebsiteWarning)}
|
|
|
|
>
|
2023-01-28 06:53:13 +01:00
|
|
|
<ModalTrigger>
|
2023-04-18 16:35:45 +02:00
|
|
|
<Button variant="danger">{formatMessage(labels.delete)}</Button>
|
2023-01-28 06:53:13 +01:00
|
|
|
<Modal title={formatMessage(labels.deleteWebsite)}>
|
|
|
|
{close => (
|
|
|
|
<WebsiteDeleteForm websiteId={websiteId} onSave={handleDelete} onClose={close} />
|
|
|
|
)}
|
|
|
|
</Modal>
|
|
|
|
</ModalTrigger>
|
2023-02-28 05:03:04 +01:00
|
|
|
</ActionForm>
|
|
|
|
</>
|
2022-12-27 01:57:59 +01:00
|
|
|
);
|
|
|
|
}
|
2023-04-21 17:00:42 +02:00
|
|
|
|
|
|
|
export default WebsiteData;
|