Skip to content

Commit

Permalink
[#365] - remove geolocation button from storymap
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelars86 committed Apr 22, 2021
1 parent ffbf010 commit f85aa02
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/js/src/posts-sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -38,10 +40,19 @@ const JeoGeocodePanel = class JeoGeocodePanel extends Component {
registerPlugin( 'jeo-posts-sidebar', {
icon: null,
render: () => {
return (
<PluginDocumentSettingPanel title={ __( 'Geolocation', 'jeo' ) }>
<JeoGeocodePanel />
</PluginDocumentSettingPanel>
);

const currentPostType = useSelect( ( select ) => {
return select( 'core/editor' ).getCurrentPostType()
}, [] );

return (
<div>
{ currentPostType === "post" ?
<PluginDocumentSettingPanel title={ __( 'Geolocation', 'jeo' ) }>
<JeoGeocodePanel />
</PluginDocumentSettingPanel>
: null };
</div>
)
},
} );

0 comments on commit f85aa02

Please sign in to comment.