-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(solves 736) Checkbox to toggle latitude and longitude in Venue block #877
Changes from 6 commits
af760e5
4fa8150
cb44491
b2b1eec
59677ec
ede98fe
418e289
9ca69d3
ff4c7bd
e64fb45
7d2acd0
4df2ab3
a4a7c42
35c79ad
ea1e0e7
d53070c
d78a7c7
74ebd41
e378324
ac7ef12
ff589c1
9ead249
f5f87f2
127029d
55eb3d0
daad077
7f9fc19
c5275f8
e4970c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '754b4dfa4e592032751e'); | ||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'd363e7f0b415ef3e95a3'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('moment', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => '2a87e9e9bf69563aeae1'); | ||
<?php return array('dependencies' => array('moment', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => 'fbdfb147c6c684a7d803'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'c0e0d5fe46659d5a0d72'); | ||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '32836f434d415163a581'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '97b565c364ee272e7701'); | ||
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '4842db94aa23d20de87e'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '120d638313cd180d9338'); | ||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '1196756c1c15c226a71e'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'eefd96d7d3ced019a949'); | ||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '2b9111b895d3b05a8ece'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '1dfd2576a31f517fef45'); | ||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '94657e92928e2e24a9d3'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '3b137897829338f9530a'); | ||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '34e21d75e332e2e50be5'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '680566d16c88772cbf7c'); | ||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'a739b00e9b9ec0d3e2d7'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('moment', 'react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => '48c337124ea797af392b'); | ||
<?php return array('dependencies' => array('moment', 'react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => '63c72435605fd4574135'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'ac43be418ed67d7ea96a'); | ||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'f1a0db9e615d4c2f9bb7'); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array(), 'version' => '15d01c9dc99209264b1e'); | ||
<?php return array('dependencies' => array(), 'version' => 'b22085380615508e848f'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array(), 'version' => '9c37901c158173551201'); | ||
<?php return array('dependencies' => array(), 'version' => '84778738e904eca6ddf2'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,15 @@ | |
import { __ } from '@wordpress/i18n'; | ||
import { InspectorControls, useBlockProps } from '@wordpress/block-editor'; | ||
import { | ||
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis | ||
__experimentalNumberControl as NumberControl, | ||
PanelBody, | ||
PanelRow, | ||
RadioControl, | ||
RangeControl, | ||
ToggleControl, | ||
} from '@wordpress/components'; | ||
import { useSelect } from '@wordpress/data'; | ||
import { useDispatch, useSelect } from '@wordpress/data'; | ||
import { useEffect, useState } from '@wordpress/element'; | ||
|
||
/** | ||
|
@@ -23,7 +25,7 @@ import { isVenuePostType } from '../../helpers/venue'; | |
import VenueSelector from '../../components/VenueSelector'; | ||
import VenueInformation from '../../panels/venue-settings/venue-information'; | ||
import OnlineEventLink from '../../components/OnlineEventLink'; | ||
import { Listener } from '../../helpers/broadcasting'; | ||
import { Broadcaster, Listener } from '../../helpers/broadcasting'; | ||
import { isEventPostType } from '../../helpers/event'; | ||
import { getFromGlobal, isGatherPressPostType } from '../../helpers/globals'; | ||
|
||
|
@@ -60,7 +62,17 @@ const Edit = ({ attributes, setAttributes, isSelected }) => { | |
?.gatherpress_online_event_link | ||
); | ||
|
||
let { mapShow } = attributes; | ||
let { mapShow, mapCustomLatLong } = attributes; | ||
const editPost = useDispatch('core/editor').editPost; | ||
const updateVenueMeta = (metaData) => { | ||
const payload = JSON.stringify({ | ||
...venueInformationMetaData, | ||
...metaData, | ||
}); | ||
const meta = { gatherpress_venue_information: payload }; | ||
|
||
editPost({ meta }); | ||
}; | ||
|
||
let venueInformationMetaData = useSelect( | ||
(select) => | ||
|
@@ -212,6 +224,45 @@ const Edit = ({ attributes, setAttributes, isSelected }) => { | |
min={100} | ||
max={1000} | ||
/> | ||
<PanelRow> | ||
{__('Latitude / Longitude', 'gatherpress')} | ||
</PanelRow> | ||
<PanelRow> | ||
<ToggleControl | ||
label={ | ||
mapCustomLatLong | ||
? __('Use custom values', 'gatherpress') | ||
: __( | ||
'Use default values', | ||
'gatherpress' | ||
) | ||
} | ||
checked={mapCustomLatLong} | ||
onChange={(value) => { | ||
setAttributes({ mapCustomLatLong: value }); | ||
}} | ||
/> | ||
</PanelRow> | ||
{mapCustomLatLong && ( | ||
<> | ||
<NumberControl | ||
label={__('Latitude', 'gatherpress')} | ||
value={latitude} | ||
onChange={(value) => { | ||
Broadcaster({ setLatitude: value }); | ||
updateVenueMeta({ latitude: value }); | ||
}} | ||
/> | ||
<NumberControl | ||
label={__('Longitude', 'gatherpress')} | ||
value={longitude} | ||
onChange={(value) => { | ||
Broadcaster({ setLongitude: value }); | ||
updateVenueMeta({ longitude: value }); | ||
}} | ||
/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should have a button that will "Reset" the coordinates. Just call the button "Reset" and have it take the address and run it through the API again to bring back original values. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems that the changes in lat/long are not being retained. I did some updates, but I don't think anything that should have effected functionality. It changes, but then when I leave focus, it reverts... It might be good to use the redux stores rather than Broadcaster/Listener as that may be the issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
toggling default/custom will now reset the map in way you are describing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We implemented the store. So all these issues should be resolved. @mauteri There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jmarx I would like to add the Reset button. I get what you are saying, but that might not be super obvious to people. A reset button would be. |
||
</> | ||
)} | ||
</PanelBody> | ||
)} | ||
</InspectorControls> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you'd like to look at the
store
I created for updates to theEvent Date
block, you can start using that instead of theListener / Broadcaster
. If not, we can update to that later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mauteri Done.