diff options
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/MainToolbar.js | 12 | ||||
-rw-r--r-- | modern/src/admin/StatisticsPage.js | 33 | ||||
-rw-r--r-- | modern/src/admin/UsersPage.js | 6 | ||||
-rw-r--r-- | modern/src/attributes/EditAttributesView.js | 3 | ||||
-rw-r--r-- | modern/src/settings/ComputedAttributesPage.js | 8 |
5 files changed, 15 insertions, 47 deletions
diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js index 8b6c22cb..59c2eca8 100644 --- a/modern/src/MainToolbar.js +++ b/modern/src/MainToolbar.js @@ -44,12 +44,8 @@ const MainToolbar = () => { const history = useHistory(); const userId = useSelector(selectors.getUserId); - const openDrawer = () => { - setDrawer(true); - }; - const closeDrawer = () => { - setDrawer(false); - }; + const openDrawer = () => { setDrawer(true); }; + const closeDrawer = () => { setDrawer(false); }; const handleLogout = async () => { const response = await fetch('/api/session', { method: 'DELETE' }); @@ -73,9 +69,7 @@ const MainToolbar = () => { <Typography variant="h6" color="inherit" className={classes.flex}> Traccar </Typography> - <Button color="inherit" onClick={handleLogout}> - {t('loginLogout')} - </Button> + <Button color="inherit" onClick={handleLogout}>{t('loginLogout')}</Button> </Toolbar> </AppBar> <Drawer open={drawer} onClose={closeDrawer}> diff --git a/modern/src/admin/StatisticsPage.js b/modern/src/admin/StatisticsPage.js index 20974f4d..1f32c3d9 100644 --- a/modern/src/admin/StatisticsPage.js +++ b/modern/src/admin/StatisticsPage.js @@ -21,36 +21,24 @@ const Filter = ({ setItems }) => { selectedTo = moment().endOf('day'); break; case 'yesterday': - selectedFrom = moment() - .subtract(1, 'day') - .startOf('day'); - selectedTo = moment() - .subtract(1, 'day') - .endOf('day'); + selectedFrom = moment().subtract(1, 'day').startOf('day'); + selectedTo = moment().subtract(1, 'day').endOf('day'); break; case 'thisWeek': selectedFrom = moment().startOf('week'); selectedTo = moment().endOf('week'); break; case 'previousWeek': - selectedFrom = moment() - .subtract(1, 'week') - .startOf('week'); - selectedTo = moment() - .subtract(1, 'week') - .endOf('week'); + selectedFrom = moment().subtract(1, 'week').startOf('week'); + selectedTo = moment().subtract(1, 'week').endOf('week'); break; case 'thisMonth': selectedFrom = moment().startOf('month'); selectedTo = moment().endOf('month'); break; case 'previousMonth': - selectedFrom = moment() - .subtract(1, 'month') - .startOf('month'); - selectedTo = moment() - .subtract(1, 'month') - .endOf('month'); + selectedFrom = moment().subtract(1, 'month').startOf('month'); + selectedTo = moment().subtract(1, 'month').endOf('month'); break; default: selectedFrom = from; @@ -58,13 +46,8 @@ const Filter = ({ setItems }) => { break; } - const query = new URLSearchParams({ - from: selectedFrom.toISOString(), - to: selectedTo.toISOString(), - }); - const response = await fetch(`/api/statistics?${query.toString()}`, { - Accept: 'application/json', - }); + const query = new URLSearchParams({ from: selectedFrom.toISOString(), to: selectedTo.toISOString() }); + const response = await fetch(`/api/statistics?${query.toString()}`, { Accept: 'application/json' }); if (response.ok) { setItems(await response.json()); } diff --git a/modern/src/admin/UsersPage.js b/modern/src/admin/UsersPage.js index 9b51cdd0..a8b3c849 100644 --- a/modern/src/admin/UsersPage.js +++ b/modern/src/admin/UsersPage.js @@ -62,11 +62,7 @@ const UsersView = ({ updateTimestamp, onMenuClick }) => { const UsersPage = () => ( <OptionsLayout> - <EditCollectionView - content={UsersView} - editPath="/user" - endpoint="users" - /> + <EditCollectionView content={UsersView} editPath="/user" endpoint="users" /> </OptionsLayout> ); diff --git a/modern/src/attributes/EditAttributesView.js b/modern/src/attributes/EditAttributesView.js index e8d427bf..e38c02ae 100644 --- a/modern/src/attributes/EditAttributesView.js +++ b/modern/src/attributes/EditAttributesView.js @@ -43,8 +43,7 @@ const EditAttributesView = ({ attributes, setAttributes, definitions }) => { const getAttributeType = (value) => { if (typeof value === 'number') { return 'number'; - } - if (typeof value === 'boolean') { + } if (typeof value === 'boolean') { return 'boolean'; } return 'string'; diff --git a/modern/src/settings/ComputedAttributesPage.js b/modern/src/settings/ComputedAttributesPage.js index d376f23f..9f131d33 100644 --- a/modern/src/settings/ComputedAttributesPage.js +++ b/modern/src/settings/ComputedAttributesPage.js @@ -20,9 +20,7 @@ const ComputedAttributeView = ({ updateTimestamp, onMenuClick }) => { const classes = useStyles(); const [items, setItems] = useState([]); - const adminEnabled = useSelector( - (state) => state.session.user && state.session.user.administrator, - ); + const adminEnabled = useSelector((state) => state.session.user && state.session.user.administrator); useEffectAsync(async () => { const response = await fetch('/api/attributes/computed'); @@ -49,9 +47,7 @@ const ComputedAttributeView = ({ updateTimestamp, onMenuClick }) => { {adminEnabled && ( <TableCell className={classes.columnAction} padding="none"> - <IconButton - onClick={(event) => onMenuClick(event.currentTarget, item.id)} - > + <IconButton onClick={(event) => onMenuClick(event.currentTarget, item.id)}> <MoreVertIcon /> </IconButton> </TableCell> |