Skip to content

Commit fbb0e05

Browse files
committed
show different state via button color
1 parent 3be532f commit fbb0e05

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/map/LocationButton.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { StartSyncCurrentLocation, StartWatchCurrentLocation } from '@/actions/A
44
import LocationError from '@/map/location_error.svg'
55
import LocationSearching from '@/map/location_searching.svg'
66
import LocationOn from '@/map/location_on.svg'
7+
import Location from '@/map/location.svg'
78
import LocationNotInSync from '@/map/location_not_in_sync.svg'
89
import { useEffect, useState } from 'react'
910
import { CurrentLocationStoreState } from '@/stores/CurrentLocationStore'
@@ -15,8 +16,10 @@ export default function LocationButton(props: { currentLocation: CurrentLocation
1516
if (props.currentLocation.enabled) {
1617
if (!props.currentLocation.syncView) setLocationSearch('on_but_not_in_sync')
1718
else if (props.currentLocation.error) setLocationSearch('error')
18-
else if (props.currentLocation.coordinate != null) setLocationSearch('initial')
19+
else if (props.currentLocation.coordinate != null) setLocationSearch('on')
1920
else setLocationSearch('search')
21+
} else {
22+
setLocationSearch('initial')
2023
}
2124
}, [
2225
props.currentLocation.syncView,
@@ -37,9 +40,10 @@ export default function LocationButton(props: { currentLocation: CurrentLocation
3740
}
3841
}}
3942
>
43+
{locationSearch == 'initial' && <Location />}
4044
{locationSearch == 'error' && <LocationError />}
4145
{locationSearch == 'search' && <LocationSearching />}
42-
{locationSearch == 'initial' && <LocationOn />}
46+
{locationSearch == 'on' && <LocationOn />}
4347
{locationSearch == 'on_but_not_in_sync' && <LocationNotInSync />}
4448
</div>
4549
)

src/map/location.svg

Lines changed: 6 additions & 0 deletions
Loading

src/map/location_on.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)