Skip to content

Commit

Permalink
feat: valid event locations now link to map (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInDark authored Dec 25, 2024
1 parent 6b119d7 commit 2576002
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/app/(screens)/clEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
formatFriendlyDateTime,
formatFriendlyDateTimeRange,
} from '@/utils/date-utils'
import { isValidRoom } from '@/utils/timetable-utils'
import { trackEvent } from '@aptabase/react-native'
import { Redirect, useFocusEffect, useNavigation } from 'expo-router'
import React, { useCallback } from 'react'
Expand All @@ -16,7 +17,7 @@ import { Linking, ScrollView, Share, Text, View } from 'react-native'
import { createStyleSheet, useStyles } from 'react-native-unistyles'

export default function ClEventDetail(): React.JSX.Element {
const { styles } = useStyles(stylesheet)
const { styles, theme } = useStyles(stylesheet)
const navigation = useNavigation()
const clEvent = useCLParamsStore((state) => state.selectedClEvent)

Expand Down Expand Up @@ -97,10 +98,25 @@ export default function ClEventDetail(): React.JSX.Element {
]),
...(clEvent?.location != null && clEvent.location !== ''
? [
{
title: t('pages.event.location'),
value: clEvent.location,
},
Object.assign(
{
title: t('pages.event.location'),
value: clEvent?.location,
},
isValidRoom(clEvent.location)
? {
onPress: () => {
router.dismissTo({
pathname: '/map',
params: {
room: clEvent?.location,
},
})
},
textColor: theme.colors.primary,
}
: {}
),
]
: []),

Expand Down

0 comments on commit 2576002

Please sign in to comment.