-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from laem/debug
v2
- Loading branch information
Showing
21 changed files
with
8,545 additions
and
9,706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react' | ||
|
||
export default ({ | ||
ville, | ||
exceptions, | ||
toggleException, | ||
debugData, | ||
villeExceptions | ||
}) => { | ||
if (!debugData) return null | ||
const { properties } = debugData | ||
const [long, lat] = debugData.geometry.coordinates[0][0] | ||
return ( | ||
<div | ||
css={` | ||
background: white; | ||
width: 80%; | ||
margin: 0 auto; | ||
a { | ||
margin: 0.3rem; | ||
} | ||
`} | ||
> | ||
{properties ? ( | ||
<> | ||
{' '} | ||
<blockquote>{JSON.stringify(properties, null, 2)}</blockquote> | ||
<a | ||
href={`http://maps.google.com/maps?q=&layer=c&cbll=${lat},${long}`} | ||
target="_blank" | ||
> | ||
Vue Google StreetView | ||
</a> | ||
<a | ||
href={`https://www.openstreetmap.org/${properties.id}`} | ||
target="_blank" | ||
> | ||
Page OSM | ||
</a> | ||
<button onClick={() => toggleException(ville, properties.id)}> | ||
{villeExceptions.includes(properties.id) | ||
? 'Re-sélectionner' | ||
: 'Mettre sur le banc'} | ||
</button> | ||
<button | ||
onClick={() => | ||
navigator.clipboard.writeText(JSON.stringify(exceptions, null, 2)) | ||
} | ||
> | ||
Copier les exceptions | ||
</button> | ||
</> | ||
) : ( | ||
"Cliquez sur une forme pour l'inspecter" | ||
)} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { PureComponent } from 'react' | ||
import { Layer, Feature } from 'react-mapbox-gl' | ||
|
||
export default class DebugMap extends PureComponent { | ||
render() { | ||
const { villeExceptions, data, setDebugData } = this.props | ||
return ( | ||
<> | ||
<Layer | ||
type="fill" | ||
paint={{ | ||
'fill-color': 'red', | ||
'fill-opacity': 0.5 | ||
}} | ||
> | ||
{data.polygons | ||
.filter(f => villeExceptions.includes(f.properties.id)) | ||
.map(polygon => ( | ||
<Feature | ||
onClick={() => setDebugData(polygon)} | ||
coordinates={polygon.geometry.coordinates} | ||
></Feature> | ||
))} | ||
</Layer> | ||
<Layer | ||
type="fill" | ||
paint={{ | ||
'fill-color': 'blue', | ||
'fill-opacity': 0.5 | ||
}} | ||
> | ||
{data.polygons | ||
.filter(f => !villeExceptions.includes(f.properties.id)) | ||
.map(polygon => ( | ||
<Feature | ||
onClick={() => setDebugData(polygon)} | ||
coordinates={polygon.geometry.coordinates} | ||
></Feature> | ||
))} | ||
</Layer> | ||
</> | ||
) | ||
} | ||
} |
Oops, something went wrong.