From 4d284235c7c67905a9310b7c22c01556d947526d Mon Sep 17 00:00:00 2001 From: Damien Date: Mon, 23 Sep 2024 16:27:30 +0200 Subject: [PATCH 1/3] Add Waze in status card --- src/common/attributes/useCommonUserAttributes.js | 8 ++++++++ src/common/components/StatusCard.jsx | 7 +++++++ src/resources/l10n/en.json | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/common/attributes/useCommonUserAttributes.js b/src/common/attributes/useCommonUserAttributes.js index 43983fbc99..11810879ea 100644 --- a/src/common/attributes/useCommonUserAttributes.js +++ b/src/common/attributes/useCommonUserAttributes.js @@ -137,4 +137,12 @@ export default (t) => useMemo(() => ({ name: t('sharedIconScale'), type: 'number', }, + navigationAppLink: { + name: t('navigationAppLink'), + type: 'string', + }, + navigationAppTitle: { + name: t('navigationAppTitle'), + type: 'string', + }, }), [t]); diff --git a/src/common/components/StatusCard.jsx b/src/common/components/StatusCard.jsx index 950206b8e6..6011b3df1f 100644 --- a/src/common/components/StatusCard.jsx +++ b/src/common/components/StatusCard.jsx @@ -126,6 +126,11 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin const positionAttributes = usePositionAttributes(t); const positionItems = useAttributePreference('positionItems', 'fixTime,address,speed,totalDistance'); + const serverNavigationAppLink = useSelector((state) => state.session.server.attributes.navigationAppLink); + const serverNavigationAppTitle = useSelector((state) => state.session.server.attributes.navigationAppTitle); + const userNavigationAppLink = user.attributes.navigationAppLink; + const userNavigationAppTitle = user.attributes.navigationAppTitle; + const [anchorEl, setAnchorEl] = useState(null); const [removing, setRemoving] = useState(false); @@ -269,6 +274,8 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin {t('linkGoogleMaps')} {t('linkAppleMaps')} {t('linkStreetView')} + {serverNavigationAppLink && serverNavigationAppTitle && {serverNavigationAppTitle}} + {userNavigationAppLink && userNavigationAppTitle && {userNavigationAppTitle}} {!shareDisabled && !user.temporary && navigate(`/settings/device/${deviceId}/share`)}>{t('deviceShare')}} )} diff --git a/src/resources/l10n/en.json b/src/resources/l10n/en.json index f541b3a28e..26f72fd050 100644 --- a/src/resources/l10n/en.json +++ b/src/resources/l10n/en.json @@ -609,5 +609,7 @@ "categoryVan": "Van", "categoryScooter": "Scooter", "maintenanceStart": "Start", - "maintenancePeriod": "Period" + "maintenancePeriod": "Period", + "navigationAppLink": "Navigation app link", + "navigationAppTitle": "Navigation app title" } From 1b99de947494b02381a256b9d3aa17f10cb9ed7a Mon Sep 17 00:00:00 2001 From: Damien Date: Mon, 23 Sep 2024 16:47:46 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Add=20=E2=80=9Cattribute=E2=80=9D=20prefix?= =?UTF-8?q?=20to=20new=20entries?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/attributes/useCommonUserAttributes.js | 4 ++-- src/resources/l10n/en.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/attributes/useCommonUserAttributes.js b/src/common/attributes/useCommonUserAttributes.js index 11810879ea..e86e6b6b33 100644 --- a/src/common/attributes/useCommonUserAttributes.js +++ b/src/common/attributes/useCommonUserAttributes.js @@ -138,11 +138,11 @@ export default (t) => useMemo(() => ({ type: 'number', }, navigationAppLink: { - name: t('navigationAppLink'), + name: t('attributeNavigationAppLink'), type: 'string', }, navigationAppTitle: { - name: t('navigationAppTitle'), + name: t('attributeNavigationAppTitle'), type: 'string', }, }), [t]); diff --git a/src/resources/l10n/en.json b/src/resources/l10n/en.json index 26f72fd050..6e0d969602 100644 --- a/src/resources/l10n/en.json +++ b/src/resources/l10n/en.json @@ -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", @@ -609,7 +611,5 @@ "categoryVan": "Van", "categoryScooter": "Scooter", "maintenanceStart": "Start", - "maintenancePeriod": "Period", - "navigationAppLink": "Navigation app link", - "navigationAppTitle": "Navigation app title" + "maintenancePeriod": "Period" } From 9b0f4c90ec59c8e5ee468463faa521820c8b5e70 Mon Sep 17 00:00:00 2001 From: Damien Date: Mon, 23 Sep 2024 17:26:24 +0200 Subject: [PATCH 3/3] Simplify management of navigation application link --- src/common/components/StatusCard.jsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/common/components/StatusCard.jsx b/src/common/components/StatusCard.jsx index 6011b3df1f..a6b572a802 100644 --- a/src/common/components/StatusCard.jsx +++ b/src/common/components/StatusCard.jsx @@ -126,10 +126,8 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin const positionAttributes = usePositionAttributes(t); const positionItems = useAttributePreference('positionItems', 'fixTime,address,speed,totalDistance'); - const serverNavigationAppLink = useSelector((state) => state.session.server.attributes.navigationAppLink); - const serverNavigationAppTitle = useSelector((state) => state.session.server.attributes.navigationAppTitle); - const userNavigationAppLink = user.attributes.navigationAppLink; - const userNavigationAppTitle = user.attributes.navigationAppTitle; + const navigationAppLink = useAttributePreference('navigationAppLink'); + const navigationAppTitle = useAttributePreference('navigationAppTitle'); const [anchorEl, setAnchorEl] = useState(null); @@ -274,8 +272,7 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin {t('linkGoogleMaps')} {t('linkAppleMaps')} {t('linkStreetView')} - {serverNavigationAppLink && serverNavigationAppTitle && {serverNavigationAppTitle}} - {userNavigationAppLink && userNavigationAppTitle && {userNavigationAppTitle}} + {navigationAppTitle && {navigationAppTitle}} {!shareDisabled && !user.temporary && navigate(`/settings/device/${deviceId}/share`)}>{t('deviceShare')}} )}