aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/ServerPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-01-04 14:16:55 -0800
committerAnton Tananaev <anton@traccar.org>2023-01-04 14:16:55 -0800
commit5355d81fc9d0f16a76a58a6ceca59955aa22a2d1 (patch)
treeaaf87d77e025b943a791963edea556c30fabaf38 /modern/src/settings/ServerPage.js
parent5e133e94fd57090fceac689793583380df8b0487 (diff)
downloadtrackermap-web-5355d81fc9d0f16a76a58a6ceca59955aa22a2d1.tar.gz
trackermap-web-5355d81fc9d0f16a76a58a6ceca59955aa22a2d1.tar.bz2
trackermap-web-5355d81fc9d0f16a76a58a6ceca59955aa22a2d1.zip
Support current location
Diffstat (limited to 'modern/src/settings/ServerPage.js')
-rw-r--r--modern/src/settings/ServerPage.js61
1 files changed, 43 insertions, 18 deletions
diff --git a/modern/src/settings/ServerPage.js b/modern/src/settings/ServerPage.js
index dccb52c6..d0810e5a 100644
--- a/modern/src/settings/ServerPage.js
+++ b/modern/src/settings/ServerPage.js
@@ -31,6 +31,7 @@ import useCommonUserAttributes from '../common/attributes/useCommonUserAttribute
import { useCatch } from '../reactHelper';
import useServerAttributes from '../common/attributes/useServerAttributes';
import useMapStyles from '../map/core/useMapStyles';
+import { map } from '../map/core/MapView';
const useStyles = makeStyles((theme) => ({
container: {
@@ -118,24 +119,6 @@ const ServerPage = () => {
))}
</Select>
</FormControl>
- <TextField
- type="number"
- value={item.latitude || 0}
- onChange={(event) => setItem({ ...item, latitude: Number(event.target.value) })}
- label={t('positionLatitude')}
- />
- <TextField
- type="number"
- value={item.longitude || 0}
- onChange={(event) => setItem({ ...item, longitude: Number(event.target.value) })}
- label={t('positionLongitude')}
- />
- <TextField
- type="number"
- value={item.zoom || 0}
- onChange={(event) => setItem({ ...item, zoom: Number(event.target.value) })}
- label={t('serverZoom')}
- />
<FormControl>
<InputLabel>{t('settingsCoordinateFormat')}</InputLabel>
<Select
@@ -229,6 +212,48 @@ const ServerPage = () => {
<Accordion>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<Typography variant="subtitle1">
+ {t('sharedLocation')}
+ </Typography>
+ </AccordionSummary>
+ <AccordionDetails className={classes.details}>
+ <TextField
+ type="number"
+ value={item.latitude || 0}
+ onChange={(event) => setItem({ ...item, latitude: Number(event.target.value) })}
+ label={t('positionLatitude')}
+ />
+ <TextField
+ type="number"
+ value={item.longitude || 0}
+ onChange={(event) => setItem({ ...item, longitude: Number(event.target.value) })}
+ label={t('positionLongitude')}
+ />
+ <TextField
+ type="number"
+ value={item.zoom || 0}
+ onChange={(event) => setItem({ ...item, zoom: Number(event.target.value) })}
+ label={t('serverZoom')}
+ />
+ <Button
+ variant="outlined"
+ color="primary"
+ onClick={() => {
+ const { lng, lat } = map.getCenter();
+ setItem({
+ ...item,
+ latitude: Number(lat.toFixed(6)),
+ longitude: Number(lng.toFixed(6)),
+ zoom: Number(map.getZoom().toFixed(1)),
+ });
+ }}
+ >
+ {t('mapCurrentLocation')}
+ </Button>
+ </AccordionDetails>
+ </Accordion>
+ <Accordion>
+ <AccordionSummary expandIcon={<ExpandMoreIcon />}>
+ <Typography variant="subtitle1">
{t('sharedPermissions')}
</Typography>
</AccordionSummary>