File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 11import styles from './LocationButton.module.css'
22import Dispatcher from '@/stores/Dispatcher'
3- import { StartSyncCurrentLocation , StartWatchCurrentLocation } from '@/actions/Actions'
3+ import { StartSyncCurrentLocation , StartWatchCurrentLocation , StopWatchCurrentLocation } from '@/actions/Actions'
44import LocationError from '@/map/location_error.svg'
55import LocationSearching from '@/map/location_searching.svg'
66import LocationOn from '@/map/location_on.svg'
@@ -32,11 +32,14 @@ export default function LocationButton(props: { currentLocation: CurrentLocation
3232 < div
3333 className = { styles . locationOnOff }
3434 onClick = { ( ) => {
35- if ( props . currentLocation . enabled && ! props . currentLocation . error ) {
35+ if ( props . currentLocation . enabled && ! props . currentLocation . syncView && ! props . currentLocation . error ) {
3636 Dispatcher . dispatch ( new StartSyncCurrentLocation ( ) )
3737 } else {
38- Dispatcher . dispatch ( new StartWatchCurrentLocation ( ) )
39- setLocationSearch ( 'search' )
38+ if ( props . currentLocation . enabled ) {
39+ Dispatcher . dispatch ( new StopWatchCurrentLocation ( ) )
40+ } else {
41+ Dispatcher . dispatch ( new StartWatchCurrentLocation ( ) )
42+ }
4043 }
4144 } }
4245 >
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ export default class CurrentLocationStore extends Store<CurrentLocationStoreStat
4848 coordinate : null ,
4949 }
5050 } else if ( action instanceof StopWatchCurrentLocation ) {
51- // TODO NOW stop location watching e.g. when pressing the location button once again if it shows 'success'
5251 this . stop ( )
5352 return {
5453 ...state ,
You can’t perform that action at this time.
0 commit comments