From 48489f116b996ceebd7e3a8d08b2223d4f8021cf Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Tue, 13 Apr 2021 17:48:27 +0530 Subject: Event Type Localization and geofence store creation --- modern/src/App.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modern/src/App.js') diff --git a/modern/src/App.js b/modern/src/App.js index a01451b4..ef5fd204 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -30,6 +30,8 @@ import MaintenancesPage from './settings/MaintenancesPage'; import MaintenancePage from './settings/MaintenancePage'; import StatisticsPage from './admin/StatisticsPage'; +import MainController from './MainController'; + const App = () => { const initialized = useSelector(state => !!state.session.server && !!state.session.user); @@ -37,6 +39,7 @@ const App = () => { <> + -- cgit v1.2.3 From 006ee184700c3fb04267950e52a39c697500e66c Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Fri, 16 Apr 2021 19:02:35 +0530 Subject: Rename the MainController to CachingController --- modern/src/App.js | 4 ++-- modern/src/CachingController.js | 22 ++++++++++++++++++++++ modern/src/MainController.js | 22 ---------------------- 3 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 modern/src/CachingController.js delete mode 100644 modern/src/MainController.js (limited to 'modern/src/App.js') diff --git a/modern/src/App.js b/modern/src/App.js index ef5fd204..7f8a5829 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -30,7 +30,7 @@ import MaintenancesPage from './settings/MaintenancesPage'; import MaintenancePage from './settings/MaintenancePage'; import StatisticsPage from './admin/StatisticsPage'; -import MainController from './MainController'; +import CachingController from './CachingController'; const App = () => { const initialized = useSelector(state => !!state.session.server && !!state.session.user); @@ -39,7 +39,7 @@ const App = () => { <> - + diff --git a/modern/src/CachingController.js b/modern/src/CachingController.js new file mode 100644 index 00000000..7adb39b8 --- /dev/null +++ b/modern/src/CachingController.js @@ -0,0 +1,22 @@ +import { useDispatch, useSelector } from 'react-redux'; +import { connect } from 'react-redux'; +import { geofencesActions } from './store'; +import { useEffectAsync } from './reactHelper'; + + +const CachingController = () => { + const authenticated = useSelector(state => !!state.session.user); + const dispatch = useDispatch(); + + useEffectAsync(async () => { + if (authenticated) { + const response = await fetch('/api/geofences'); + if (response.ok) { + dispatch(geofencesActions.update(await response.json())); + } + } + }, [authenticated]); + return null; +} + +export default connect()(CachingController); diff --git a/modern/src/MainController.js b/modern/src/MainController.js deleted file mode 100644 index f8f6d684..00000000 --- a/modern/src/MainController.js +++ /dev/null @@ -1,22 +0,0 @@ -import { useDispatch, useSelector } from 'react-redux'; -import { connect } from 'react-redux'; -import { geofencesActions } from './store'; -import { useEffectAsync } from './reactHelper'; - - -const MainController = () => { - const authenticated = useSelector(state => !!state.session.user); - const dispatch = useDispatch(); - - useEffectAsync(async () => { - if (authenticated) { - const response = await fetch('/api/geofences'); - if (response.ok) { - dispatch(geofencesActions.update(await response.json())); - } - } - }, [authenticated]); - return null; -} - -export default connect()(MainController); -- cgit v1.2.3 From 2691e78cd4d5486581656a490b9fb5386e68a5d9 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Mon, 19 Apr 2021 13:12:57 +0530 Subject: More code formatting --- modern/src/App.js | 1 - modern/src/CachingController.js | 2 +- modern/src/reports/EventReportPage.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'modern/src/App.js') diff --git a/modern/src/App.js b/modern/src/App.js index 7f8a5829..5fd10deb 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -29,7 +29,6 @@ import ComputedAttributePage from './settings/ComputedAttributePage'; import MaintenancesPage from './settings/MaintenancesPage'; import MaintenancePage from './settings/MaintenancePage'; import StatisticsPage from './admin/StatisticsPage'; - import CachingController from './CachingController'; const App = () => { diff --git a/modern/src/CachingController.js b/modern/src/CachingController.js index 7adb39b8..fa3b9f6b 100644 --- a/modern/src/CachingController.js +++ b/modern/src/CachingController.js @@ -3,7 +3,6 @@ import { connect } from 'react-redux'; import { geofencesActions } from './store'; import { useEffectAsync } from './reactHelper'; - const CachingController = () => { const authenticated = useSelector(state => !!state.session.user); const dispatch = useDispatch(); @@ -16,6 +15,7 @@ const CachingController = () => { } } }, [authenticated]); + return null; } diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index 2478cad0..a14fc930 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -63,7 +63,7 @@ const EventReportPage = () => { const [items, setItems] = useState([]); const formatGeofence = value => { - if (value !== 0) { + if (value > 0) { const geofence = geofences[value]; return geofence ? geofence.name : ''; } -- cgit v1.2.3