Skip to content

Commit

Permalink
Merge pull request #1273 from dough29/feat/waze-navigation
Browse files Browse the repository at this point in the history
Add navigation app link in status card
  • Loading branch information
tananaev authored Sep 23, 2024
2 parents 2154ff1 + 9b0f4c9 commit 87b7407
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/common/attributes/useCommonUserAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,12 @@ export default (t) => useMemo(() => ({
name: t('sharedIconScale'),
type: 'number',
},
navigationAppLink: {
name: t('attributeNavigationAppLink'),
type: 'string',
},
navigationAppTitle: {
name: t('attributeNavigationAppTitle'),
type: 'string',
},
}), [t]);
4 changes: 4 additions & 0 deletions src/common/components/StatusCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin
const positionAttributes = usePositionAttributes(t);
const positionItems = useAttributePreference('positionItems', 'fixTime,address,speed,totalDistance');

const navigationAppLink = useAttributePreference('navigationAppLink');
const navigationAppTitle = useAttributePreference('navigationAppTitle');

const [anchorEl, setAnchorEl] = useState(null);

const [removing, setRemoving] = useState(false);
Expand Down Expand Up @@ -269,6 +272,7 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin
<MenuItem component="a" target="_blank" href={`https://www.google.com/maps/search/?api=1&query=${position.latitude}%2C${position.longitude}`}>{t('linkGoogleMaps')}</MenuItem>
<MenuItem component="a" target="_blank" href={`http://maps.apple.com/?ll=${position.latitude},${position.longitude}`}>{t('linkAppleMaps')}</MenuItem>
<MenuItem component="a" target="_blank" href={`https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=${position.latitude}%2C${position.longitude}&heading=${position.course}`}>{t('linkStreetView')}</MenuItem>
{navigationAppTitle && <MenuItem component="a" target="_blank" href={navigationAppLink.replace('{latitude}', position.latitude).replace('{longitude}', position.longitude)}>{navigationAppTitle}</MenuItem>}
{!shareDisabled && !user.temporary && <MenuItem onClick={() => navigate(`/settings/device/${deviceId}/share`)}>{t('deviceShare')}</MenuItem>}
</Menu>
)}
Expand Down
2 changes: 2 additions & 0 deletions src/resources/l10n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
"attributeMailSmtpAuth": "Mail: SMTP Auth Enable",
"attributeMailSmtpUsername": "Mail: SMTP Username",
"attributeMailSmtpPassword": "Mail: SMTP Password",
"attributeNavigationAppLink": "Navigation app link",
"attributeNavigationAppTitle": "Navigation app title",
"attributeUiDisableSavedCommands": "UI: Disable Saved Commands",
"attributeUiDisableAttributes": "UI: Disable Attributes",
"attributeUiDisableGroups": "UI: Disable Groups",
Expand Down

0 comments on commit 87b7407

Please sign in to comment.