Skip to content

Commit

Permalink
Merge pull request #40 from newfold-labs/feature/press0/1959
Browse files Browse the repository at this point in the history
Remove Coming Soon Pre publish Modal CSS
  • Loading branch information
circlecube authored Aug 30, 2024
2 parents 36da719 + 20ea11a commit cde7aba
Show file tree
Hide file tree
Showing 19 changed files with 49 additions and 130 deletions.
2 changes: 1 addition & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
return;
}

define( 'NFD_COMING_SOON_MODULE_VERSION', '1.2.5' );
define( 'NFD_COMING_SOON_MODULE_VERSION', '1.2.6' );

require __DIR__ . '/includes/functions.php';

Expand Down
1 change: 0 additions & 1 deletion build/1.2.5/coming-soon-rtl.css

This file was deleted.

1 change: 0 additions & 1 deletion build/1.2.5/coming-soon.asset.php

This file was deleted.

1 change: 0 additions & 1 deletion build/1.2.5/coming-soon.css

This file was deleted.

1 change: 0 additions & 1 deletion build/1.2.5/coming-soon.js

This file was deleted.

1 change: 1 addition & 0 deletions build/1.2.6/coming-soon.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '99d786ddc46b8ca5c7b2');
1 change: 1 addition & 0 deletions build/1.2.6/coming-soon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
]
},
"require-dev": {
"newfold-labs/wp-php-standards": "^1.2"
"newfold-labs/wp-php-standards": "^1.2.4"
},
"scripts": {
"fix": [
Expand All @@ -46,7 +46,7 @@
}
},
"require": {
"newfold-labs/wp-module-data": ">=2.4.18",
"newfold-labs/wp-module-data": ">=2.6.2",
"wp-forge/wp-upgrade-handler": "^1.0"
}
}
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.2.5",
"version": "1.2.6",
"description": "Coming Soon",
"license": "GPL-2.0-or-later",
"private": true,
Expand Down
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.

0 comments on commit cde7aba

Please sign in to comment.