aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-11 16:38:03 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-11 16:38:03 -0600
commit8038f22dc100d09ff53808d4d372567a262c24ff (patch)
treecc48f422b0a6b0c226f0e5798b0e9a27cbeb9aed
parente490ffb046eff933a134f96323c8e6c765175cf0 (diff)
downloadetbsa-traccar-web-8038f22dc100d09ff53808d4d372567a262c24ff.tar.gz
etbsa-traccar-web-8038f22dc100d09ff53808d4d372567a262c24ff.tar.bz2
etbsa-traccar-web-8038f22dc100d09ff53808d4d372567a262c24ff.zip
A lot of changes!
-rw-r--r--modern/src/LocalizationProvider.js4
-rw-r--r--modern/src/MainToolbar.js5
-rw-r--r--modern/src/common/formatter.js11
-rw-r--r--modern/src/map/StatusView.js31
-rw-r--r--web/l10n/en.json1
-rw-r--r--web/l10n/es.json1
6 files changed, 20 insertions, 33 deletions
diff --git a/modern/src/LocalizationProvider.js b/modern/src/LocalizationProvider.js
index cc23d72..1069075 100644
--- a/modern/src/LocalizationProvider.js
+++ b/modern/src/LocalizationProvider.js
@@ -131,12 +131,12 @@ const getDefaultLanguage = () => {
}
}
}
- return 'en';
+ return 'es';
};
const LocalizationContext = createContext({
languages,
- language: 'en',
+ language: 'es',
setLanguage: () => {},
});
diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js
index cd7abe0..73fdf51 100644
--- a/modern/src/MainToolbar.js
+++ b/modern/src/MainToolbar.js
@@ -5,7 +5,6 @@ import { useDispatch, useSelector } from 'react-redux';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
-import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';
import CloseIcon from '@material-ui/icons/Close';
@@ -18,7 +17,6 @@ import MapIcon from '@material-ui/icons/Map';
import PersonIcon from '@material-ui/icons/Person';
import DescriptionIcon from '@material-ui/icons/Description';
import ReplayIcon from '@material-ui/icons/Replay';
-import { sessionActions } from './store';
import * as selectors from './common/selectors';
import { useTranslation } from './LocalizationProvider';
@@ -41,7 +39,6 @@ const useStyles = makeStyles((theme) => ({
const MainToolbar = () => {
const classes = useStyles();
const history = useHistory();
- const dispatch = useDispatch();
const t = useTranslation();
const userId = useSelector(selectors.getUserId);
@@ -67,7 +64,7 @@ const MainToolbar = () => {
<MenuIcon />
</IconButton>
<Typography variant="h6" color="inherit" className={classes.flex}>
- Traccar
+ ETBSA
</Typography>
<IconButton
color="inherit"
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js
index 0ff4e74..22d1654 100644
--- a/modern/src/common/formatter.js
+++ b/modern/src/common/formatter.js
@@ -49,12 +49,12 @@ export const formatDistance = (value, unit, t) => {
export const formatSpeed = (value, unit, t) => {
switch (unit) {
case 'kmh':
- return `${(value * 1.852).toFixed(2)} ${t('sharedKmh')}`;
+ return `${(value * 1.852).toFixed(0)} ${t('sharedKmh')}`;
case 'mph':
- return `${(value * 1.15078).toFixed(2)} ${t('sharedMph')}`;
+ return `${(value * 1.15078).toFixed(0)} ${t('sharedMph')}`;
case 'kn':
default:
- return `${(value * 1).toFixed(2)} ${t('sharedKn')}`;
+ return `${(value * 1).toFixed(0)} ${t('sharedKn')}`;
}
};
@@ -70,7 +70,10 @@ export const formatVolume = (value, unit, t) => {
}
};
-export const formatHours = (value) => moment.duration(value).humanize();
+export const formatHours = (value, t) => {
+ moment.locale('es');
+ return `${moment.duration(value).asHours().toFixed(0)} ${t('sharedHours')}`;
+}
export const formatCoordinate = (key, value, unit) => {
let hemisphere;
diff --git a/modern/src/map/StatusView.js b/modern/src/map/StatusView.js
index 47a7516..ad6022e 100644
--- a/modern/src/map/StatusView.js
+++ b/modern/src/map/StatusView.js
@@ -14,7 +14,7 @@ import DeleteIcon from '@material-ui/icons/Delete';
import LinkIcon from '@material-ui/icons/Link';
import {
- formatPosition, getStatusColor, getBatteryStatus, formatDistance, formatSpeed,
+ formatPosition, getStatusColor, getBatteryStatus, formatDistance, formatSpeed, formatDate, formatHours,
} from '../common/formatter';
import { useAttributePreference } from '../common/preferences';
import RemoveDialog from '../RemoveDialog';
@@ -73,10 +73,10 @@ const StatusView = ({
<Grid container direction="column">
<Grid item>
<List>
- <ListItem classes={{ container: classes.listItemContainer }}>
- <ListItemText primary={t('deviceStatus')} />
+ <ListItem classes={{ container: classes.listItemContainer}}>
+ <ListItemText primary={t('positionDatetime')} />
<ListItemSecondaryAction>
- <span className={classes[getStatusColor(device.status)]}>{device.status}</span>
+ {formatDate(position.serverTime)}
</ListItemSecondaryAction>
</ListItem>
<ListItem classes={{ container: classes.listItemContainer }}>
@@ -85,28 +85,13 @@ const StatusView = ({
{formatSpeed(position.speed, speedUnit, t)}
</ListItemSecondaryAction>
</ListItem>
- {position.attributes.batteryLevel && (
+ {position.attributes.hours && (
<ListItem classes={{ container: classes.listItemContainer }}>
- <ListItemText primary={t('positionBattery')} />
+ <ListItemText primary={t('positionHours')} />
<ListItemSecondaryAction>
- <span className={classes[getBatteryStatus(position.attributes.batteryLevel)]}>
- {formatPosition(position.attributes.batteryLevel, 'batteryLevel', t)}
- </span>
+ {formatHours(position.attributes.hours, t)}
</ListItemSecondaryAction>
- </ListItem>
- )}
- <ListItem classes={{ container: classes.listItemContainer }}>
- <ListItemText primary={t('positionDistance')} />
- <ListItemSecondaryAction>
- {formatDistance(position.attributes.totalDistance, distanceUnit, t)}
- </ListItemSecondaryAction>
- </ListItem>
- <ListItem classes={{ container: classes.listItemContainer }}>
- <ListItemText primary={t('positionCourse')} />
- <ListItemSecondaryAction>
- {formatPosition(position.course, 'course', t)}
- </ListItemSecondaryAction>
- </ListItem>
+ </ListItem>)}
</List>
</Grid>
<Grid item container>
diff --git a/web/l10n/en.json b/web/l10n/en.json
index 3721436..a8b7c02 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -237,6 +237,7 @@
"positionDriverUniqueId": "Driver Unique Id",
"positionImage": "Image",
"positionAudio": "Audio",
+ "positionDatetime": "Datetime",
"serverTitle": "Server Settings",
"serverZoom": "Zoom",
"serverRegistration": "Registration",
diff --git a/web/l10n/es.json b/web/l10n/es.json
index 002b521..c131d10 100644
--- a/web/l10n/es.json
+++ b/web/l10n/es.json
@@ -237,6 +237,7 @@
"positionDriverUniqueId": "ID Único de conductor",
"positionImage": "Imagen",
"positionAudio": "Audio",
+ "positionDatetime": "Fecha y hora",
"serverTitle": "Ajustes del servidor",
"serverZoom": "Zoom",
"serverRegistration": "Registro",