Skip to content

Commit

Permalink
chore: remove hardcoded value (still WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
lightlii committed Aug 14, 2023
1 parent 8494d0e commit be8a4d0
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/renderer/components/MapFilter/MapView/BackgroundMapSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@ import { defineMessages, useIntl } from 'react-intl'
import { Close } from '@material-ui/icons'
import { MapPreviewCard } from './MapPreviewCard'
import { useBackgroundMapStore } from '../../../hooks/store'

const STYLES = [
{
id: '7p2524cknfdg2pqntxv2qs592nd6x6xt',
name: 'trails-with-a-name',
bytesStored: 969515,
url: 'http://127.0.0.1:5300/styles/7p2524cknfdg2pqntxv2qs592nd6x6xt'
},
{
id: 'xhe52hsmq65w15emmr2zehw3d6jjtha0',
name: 'other-map-with-another-name',
bytesStored: 969515,
url: 'mapbox://styles/mapbox/streets-v12'
}
]
import { useMapServerQuery } from '../../../hooks/useMapServerQuery'

const m = defineMessages({
// Title for background maps overlay
Expand All @@ -44,6 +30,9 @@ export const BackgroundMapSelector = ({ active, dismiss }) => {
store.setMapStyle
])

// will use new hook once merged
const { data: mapStyles, isLoading } = useMapServerQuery('/styles', false)

Check failure on line 34 in src/renderer/components/MapFilter/MapView/BackgroundMapSelector.js

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, x64, main)

'isLoading' is assigned a value but never used

return (
<Slide direction='up' in={active} mountOnEnter unmountOnExit>
<Paper elevation={2} className={classes.container}>
Expand All @@ -59,8 +48,9 @@ export const BackgroundMapSelector = ({ active, dismiss }) => {
</Box>
{/* MAP STYLES ROW */}
<Box className={classes.styleRow}>
{STYLES.filter(({ isImporting }) => !isImporting).map(
({ id, url, name }) => {
{mapStyles
.filter(({ isImporting }) => !isImporting)
.map(({ id, url, name }) => {
const isSelected = mapStyle === id
return (
<>
Expand All @@ -78,8 +68,7 @@ export const BackgroundMapSelector = ({ active, dismiss }) => {
</div>
</>
)
}
)}
})}
</Box>
</Paper>
</Slide>
Expand Down

0 comments on commit be8a4d0

Please sign in to comment.