Skip to content

Commit

Permalink
Redesign de la bulle d'aide au clique sur le segment
Browse files Browse the repository at this point in the history
  • Loading branch information
laem committed May 1, 2023
1 parent c4caf74 commit d1f2714
Showing 1 changed file with 42 additions and 4 deletions.
46 changes: 42 additions & 4 deletions web/app/cyclables/[ville]/Ville.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,11 @@ export default ({ ville, osmId }) => {
data={segmentsToDisplay}
eventHandlers={{
click: (e) => {
const { lat, lng: lon } = e.latlng
setClickedSegment(
clickedSegment === e.sourceTarget.feature
? null
: e.sourceTarget.feature
: { ...e.sourceTarget.feature, click: { lat, lon } }
)
},
}}
Expand All @@ -342,9 +343,46 @@ export default ({ ville, osmId }) => {
</MapContainer>
)}
</div>
{clickedSegment && (
<FriendlyObjectViewer data={clickedSegment.properties} />
)}
{clickedSegment &&
(console.log(clickedSegment) || (
<div>
<h3>Informations sur le segment cliqué</h3>
<div
css={`
a {
display: block;
margin: 0.2rem 0;
}
`}
>
<a
href={`http://maps.google.com/maps?q=&layer=c&cbll=${clickedSegment.click.lat},${clickedSegment.click.lon}`}
target="_blank"
>
📸 Vue Google StreetView
</a>
<a
href={`https://www.openstreetmap.org/query?lat=${clickedSegment.click.lat}&lon=${clickedSegment.click.lon}`}
target="_blank"
>
🗺️ Carte OpenStreetMap
</a>
</div>
<br />
<div>
Tags OSM du segment :{' '}
<ul
css={`
margin-left: 2rem;
`}
>
{clickedSegment.properties.tags.split(' ').map((tag) => (
<li key={tag}>{tag}</li>
))}
</ul>
</div>
</div>
))}
</>
)
}
Expand Down

1 comment on commit d1f2714

@vercel
Copy link

@vercel vercel bot commented on d1f2714 May 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.