From f85aa02ed47bb308df61230df5d34b779ffc650a Mon Sep 17 00:00:00 2001 From: pame Date: Thu, 22 Apr 2021 03:52:33 -0300 Subject: [PATCH] [#365] - remove geolocation button from storymap --- src/js/src/posts-sidebar/index.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/js/src/posts-sidebar/index.js b/src/js/src/posts-sidebar/index.js index f6a997f4..248d06fa 100644 --- a/src/js/src/posts-sidebar/index.js +++ b/src/js/src/posts-sidebar/index.js @@ -4,6 +4,8 @@ import { Component, Fragment } from '@wordpress/element'; import { Modal, Button } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import JeoGeocodePosts from './geo-posts'; +import { useSelect } from '@wordpress/data'; + const JeoGeocodePanel = class JeoGeocodePanel extends Component { constructor() { @@ -38,10 +40,19 @@ const JeoGeocodePanel = class JeoGeocodePanel extends Component { registerPlugin( 'jeo-posts-sidebar', { icon: null, render: () => { - return ( - - - - ); + + const currentPostType = useSelect( ( select ) => { + return select( 'core/editor' ).getCurrentPostType() + }, [] ); + + return ( +
+ { currentPostType === "post" ? + + + + : null }; +
+ ) }, } );