diff options
Diffstat (limited to 'modern/src/common')
-rw-r--r-- | modern/src/common/attributes/useCommonUserAttributes.js | 4 | ||||
-rw-r--r-- | modern/src/common/components/LocalizationProvider.jsx | 2 | ||||
-rw-r--r-- | modern/src/common/components/StatusCard.jsx | 32 | ||||
-rw-r--r-- | modern/src/common/util/formatter.js | 2 | ||||
-rw-r--r-- | modern/src/common/util/useFeatures.js | 6 |
5 files changed, 8 insertions, 38 deletions
diff --git a/modern/src/common/attributes/useCommonUserAttributes.js b/modern/src/common/attributes/useCommonUserAttributes.js index bd88d1e8..1f811e56 100644 --- a/modern/src/common/attributes/useCommonUserAttributes.js +++ b/modern/src/common/attributes/useCommonUserAttributes.js @@ -93,8 +93,8 @@ export default (t) => useMemo(() => ({ name: t('attributeUiDisableEvents'), type: 'boolean', }, - 'ui.disableVehicleFetures': { - name: t('attributeUiDisableVehicleFetures'), + 'ui.disableVehicleFeatures': { + name: t('attributeUiDisableVehicleFeatures'), type: 'boolean', }, 'ui.disableDrivers': { diff --git a/modern/src/common/components/LocalizationProvider.jsx b/modern/src/common/components/LocalizationProvider.jsx index d48b12ce..4104c773 100644 --- a/modern/src/common/components/LocalizationProvider.jsx +++ b/modern/src/common/components/LocalizationProvider.jsx @@ -35,6 +35,7 @@ import ko from '../../resources/l10n/ko.json'; import 'dayjs/locale/ko'; import lo from '../../resources/l10n/lo.json'; import 'dayjs/locale/lo'; import lt from '../../resources/l10n/lt.json'; import 'dayjs/locale/lt'; import lv from '../../resources/l10n/lv.json'; import 'dayjs/locale/lv'; +import mk from '../../resources/l10n/mk.json'; import 'dayjs/locale/mk'; import ml from '../../resources/l10n/ml.json'; import 'dayjs/locale/ml'; import mn from '../../resources/l10n/mn.json'; import 'dayjs/locale/mn'; import ms from '../../resources/l10n/ms.json'; import 'dayjs/locale/ms'; @@ -93,6 +94,7 @@ const languages = { lo: { data: lo, country: 'LA', name: 'ລາວ' }, lt: { data: lt, country: 'LT', name: 'Lietuvių' }, lv: { data: lv, country: 'LV', name: 'Latviešu' }, + mk: { data: mk, country: 'MK', name: 'Mакедонски' }, ml: { data: ml, country: 'IN', name: 'മലയാളം' }, mn: { data: mn, country: 'MN', name: 'Монгол хэл' }, ms: { data: ms, country: 'MY', name: 'بهاس ملايو' }, diff --git a/modern/src/common/components/StatusCard.jsx b/modern/src/common/components/StatusCard.jsx index 53048645..a63d0f80 100644 --- a/modern/src/common/components/StatusCard.jsx +++ b/modern/src/common/components/StatusCard.jsx @@ -1,7 +1,6 @@ import React, { useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useNavigate } from 'react-router-dom'; -import dayjs from 'dayjs'; import Draggable from 'react-draggable'; import { Card, @@ -16,11 +15,6 @@ import { Menu, MenuItem, CardMedia, - Dialog, - TextField, - DialogActions, - DialogContent, - Button, } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import CloseIcon from '@mui/icons-material/Close'; @@ -138,7 +132,6 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin const [anchorEl, setAnchorEl] = useState(null); const [removing, setRemoving] = useState(false); - const [shared, setShared] = useState(null); const handleRemove = useCatch(async (removed) => { if (removed) { @@ -178,20 +171,6 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin } }, [navigate, position]); - const handleShare = useCatchCallback(async () => { - const expiration = dayjs().add(1, 'week').toISOString(); - const response = await fetch('/api/devices/share', { - method: 'POST', - body: new URLSearchParams(`deviceId=${deviceId}&expiration=${expiration}`), - }); - if (response.ok) { - const token = await response.text(); - setShared(`${window.location.origin}?token=${token}`); - } else { - throw Error(await response.text()); - } - }, [deviceId, setShared]); - return ( <> <div className={classes.root}> @@ -293,7 +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> - {!shareDisabled && !user.temporary && <MenuItem onClick={handleShare}>{t('deviceShare')}</MenuItem>} + {!shareDisabled && !user.temporary && <MenuItem onClick={() => navigate(`/settings/device/${deviceId}/share`)}>{t('deviceShare')}</MenuItem>} </Menu> )} <RemoveDialog @@ -302,15 +281,6 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin itemId={deviceId} onResult={(removed) => handleRemove(removed)} /> - <Dialog open={Boolean(shared)} onClose={() => setShared(null)}> - <DialogContent> - <TextField value={shared} onFocus={e => e.target.select()} /> - </DialogContent> - <DialogActions> - <Button onClick={() => setShared(null)}>{t('sharedCancel')}</Button> - <Button onClick={() => navigator.clipboard?.writeText(shared)}>{t('sharedCopy')}</Button> - </DialogActions> - </Dialog> </> ); }; diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js index aeacc145..7b7fc96d 100644 --- a/modern/src/common/util/formatter.js +++ b/modern/src/common/util/formatter.js @@ -66,8 +66,6 @@ export const formatSpeed = (value, unit, t) => `${speedFromKnots(value, unit).to export const formatVolume = (value, unit, t) => `${volumeFromLiters(value, unit).toFixed(2)} ${volumeUnitString(unit, t)}`; -export const formatHours = (value) => dayjs.duration(value).humanize(); - export const formatNumericHours = (value, t) => { const hours = Math.floor(value / 3600000); const minutes = Math.floor((value % 3600000) / 60000); diff --git a/modern/src/common/util/useFeatures.js b/modern/src/common/util/useFeatures.js index 08499e54..cafb2c7c 100644 --- a/modern/src/common/util/useFeatures.js +++ b/modern/src/common/util/useFeatures.js @@ -19,9 +19,9 @@ const featureSelector = createSelector( (state) => state.session.user, (server, user) => { const disableAttributes = get(server, user, 'ui.disableAttributes'); - const disableVehicleFetures = get(server, user, 'ui.disableVehicleFetures'); - const disableDrivers = disableVehicleFetures || get(server, user, 'ui.disableDrivers'); - const disableMaintenance = disableVehicleFetures || get(server, user, 'ui.disableMaintenance'); + const disableVehicleFeatures = get(server, user, 'ui.disableVehicleFeatures'); + const disableDrivers = disableVehicleFeatures || get(server, user, 'ui.disableDrivers'); + const disableMaintenance = disableVehicleFeatures || get(server, user, 'ui.disableMaintenance'); const disableGroups = get(server, user, 'ui.disableGroups'); const disableEvents = get(server, user, 'ui.disableEvents'); const disableComputedAttributes = get(server, user, 'ui.disableComputedAttributes'); |