all repos — caroster @ 14aa569691fa352558026139510056a49df29b07

[Octree] Group carpool to your event https://caroster.io

🐛 Hide travel's phone following user permissions #539
Tim Izzo tim@5ika.ch
Fri, 30 Aug 2024 09:16:38 +0200
commit

14aa569691fa352558026139510056a49df29b07

parent

406456e1af7399c4bf12340f443334a004070db9

1 files changed, 5 insertions(+), 1 deletions(-)

jump to
M frontend/containers/TravelMarker/TravelPopup.tsxfrontend/containers/TravelMarker/TravelPopup.tsx

@@ -8,6 +8,7 @@ import {Popup} from 'react-leaflet';

import {useTranslation} from 'next-i18next'; import getMapsLink from '../../lib/getMapsLink'; import {getFormatedPhoneNumber} from '../../lib/phoneNumbers'; +import usePermissions from '../../hooks/usePermissions'; interface Props { travel: TravelEntity;

@@ -15,6 +16,9 @@ }

const TravelPopup = ({travel}: Props) => { const {t} = useTranslation(); + const { + userPermissions: {canSeeTravelDetails}, + } = usePermissions(); return ( <Popup> <Card sx={{p: 2, width: '350px', maxWidth: '100%', cursor: 'pointer'}}>

@@ -27,7 +31,7 @@ )}

<Box> <Typography variant="h5">{travel.attributes.vehicleName}</Typography> </Box> - {!!travel.attributes.phone_number && ( + {!!travel.attributes.phone_number && canSeeTravelDetails(travel) && ( <Box sx={{marginTop: 2}}> <Typography variant="overline" color="GrayText"> {t('travel.fields.phone')}