From f60983a4131862db0125844a651b994d2212022d Mon Sep 17 00:00:00 2001 From: Desmond Kyeremeh Date: Mon, 12 Jul 2021 03:30:34 +0000 Subject: Restored styling --- modern/src/MainToolbar.js | 12 +++------- modern/src/admin/StatisticsPage.js | 33 +++++++-------------------- modern/src/admin/UsersPage.js | 6 +---- modern/src/attributes/EditAttributesView.js | 3 +-- 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 8b6c22c..59c2eca 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 = () => { Traccar - + diff --git a/modern/src/admin/StatisticsPage.js b/modern/src/admin/StatisticsPage.js index 20974f4..1f32c3d 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 9b51cdd..a8b3c84 100644 --- a/modern/src/admin/UsersPage.js +++ b/modern/src/admin/UsersPage.js @@ -62,11 +62,7 @@ const UsersView = ({ updateTimestamp, onMenuClick }) => { const UsersPage = () => ( - + ); diff --git a/modern/src/attributes/EditAttributesView.js b/modern/src/attributes/EditAttributesView.js index e8d427b..e38c02a 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 d376f23..9f131d3 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 && ( - onMenuClick(event.currentTarget, item.id)} - > + onMenuClick(event.currentTarget, item.id)}> -- cgit v1.2.3