Skip to content

Commit

Permalink
✨ Add newsletter in getting start, about and welcome notice (#245)
Browse files Browse the repository at this point in the history
* ✨ Add substack in getting start page

* ✨ Add substack in about page

* ✨ Add on activate welcome notice

* 💬 Use better title for quickstart video

Co-authored-by: Ng Wing Tat, David <[email protected]>

* 💄 Reduce size of substack iframe in about page

---------

Co-authored-by: Ng Wing Tat, David <[email protected]>
  • Loading branch information
williamchong and nwingt authored Feb 22, 2023
1 parent 90c3b49 commit 8995cb0
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 5 deletions.
1 change: 1 addition & 0 deletions likecoin/admin/likecoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function likecoin_add_admin_hooks( $basename ) {
add_action( 'wp_ajax_likecoin_get_error_notice', 'likecoin_get_admin_errors_restful' );
add_action( 'enqueue_block_editor_assets', 'likecoin_load_editor_scripts' );
add_action( 'admin_notices', 'likecoin_show_admin_errors' );
add_action( 'admin_notices', 'likecoin_show_admin_welcome' );
add_action( 'manage_posts_columns', 'likecoin_add_posts_columns', 10, 2 );
add_action( 'manage_posts_custom_column', 'likecoin_populate_posts_columns', 10, 2 );
add_action( 'add_meta_boxes', 'likecoin_show_plugin' ); // show sidebar or metaboxes.
Expand Down
22 changes: 22 additions & 0 deletions likecoin/admin/view/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

// phpcs:disable WordPress.WP.I18n.NonSingularStringLiteralDomain

/**
* Inclue required files.
*/
Expand Down Expand Up @@ -151,3 +153,23 @@ function likecoin_enqueue_admin_js() {
)
);
}

/**
* Show welcome message on plugin activate.
*/
function likecoin_show_admin_welcome() {
$is_welcome = get_transient( 'likecoin_welcome_notice' );
if ( $is_welcome ) {
?>
<div class="notice notice-success">
<p><?php echo esc_html( __( 'Welcome to Web3Press!', LC_PLUGIN_SLUG ) . ' ' . __( 'To receive our latest feature updates, ', LC_PLUGIN_SLUG ) ); ?>
<a taget="_blank" rel="noopener" href="<?php echo esc_url( 'https://newsletter.like.co/' ); ?> ">
<?php esc_html_e( 'Click here to subscribe to our newsletter.', LC_PLUGIN_SLUG ); ?>
</a>
</p>
</div>
<?php
delete_transient( 'likecoin_welcome_notice' );
}
}

29 changes: 27 additions & 2 deletions likecoin/js/admin-settings/src/pages/LikeCoinHelpPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ function LikeCoinHelpPage() {
}),
},
);
const localizedSubscribe = createInterpolateElement(
__(
'Follow us by entering your email below, or visit our <Blog/> for latest update.',
'likecoin',
),
{
Blog: createElement(Link, {
text: __('blog', 'likecoin'),
linkAddress: 'https://blog.like.co/?utm_source=wordpress&utm_medium=plugin&utm_campaign=getting_started',
}),
},
);
return (
<div className="lcp-nav-tab-panel likecoin">
<Section title={__('Getting Started', 'likecoin')} />
Expand All @@ -40,19 +52,32 @@ function LikeCoinHelpPage() {
<p>{faucetDescription}</p>
</div>
<div className="lcp-card">
<h2>{__('2. You are ready, let’s publish.', 'likecoin')}</h2>
<h2>{__('2. You are now ready, let’s start publishing.', 'likecoin')}</h2>
<p>{__('Here is a video to help you understand how to publish a Writing NFT', 'likecoin')}</p>
<iframe
height="315"
src="https://www.youtube.com/embed/zHmAidvifQw"
title="YouTube video player"
title={__('Quickstart Video', 'likecoin')}
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
style={{ width: '100%', maxWidth: '560px' }}
/>
<p>{localizedIntroduction}</p>
</div>
<div className="lcp-card">
<h2>{__('3. Subscribe to our newsletter for upcoming features', 'likecoin')}</h2>
<p>{localizedSubscribe}</p>
<iframe
src="https://newsletter.like.co/embed"
width="100%"
height="150"
title={__('Subscribe to LikeCoin newsletter', 'likecoin')}
style={{ border: '1px solid #EEE', background: 'white', maxWidth: '420px' }}
frameborder="0"
scrolling="no"
/>
</div>
<hr />
<Section title={__('Useful Tips', 'likecoin')} />
<div className="lcp-card">
Expand Down
33 changes: 31 additions & 2 deletions likecoin/js/admin-settings/src/pages/SponsorLikecoinPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ function SponsorLikecoinPage() {
}),
},
);
const localizedSubscribe = createInterpolateElement(
__(
'Follow us by entering your email below, or visit our <Blog/> for latest update.',
'likecoin',
),
{
Blog: createElement(Link, {
text: __('blog', 'likecoin'),
linkAddress: 'https://blog.like.co/?utm_source=wordpress&utm_medium=plugin&utm_campaign=about_page',
}),
},
);

return (
<div className="likecoin">
Expand All @@ -108,18 +120,35 @@ function SponsorLikecoinPage() {
<h3>{__('Preserve Content', 'likecoin')}</h3>
<p>{localizedDecentralizedRegistry}</p>

<hr />
<h2>{__('What is LikeCoin', 'likecoin')}</h2>
<p>{localizedLikeCoinIntroduction}</p>

<h2>{__('Why Web3', 'likecoin')}</h2>
<p>{localizedWeb3Introduction}</p>

<hr />
<h2>{__('Subscribe to our Newsletter', 'likecoin')}</h2>
<p>{localizedSubscribe}</p>
<iframe
src="https://newsletter.like.co/embed"
width="100%"
height="150"
title={__('Subscribe to LikeCoin newsletter', 'likecoin')}
style={{ border: '1px solid #EEE', maxWidth: '420px' }}
frameborder="0"
scrolling="no"
/>

<hr />
<h2>{__('Sponsor us on GitHub', 'likecoin')}</h2>
<iframe
className="lcp-github-sponsor-card"
src="https://github.com/sponsors/likecoin/card"
title="Sponsor likecoin"
height="225"
width="660"
height="150"
width="100%"
style={{ maxWidth: '660px' }}
/>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion likecoin/likecoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ function likecoin_handle_init_and_upgrade() {
*/
function likecoin_handle_activated( $plugin ) {
if ( plugin_basename( __FILE__ ) === $plugin ) {
wp_safe_redirect( esc_url( admin_url( 'options-general.php?page=likecoin#/help' ) ) );
set_transient( 'likecoin_welcome_notice', 1, 10 );
wp_safe_redirect( esc_url( admin_url( 'admin.php?page=likecoin_help#/help' ) ) );
exit();
}
}
Expand Down

0 comments on commit 8995cb0

Please sign in to comment.