aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
Diffstat (limited to 'modern')
-rw-r--r--modern/src/SocketController.js7
-rw-r--r--modern/src/main/MainPage.js7
2 files changed, 11 insertions, 3 deletions
diff --git a/modern/src/SocketController.js b/modern/src/SocketController.js
index bfc0378d..baecbfce 100644
--- a/modern/src/SocketController.js
+++ b/modern/src/SocketController.js
@@ -11,6 +11,7 @@ import usePersistedState from './common/util/usePersistedState';
import alarm from './resources/alarm.mp3';
import { eventsActions } from './store/events';
+import useFeatures from './common/util/useFeatures';
const SocketController = () => {
const dispatch = useDispatch();
@@ -28,6 +29,8 @@ const SocketController = () => {
const [soundEvents] = usePersistedState('soundEvents', []);
const [soundAlarms] = usePersistedState('soundAlarms', ['sos']);
+ const features = useFeatures();
+
const connectSocket = () => {
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const socket = new WebSocket(`${protocol}//${window.location.host}/api/socket`);
@@ -61,7 +64,9 @@ const SocketController = () => {
dispatch(positionsActions.update(data.positions));
}
if (data.events) {
- dispatch(eventsActions.add(data.events));
+ if (!features.disableEvents) {
+ dispatch(eventsActions.add(data.events));
+ }
setEvents(data.events);
}
};
diff --git a/modern/src/main/MainPage.js b/modern/src/main/MainPage.js
index 31248271..fb748a68 100644
--- a/modern/src/main/MainPage.js
+++ b/modern/src/main/MainPage.js
@@ -38,6 +38,7 @@ import MapGeocoder from '../map/geocoder/MapGeocoder';
import MapScale from '../map/MapScale';
import MapNotification from '../map/notification/MapNotification';
import EventsDrawer from './EventsDrawer';
+import useFeatures from '../common/util/useFeatures';
const useStyles = makeStyles((theme) => ({
root: {
@@ -143,6 +144,8 @@ const MainPage = () => {
const desktop = useMediaQuery(theme.breakpoints.up('md'));
const phone = useMediaQuery(theme.breakpoints.down('sm'));
+ const features = useFeatures();
+
const [mapMapOnSelect] = usePersistedState('mapOnSelect', false);
const [mapLiveRoutes] = usePersistedState('mapLiveRoutes', false);
@@ -223,7 +226,7 @@ const MainPage = () => {
<MapScale />
<MapCurrentLocation />
<MapGeocoder />
- <MapNotification enabled={eventsAvailable} onClick={eventHandler} />
+ {!features.disableEvents && <MapNotification enabled={eventsAvailable} onClick={eventHandler} />}
{desktop && <MapPadding left={parseInt(theme.dimensions.drawerWidthDesktop, 10)} />}
<Button
variant="contained"
@@ -334,7 +337,7 @@ const MainPage = () => {
<BottomMenu />
</div>
)}
- <EventsDrawer open={eventsOpen} onClose={() => setEventsOpen(false)} />
+ {!features.disableEvents && <EventsDrawer open={eventsOpen} onClose={() => setEventsOpen(false)} />}
{selectedDeviceId && (
<div className={classes.statusCard}>
<StatusCard