2021-03-24 22:03:30 +01:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
import { useDispatch } from 'react-redux';
|
2021-11-20 20:24:57 +01:00
|
|
|
import { NoContent, useNotification } from '@strapi/helper-plugin';
|
2022-11-27 14:35:11 +01:00
|
|
|
import { Button } from '@strapi/design-system';
|
2021-10-14 17:13:12 +02:00
|
|
|
|
2021-03-24 22:03:30 +01:00
|
|
|
import { exportAllConfig } from '../../state/actions/Config';
|
|
|
|
import ConfirmModal from '../ConfirmModal';
|
2023-10-11 20:46:51 +02:00
|
|
|
import { useIntl } from 'react-intl';
|
2021-03-24 22:03:30 +01:00
|
|
|
|
|
|
|
const FirstExport = () => {
|
2021-11-20 20:24:57 +01:00
|
|
|
const toggleNotification = useNotification();
|
2021-03-24 22:03:30 +01:00
|
|
|
const dispatch = useDispatch();
|
|
|
|
const [modalIsOpen, setModalIsOpen] = useState(false);
|
2023-10-11 20:46:51 +02:00
|
|
|
const { formatMessage } = useIntl();
|
2021-03-24 22:03:30 +01:00
|
|
|
|
|
|
|
return (
|
2021-11-13 14:30:16 +01:00
|
|
|
<div>
|
2021-03-24 22:03:30 +01:00
|
|
|
<ConfirmModal
|
|
|
|
isOpen={modalIsOpen}
|
|
|
|
onClose={() => setModalIsOpen(false)}
|
2021-10-14 17:13:12 +02:00
|
|
|
type="export"
|
2021-11-20 20:24:57 +01:00
|
|
|
onSubmit={() => dispatch(exportAllConfig([], toggleNotification))}
|
2021-03-24 22:03:30 +01:00
|
|
|
/>
|
2021-11-13 14:30:16 +01:00
|
|
|
<NoContent
|
|
|
|
content={{
|
|
|
|
id: 'emptyState',
|
|
|
|
defaultMessage:
|
2023-10-11 20:46:51 +02:00
|
|
|
formatMessage({ id: 'config-sync.FirstExport.Message' }),
|
2021-11-13 14:30:16 +01:00
|
|
|
}}
|
2023-10-11 20:46:51 +02:00
|
|
|
action={<Button onClick={() => setModalIsOpen(true)}>{formatMessage({ id: 'config-sync.FirstExport.Button' })}</Button>}
|
2021-11-13 14:30:16 +01:00
|
|
|
/>
|
2021-03-24 22:03:30 +01:00
|
|
|
</div>
|
|
|
|
);
|
2021-10-14 17:13:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default FirstExport;
|