From 8c167d82b75b764d3b12845aae7827550607a148 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Sun, 1 Nov 2020 18:46:06 +0530 Subject: Revert all the code formatting applied by vscode --- modern/src/App.js | 38 ++++++++----------- modern/src/MainToolbar.js | 70 +++++++++++++++++------------------ modern/src/reports/EventReportPage.js | 28 +++++--------- modern/src/reports/ReportFilter.js | 19 ++++------ 4 files changed, 65 insertions(+), 90 deletions(-) (limited to 'modern/src') diff --git a/modern/src/App.js b/modern/src/App.js index edfaa55..6ea7429 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Switch, Route } from 'react-router-dom'; +import { Switch, Route } from 'react-router-dom' import CssBaseline from '@material-ui/core/CssBaseline'; import MainPage from './MainPage'; import LoginPage from './LoginPage'; @@ -22,30 +22,22 @@ const App = () => { - - - - - - - - - - - - - + + + + + + + + + + + + + ); -}; +} export default App; diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js index 7cca74f..897fd37 100644 --- a/modern/src/MainToolbar.js +++ b/modern/src/MainToolbar.js @@ -31,15 +31,15 @@ import TrendingUpIcon from '@material-ui/icons/TrendingUp'; import FolderIcon from '@material-ui/icons/Folder'; import t from './common/localization'; -const useStyles = makeStyles((theme) => ({ +const useStyles = makeStyles(theme => ({ flex: { - flexGrow: 1, + flexGrow: 1 }, appBar: { zIndex: theme.zIndex.drawer + 1, }, list: { - width: 250, + width: 250 }, menuButton: { marginLeft: -12, @@ -52,19 +52,11 @@ const MainToolbar = () => { const [drawer, setDrawer] = useState(false); const classes = useStyles(); const history = useHistory(); - const adminEnabled = useSelector( - (state) => state.session.user && state.session.user.administrator - ); - const userId = useSelector( - (state) => state.session.user && state.session.user.id - ); + const adminEnabled = useSelector(state => state.session.user && state.session.user.administrator); + const userId = useSelector(state => state.session.user && state.session.user.id); - 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' }); @@ -72,7 +64,7 @@ const MainToolbar = () => { dispatch(sessionActions.updateUser(null)); history.push('/login'); } - }; + } return ( <> @@ -81,16 +73,13 @@ const MainToolbar = () => { + onClick={openDrawer}> Traccar - - + + @@ -99,8 +88,7 @@ const MainToolbar = () => { className={classes.list} role="button" onClick={closeDrawer} - onKeyDown={closeDrawer} - > + onKeyDown={closeDrawer}> history.push('/')}> @@ -110,7 +98,12 @@ const MainToolbar = () => { - {t('reportTitle')}}> + + {t('reportTitle')} + + }> history.push('/reports/route')}> @@ -149,21 +142,19 @@ const MainToolbar = () => { - {t('settingsTitle')}}> - history.push(`/user/${userId}`)} - > + + {t('settingsTitle')} + + }> + history.push(`/user/${userId}`)}> - history.push('/settings/notifications')} - > + history.push('/settings/notifications')}> @@ -179,7 +170,12 @@ const MainToolbar = () => { {adminEnabled && ( <> - {t('userAdmin')}}> + + {t('userAdmin')} + + }> history.push('/admin/server')}> @@ -205,6 +201,6 @@ const MainToolbar = () => { ); -}; +} export default MainToolbar; diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index 0a451c1..4134de3 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -1,21 +1,11 @@ import React, { useState } from 'react'; import MainToolbar from '../MainToolbar'; -import { - Grid, - TableContainer, - Table, - TableRow, - TableCell, - TableHead, - TableBody, - Paper, - makeStyles, -} from '@material-ui/core'; +import { Grid, TableContainer, Table, TableRow, TableCell, TableHead, TableBody, Paper, makeStyles } from '@material-ui/core'; import t from '../common/localization'; import { formatPosition } from '../common/formatter'; import ReportFilter from './ReportFilter'; -const useStyles = makeStyles((theme) => ({ +const useStyles = makeStyles(theme => ({ root: { height: '100%', display: 'flex', @@ -41,14 +31,14 @@ const EventReportPage = () => { from: from.toISOString(), to: to.toISOString(), }); - fetch(`/api/reports/events?${query.toString()}`, { - headers: { Accept: 'application/json' }, - }).then((response) => { - if (response.ok) { - response.json().then(setData); + + fetch(`/api/reports/events?${query.toString()}`, { headers: { Accept: 'application/json' } }) + .then((response) => { + if (response.ok) { + response.json().then(setData); } }); - }; + } return (
@@ -90,6 +80,6 @@ const EventReportPage = () => {
); -}; +} export default EventReportPage; diff --git a/modern/src/reports/ReportFilter.js b/modern/src/reports/ReportFilter.js index 55f73e3..6f24804 100644 --- a/modern/src/reports/ReportFilter.js +++ b/modern/src/reports/ReportFilter.js @@ -1,12 +1,5 @@ import React, { useState } from 'react'; -import { - FormControl, - InputLabel, - Select, - MenuItem, - Button, - TextField, -} from '@material-ui/core'; +import { FormControl, InputLabel, Select, MenuItem, Button, TextField } from '@material-ui/core'; import t from '../common/localization'; import { useSelector } from 'react-redux'; import moment from 'moment'; @@ -17,6 +10,7 @@ const ReportFilter = (props) => { const [period, setPeriod] = useState('today'); const [from, setFrom] = useState(moment().subtract(1, 'hour')); const [to, setTo] = useState(moment()); + const handleShow = () => { let selectedFrom; let selectedTo; @@ -52,7 +46,9 @@ const ReportFilter = (props) => { } props.handleSubmit(deviceId, selectedFrom, selectedTo); - }; + + } + return ( <> @@ -114,6 +110,7 @@ const ReportFilter = (props) => { ); -}; + +} -export default ReportFilter; +export default ReportFilter; \ No newline at end of file -- cgit v1.2.3