Skip to content

Commit

Permalink
Merge pull request #146 from alleyinteractive/hotfix/nb-breaking-temp…
Browse files Browse the repository at this point in the history
…late-type

Fix: Icon URLs and Breaking Template
  • Loading branch information
efuller authored Jun 14, 2024
2 parents 66cfa19 + 2ed4bbc commit 7c9f892
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: alleyinteractive

Tags: alleyinteractive, wp-newsletter-builder

Stable tag: 0.3.6
Stable tag: 0.3.22

Requires at least: 6.2

Expand Down
18 changes: 9 additions & 9 deletions blocks/footer/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface FooterSettings {
* @return {WPElement} Element to render.
*/
export default function Edit() {
const [isLoading, setIsLoading] = useState(true);
const [isLoading, setIsLoading] = useState(false);
const [footerSettings, setFooterSettings] = useState<FooterSettings>();

const facebookUrl = footerSettings?.facebook_url ?? '';
Expand All @@ -47,14 +47,14 @@ export default function Edit() {
const address = footerSettings?.address ?? '';

useEffect(() => {
if (footerSettings) {
setIsLoading(false);
return;
}
apiFetch({ path: '/wp-newsletter-builder/v1/footer_settings' }).then((response) => {
setFooterSettings(response as any as FooterSettings);
});
}, [footerSettings]);
setIsLoading(true);

apiFetch({ path: '/wp-newsletter-builder/v1/footer_settings' })
.then((response) => {
setFooterSettings(response as any as FooterSettings);
setIsLoading(false);
});
}, []);

const {
media = null,
Expand Down
10 changes: 6 additions & 4 deletions blocks/footer/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
$nb_image_id = $nb_footer_settings['image'] ?? 0;
$nb_address = $nb_footer_settings['address'] ?? '';
$nb_has_social_links = ! empty( $nb_facebook_url ) || ! empty( $nb_twitter_url ) || ! empty( $nb_instagram_url ) || ! empty( $nb_youtube_url );

$plugin_url = plugins_url( 'wp-newsletter-builder' );
?>
<div <?php echo wp_kses_data( get_block_wrapper_attributes() ); ?> align="center">
<?php if ( $nb_has_social_links ) : ?>
Expand All @@ -26,7 +28,7 @@
<span class="wp-block-wp-newsletter-builder-footer__social-links__item">
<a class="wp-block-wp-newsletter-builder-footer__social-links__link facebook-icon" href="<?php echo esc_url( $nb_facebook_url ); ?>">
<img
src="<?php echo esc_url( home_url() . '/wp-content/plugins/wp-newsletter-builder/images/facebook.png' ); ?>"
src="<?php echo esc_url( $plugin_url . '/images/facebook.png' ); ?>"
alt="Facebook"
height="26"
width="26"
Expand All @@ -38,7 +40,7 @@
<span class="wp-block-wp-newsletter-builder-footer__social-links__item">
<a class="wp-block-wp-newsletter-builder-footer__social-links__link twitter-icon" href="<?php echo esc_url( $nb_twitter_url ); ?>">
<img
src="<?php echo esc_url( home_url() . '/wp-content/plugins/wp-newsletter-builder/images/twitter.png' ); ?>"
src="<?php echo esc_url( $plugin_url . '/images/twitter.png' ); ?>"
alt="Twitter"
height="26"
width="26"
Expand All @@ -50,7 +52,7 @@
<span class="wp-block-wp-newsletter-builder-footer__social-links__item">
<a class="wp-block-wp-newsletter-builder-footer__social-links__link instagram-icon" href="<?php echo esc_url( $nb_instagram_url ); ?>">
<img
src="<?php echo esc_url( home_url() . '/wp-content/plugins/wp-newsletter-builder/images/instagram.png' ); ?>"
src="<?php echo esc_url( $plugin_url . '/images/instagram.png' ); ?>"
alt="Instagram"
height="26"
width="26"
Expand All @@ -62,7 +64,7 @@
<span class="wp-block-wp-newsletter-builder-footer__social-links__item">
<a class="wp-block-wp-newsletter-builder-footer__social-links__link youtube-icon" href="<?php echo esc_url( $nb_youtube_url ); ?>">
<img
src="<?php echo esc_url( home_url() . '/wp-content/plugins/wp-newsletter-builder/images/youtube.png' ); ?>"
src="<?php echo esc_url( $plugin_url . '/images/youtube.png' ); ?>"
alt="YouTube"
height="26"
width="26"
Expand Down
2 changes: 1 addition & 1 deletion config/post-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"post_types": [
"post"
],
"type": "string"
"type": "number"
},
"nb_breaking_from_name": {
"post_types": [
Expand Down
4 changes: 2 additions & 2 deletions hooks/useNewsletterMeta/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { usePostMeta } from '@alleyinteractive/block-editor-tools';

export interface NewsletterMeta {
type: string;
template: string;
template: number;
fromName: string;
subject: string;
preview: string;
Expand All @@ -18,7 +18,7 @@ function useNewsletterMeta() {

const {
nb_breaking_email_type: type = '',
nb_breaking_template: template = '',
nb_breaking_template: template = 0,
nb_breaking_from_name: fromName = '',
nb_breaking_subject: subject = '',
nb_breaking_preview: preview = '',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"prestylelint": "check-node-version --package",
"pretest:watch": "check-node-version --package",
"pretest": "check-node-version --package",
"release": "npx @alleyinteractive/create-release@latest",
"start": "wp-scripts start --webpack-copy-php --webpack-src-dir=blocks",
"start:hot": "wp-scripts start --webpack-copy-php --webpack-src-dir=blocks --hot",
"stylelint:fix": "stylelint --fix \"**/*.scss\"",
Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Newsletter Builder
* Plugin URI: https://github.com/alleyinteractive/wp-newsletter-builder
* Description: Interface to manage email newsletters
* Version: 0.3.21
* Version: 0.3.22
* Author: Alley Interactive
* Author URI: https://github.com/alleyinteractive/wp-newsletter-builder
* Requires at least: 6.2
Expand Down

0 comments on commit 7c9f892

Please sign in to comment.