@@ -164,7 +177,7 @@ export default function MapPage() {
- )
+ );
}
+
+export default connect(
+ (state) => ({login: state.login}),
+)(MapPage);
diff --git a/frontend/src/reducers/mapConfig.ts b/frontend/src/reducers/mapConfig.ts
index e7c14cf..4d8d8dc 100644
--- a/frontend/src/reducers/mapConfig.ts
+++ b/frontend/src/reducers/mapConfig.ts
@@ -27,6 +27,9 @@ export type MapConfig = {
obsEvents: {
show: boolean;
};
+ filters: {
+ currentUser: boolean;
+ };
};
export const initialState: MapConfig = {
@@ -42,6 +45,9 @@ export const initialState: MapConfig = {
obsEvents: {
show: false,
},
+ filters: {
+ currentUser: false,
+ },
};
type MapConfigAction = {
diff --git a/frontend/src/utils.js b/frontend/src/utils.js
index 25d2977..2fdb1a7 100644
--- a/frontend/src/utils.js
+++ b/frontend/src/utils.js
@@ -1,3 +1,5 @@
+import {useRef, useCallback} from 'react'
+
// Wraps the register callback from useForm into a new ref function, such that
// any child of the provided element that is an input component will be
// registered.
@@ -22,3 +24,9 @@ export function* pairwise(it) {
lastValue = i
}
}
+
+export function useCallbackRef(fn) {
+ const fnRef = useRef()
+ fnRef.current = fn
+ return useCallback(((...args) => fnRef.current(...args)), [])
+}