strapi-plugin-config-sync/admin/src/components/FirstExport/index.jsx

36 lines
1.2 KiB
React
Raw Normal View History

2021-03-24 22:03:30 +01:00
import React, { useState } from 'react';
2023-10-15 03:53:57 +02:00
import { useIntl } from 'react-intl';
2021-03-24 22:03:30 +01:00
import { useDispatch } from 'react-redux';
2024-05-08 20:46:09 +02:00
import { getFetchClient, useNotification } from '@strapi/strapi/admin';
2024-04-03 20:55:53 +02:00
import { Button, EmptyStateLayout } from '@strapi/design-system';
2024-05-08 19:51:35 +02:00
import { EmptyDocuments } from '@strapi/icons';
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';
const FirstExport = () => {
2024-05-08 20:46:09 +02:00
const { post, get } = getFetchClient();
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"
2024-05-08 20:46:09 +02:00
onSubmit={() => dispatch(exportAllConfig([], toggleNotification, formatMessage, post, get))}
2021-03-24 22:03:30 +01:00
/>
2024-04-03 20:55:53 +02:00
<EmptyStateLayout
content={formatMessage({ id: 'config-sync.FirstExport.Message' })}
2023-10-11 20:46:51 +02:00
action={<Button onClick={() => setModalIsOpen(true)}>{formatMessage({ id: 'config-sync.FirstExport.Button' })}</Button>}
icon={<EmptyDocuments width={160} />}
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;