aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/components
diff options
context:
space:
mode:
authorMatjaž Črnko <matjaz.crnko@gmail.com>2024-03-08 10:59:29 +0100
committerGitHub <noreply@github.com>2024-03-08 10:59:29 +0100
commitfe7b4800224352c628fb925c85a937684af58e6f (patch)
treed5a111f5cedbba4a10278695227447ee12113db0 /modern/src/common/components
parentb87f2387ae597e57d9e2591ab01595e76b65d7c5 (diff)
parentc9da10062998a231c038cd3a519f72128fcea2bb (diff)
downloadtrackermap-web-fe7b4800224352c628fb925c85a937684af58e6f.tar.gz
trackermap-web-fe7b4800224352c628fb925c85a937684af58e6f.tar.bz2
trackermap-web-fe7b4800224352c628fb925c85a937684af58e6f.zip
Merge branch 'traccar:master' into autocomplete-instead-of-single-select
Diffstat (limited to 'modern/src/common/components')
-rw-r--r--modern/src/common/components/LocalizationProvider.jsx2
-rw-r--r--modern/src/common/components/StatusCard.jsx32
2 files changed, 3 insertions, 31 deletions
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>
</>
);
};