Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Coming Soon Pre publish Modal CSS #40

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/coming-soon.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* Styles.
*/
import './styles/app.scss';

/**
* WordPress dependencies
*/
Expand Down
1 change: 0 additions & 1 deletion src/components/Icons/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/Icons/launch.jsx

This file was deleted.

67 changes: 41 additions & 26 deletions src/components/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,78 @@
/**
* External dependencies
*/
import { useState } from 'react';
import { useState } from '@wordpress/element';

/**
* WordPress dependencies
*/
import { Modal as WP2Modal, Button, Icon } from '@wordpress/components';
import { Modal as WP2Modal, Button } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { useEffect } from '@wordpress/element';
import { store as editPostStore } from '@wordpress/edit-post';
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { launch } from './Icons';
import { store as nfdComingSoonStore } from '../store';
import { setComingSoon } from '../utils/api/comingSoon';


const Modal = () => {
const { setIsModalOpen } = useDispatch(nfdComingSoonStore);
const [isComingSoonActive, setIsComingSoonActive] = useState(true);

const { isModalOpen } = useSelect(
(select) => ({
isModalOpen: select(nfdComingSoonStore).isModalOpen(),
})
);
const { isModalOpen } = useSelect((select) => ({
isModalOpen: select(nfdComingSoonStore).isModalOpen(),
}));

const handlePublishAndLaunch = () => {
setComingSoon(false);
setIsComingSoonActive(false);
window.NewfoldRuntime.comingSoon.disable();
setIsModalOpen(false);
};

if (!isModalOpen || !isComingSoonActive) {
if (!isModalOpen || !window.NewfoldRuntime.comingSoon.isEnabled) {
return null;
}

const title = __('Ready to launch your Site?', 'nfd-coming-soon');
const heading = __('Pages and posts you publish will not be visible to the public until you launch your site.', 'nfd-coming-soon');
const heading = __(
'Pages and posts you publish will not be visible to the public until you launch your site.',
'nfd-coming-soon'
);
const launchButtonText = __('Publish & Launch Site', 'nfd-coming-soon');
const withoutLaunchButtonText = __('Publish without launching', 'nfd-coming-soon');
const withoutLaunchButtonText = __(
'Publish Without Launching',
'nfd-coming-soon'
);

return (
<WP2Modal
title={title}
onRequestClose={() => setIsModalOpen(false)}
>
<WP2Modal title={title} onRequestClose={() => setIsModalOpen(false)}>
<div>
<p>{heading}</p>
<div className="modal-buttons">
<br />
<div
style={ {
alignContent: 'space-between',
display: 'flex',
flexWrap: 'wrap',
gap: '16px',
boxSizing: 'inherit',
} }
>
<Button
icon={<Icon icon={launch} />}
variant="primary" onClick={handlePublishAndLaunch}>
variant="primary"
onClick={handlePublishAndLaunch}
style={{
flex: 1,
justifyContent: 'center',
}}
>
{launchButtonText}
</Button>
<Button variant="secondary" onClick={() => setIsModalOpen(false)}>
<Button
variant="link"
onClick={() => setIsModalOpen(false)}
style={{
flex: 1,
justifyContent: 'center',
}}
>
{withoutLaunchButtonText}
</Button>
</div>
Expand Down
15 changes: 0 additions & 15 deletions src/styles/_mixins.scss

This file was deleted.

4 changes: 0 additions & 4 deletions src/styles/app.scss

This file was deleted.

26 changes: 0 additions & 26 deletions src/styles/modal.scss

This file was deleted.

16 changes: 0 additions & 16 deletions src/utils/api/comingSoon.js

This file was deleted.

14 changes: 0 additions & 14 deletions src/utils/api/resolve.js

This file was deleted.

Loading