|
@@ -64,6 +64,7 @@ import { Dropdown } from 'react-native-searchable-dropdown-kj';
|
|
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
|
import Tooltip from 'react-native-walkthrough-tooltip';
|
|
|
import WebView from 'react-native-webview';
|
|
|
+import ClockIcon from 'assets/icons/events/clock.svg';
|
|
|
|
|
|
type TempFile = {
|
|
|
filetype: string;
|
|
@@ -549,13 +550,60 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
|
|
|
|
const formatEventDate = (event: EventData) => {
|
|
|
if (event.settings.date_from && event.settings.date_to) {
|
|
|
- return `${moment(event.settings.date_from, 'YYYY-MM-DD').format('DD MMMM YYYY')} - ${moment(event.settings.date_to, 'YYYY-MM-DD').format('DD MMMM YYYY')}`;
|
|
|
+ return (
|
|
|
+ <View>
|
|
|
+ <Text
|
|
|
+ style={{
|
|
|
+ fontSize: getFontSize(12),
|
|
|
+ fontWeight: '600',
|
|
|
+ color: Colors.DARK_BLUE,
|
|
|
+ flex: 1
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {moment(event.settings.date_from, 'YYYY-MM-DD').format('DD MMMM YYYY')} -{' '}
|
|
|
+ </Text>
|
|
|
+ <Text
|
|
|
+ style={{
|
|
|
+ fontSize: getFontSize(12),
|
|
|
+ fontWeight: '600',
|
|
|
+ color: Colors.DARK_BLUE,
|
|
|
+ flex: 1
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {moment(event.settings.date_to, 'YYYY-MM-DD').format('DD MMMM YYYY')}
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
+ );
|
|
|
} else {
|
|
|
let date = moment(event.settings.date, 'YYYY-MM-DD').format('DD MMMM YYYY');
|
|
|
- if (event.time) {
|
|
|
- date += `, ${event.time}`;
|
|
|
- }
|
|
|
- return date;
|
|
|
+
|
|
|
+ return (
|
|
|
+ <View>
|
|
|
+ <Text
|
|
|
+ style={{
|
|
|
+ fontSize: getFontSize(12),
|
|
|
+ fontWeight: '600',
|
|
|
+ color: Colors.DARK_BLUE
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {date}
|
|
|
+ </Text>
|
|
|
+ {event.time && (
|
|
|
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>
|
|
|
+ <ClockIcon fill={Colors.DARK_BLUE} height={12} width={12} />
|
|
|
+ <Text
|
|
|
+ style={{
|
|
|
+ fontSize: getFontSize(12),
|
|
|
+ fontWeight: '600',
|
|
|
+ color: Colors.DARK_BLUE
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {event.time}
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
+ )}
|
|
|
+ </View>
|
|
|
+ );
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -590,15 +638,56 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
- const staticImgUrl =
|
|
|
- event.type === 2
|
|
|
- ? '/static/img/events/trip.webp'
|
|
|
- : event.type === 3
|
|
|
- ? '/static/img/events/conference.webp'
|
|
|
- : '/static/img/events/meeting.webp';
|
|
|
- const photoUrl = event.photo_available
|
|
|
- ? API_HOST + '/webapi/events/get-main-photo/' + event.id
|
|
|
- : API_HOST + staticImgUrl;
|
|
|
+ const openMap = () => {
|
|
|
+ const rawCoords = event.settings.location;
|
|
|
+ const coords =
|
|
|
+ typeof rawCoords === 'string' ? JSON.parse(rawCoords.replace(/'/g, '"')) : rawCoords;
|
|
|
+
|
|
|
+ const lat = coords.lat;
|
|
|
+ const lon = coords.lon;
|
|
|
+
|
|
|
+ const url =
|
|
|
+ Platform.OS === 'ios'
|
|
|
+ ? `http://maps.apple.com/?ll=${lat},${lon}`
|
|
|
+ : `geo:${lat},${lon}?q=${lat},${lon}`;
|
|
|
+
|
|
|
+ const googleMapsUrl = `https://www.google.com/maps/search/?api=1&query=${lat},${lon}`;
|
|
|
+
|
|
|
+ Linking.canOpenURL(googleMapsUrl)
|
|
|
+ .then((supported) => {
|
|
|
+ if (supported) {
|
|
|
+ Linking.openURL(googleMapsUrl);
|
|
|
+ } else {
|
|
|
+ return Linking.canOpenURL(url).then((supportedFallback) => {
|
|
|
+ if (supportedFallback) {
|
|
|
+ Linking.openURL(url);
|
|
|
+ } else {
|
|
|
+ navigation.dispatch(
|
|
|
+ CommonActions.reset({
|
|
|
+ index: 1,
|
|
|
+ routes: [
|
|
|
+ {
|
|
|
+ name: NAVIGATION_PAGES.IN_APP_MAP_TAB,
|
|
|
+ state: {
|
|
|
+ routes: [
|
|
|
+ {
|
|
|
+ name: NAVIGATION_PAGES.MAP_TAB,
|
|
|
+ params: { lat, lon }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ })
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => console.error('Error opening event location', err));
|
|
|
+ };
|
|
|
+
|
|
|
+ const photoUrl = API_HOST + '/webapi/events/get-main-photo/' + event.id;
|
|
|
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
@@ -708,16 +797,7 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>
|
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4, flex: 1 }}>
|
|
|
<CalendarIcon fill={Colors.DARK_BLUE} height={20} width={20} />
|
|
|
- <Text
|
|
|
- style={{
|
|
|
- fontSize: getFontSize(12),
|
|
|
- fontWeight: '600',
|
|
|
- color: Colors.DARK_BLUE,
|
|
|
- flex: 1
|
|
|
- }}
|
|
|
- >
|
|
|
- {formatEventDate(event)}
|
|
|
- </Text>
|
|
|
+ {formatEventDate(event)}
|
|
|
</View>
|
|
|
|
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4, flex: 1 }}>
|
|
@@ -737,7 +817,11 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
|
|
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>
|
|
|
{event.settings.address2 && (
|
|
|
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: 4, flex: 1 }}>
|
|
|
+ <TouchableOpacity
|
|
|
+ onPress={openMap}
|
|
|
+ disabled={!event.settings.location}
|
|
|
+ style={{ flexDirection: 'row', alignItems: 'center', gap: 4, flex: 1 }}
|
|
|
+ >
|
|
|
<LocationIcon fill={Colors.DARK_BLUE} height={20} width={20} />
|
|
|
<Text
|
|
|
style={{
|
|
@@ -749,7 +833,7 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
|
>
|
|
|
{event.settings.address2}
|
|
|
</Text>
|
|
|
- </View>
|
|
|
+ </TouchableOpacity>
|
|
|
)}
|
|
|
|
|
|
{event.settings.registrations_info !== 1 && (
|