Skip to content

Commit b862ac9

Browse files
committed
Fix location URL handling and bump version to 1.3.9
- Fixes #129: Location addresses now detect and link directly to URLs instead of Google Maps - Created reusable LocationAddress component for consistent URL detection - Updated EventCard and EventDetails components to use new component - Improved user experience for virtual meetings and hybrid events - Bumped version to 1.3.9 across all files
1 parent 14368b7 commit b862ac9

6 files changed

Lines changed: 52 additions & 19 deletions

File tree

assets/js/src/components/public/EventDetails.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useState, useEffect } from '@wordpress/element';
22
import { useEventProvider } from '../providers/EventProvider';
33
import { formatRecurringPattern, apiFetch } from '../../util';
4+
import LocationAddress from './LocationAddress';
45

56
const EventDetails = () => {
67
const [event, setEvent] = useState(null);
@@ -91,13 +92,7 @@ const EventDetails = () => {
9192
)}
9293
{location_address && (
9394
<p className="mayo-location-address">
94-
<a
95-
href={`https://maps.google.com?q=${encodeURIComponent(location_address)}`}
96-
target="_blank"
97-
rel="noopener noreferrer"
98-
>
99-
{location_address}
100-
</a>
95+
<LocationAddress address={location_address} />
10196
</p>
10297
)}
10398
{location_details && (
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { useEventProvider } from '../providers/EventProvider';
2+
3+
const LocationAddress = ({ address, className = "mayo-location-address" }) => {
4+
if (!address) return null;
5+
6+
// Check if the address contains a URL
7+
const urlRegex = /(https?:\/\/[^\s]+)/g;
8+
const urls = address.match(urlRegex);
9+
10+
if (urls && urls.length > 0) {
11+
// If URL is found, link directly to it
12+
return (
13+
<a
14+
href={urls[0]}
15+
target="_blank"
16+
rel="noopener noreferrer"
17+
className={className}
18+
onClick={(e) => e.stopPropagation()}
19+
>
20+
{address}
21+
</a>
22+
);
23+
} else {
24+
// If no URL, use Google Maps
25+
return (
26+
<a
27+
href={`https://maps.google.com?q=${encodeURIComponent(address)}`}
28+
target="_blank"
29+
rel="noopener noreferrer"
30+
className={className}
31+
onClick={(e) => e.stopPropagation()}
32+
>
33+
{address}
34+
</a>
35+
);
36+
}
37+
};
38+
39+
export default LocationAddress;

assets/js/src/components/public/cards/EventCard.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useState, useEffect } from '@wordpress/element';
22
import { useEventProvider } from '../../providers/EventProvider';
33
import { formatTime, formatTimezone, formatRecurringPattern, dayNames, monthNames } from '../../../util';
4+
import LocationAddress from '../LocationAddress';
45

56
// Helper function to convert emoji and special characters to Unicode
67
const convertToUnicode = (str) => {
@@ -191,14 +192,7 @@ const EventCard = ({ event, timeFormat, forceExpanded }) => {
191192
)}
192193
{event.meta.location_address && (
193194
<p className="mayo-location-address">
194-
<a
195-
href={`https://maps.google.com?q=${encodeURIComponent(event.meta.location_address)}`}
196-
target="_blank"
197-
rel="noopener noreferrer"
198-
onClick={(e) => e.stopPropagation()}
199-
>
200-
{event.meta.location_address}
201-
</a>
195+
<LocationAddress address={event.meta.location_address} />
202196
</p>
203197
)}
204198
{event.meta.location_details && (

mayo-events-manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Plugin Name: Mayo Events Manager
55
* Description: A plugin for managing and displaying events.
6-
* Version: 1.3.7
6+
* Version: 1.3.9
77
* Author: bmlt-enabled
88
* License: GPLv2 or later
99
* Author URI: https://bmlt.app
@@ -20,7 +20,7 @@
2020
exit; // Exit if accessed directly
2121
}
2222

23-
define('MAYO_VERSION', '1.3.7');
23+
define('MAYO_VERSION', '1.3.9');
2424

2525
require_once __DIR__ . '/vendor/autoload.php';
2626
require_once __DIR__ . '/includes/Admin.php';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mayo",
3-
"version": "1.2.8",
3+
"version": "1.3.9",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

readme.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: events, bmlt, narcotics anonymous, na
55
Requires PHP: 8.2
66
Requires at least: 6.7
77
Tested up to: 6.8
8-
Stable tag: 1.3.7
8+
Stable tag: 1.3.9
99
License: GPLv2 or later
1010
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1111

@@ -135,6 +135,11 @@ This project is licensed under the GPL v2 or later.
135135

136136
== Changelog ==
137137

138+
= 1.3.9 =
139+
* Fixed location address handling to detect and link directly to URLs instead of Google Maps when URLs are embedded in location addresses. [#129]
140+
* Created reusable LocationAddress component for consistent URL detection across EventCard and EventDetails components.
141+
* Improved user experience for virtual meetings and hybrid events by linking directly to meeting URLs (e.g., Zoom links) instead of redirecting to Google Maps.
142+
138143
= 1.3.7 =
139144
* Fixed null pointer error in Frontend.php when accessing post properties on null post object.
140145

0 commit comments

Comments
 (0)