-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bring in ui polish with latest code + add interactions between map an…
…d table (#132) * bring in ui polish with latest code * give selected layer color * refactor logic to handle incoming data from different places; renamed a component and some related variables for clarity * edit code comments
- Loading branch information
Showing
26 changed files
with
373 additions
and
159 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,9 @@ input[type="checkbox"] { | |
} | ||
|
||
.map-container { | ||
height: 650px; | ||
height: 85vh; | ||
} | ||
|
||
.map-thumbnail { | ||
height: 40vh; | ||
} |
Binary file modified
BIN
+291 Bytes
(190%)
asset_dashboard/static/images/favicon-16x16.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+658 Bytes
(230%)
asset_dashboard/static/images/favicon-32x32.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
24 changes: 24 additions & 0 deletions
24
asset_dashboard/static/js/components/map_utils/ShowPopup.js
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,24 @@ | ||
import React, { useEffect } from 'react' | ||
import { useMap } from 'react-leaflet' | ||
|
||
export default function ShowPopup({ geojson }) { | ||
const map = useMap() | ||
|
||
useEffect(() => { | ||
map.eachLayer((layer) => { | ||
if (layer.feature == geojson) { | ||
layer.openPopup() | ||
|
||
// Make the layer appear selected. | ||
layer.setStyle({ | ||
fillColor: '#3388ff', | ||
fillOpacity: '0.2', | ||
color: '#3388ff', | ||
weight: '4' | ||
}) | ||
} | ||
}) | ||
}, [geojson]) | ||
|
||
return null | ||
} |
36 changes: 36 additions & 0 deletions
36
asset_dashboard/static/js/components/map_utils/bindPopup.js
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,36 @@ | ||
import React from 'react' | ||
import ReactDOMServer from 'react-dom/server' | ||
|
||
function Popup({ feature }) { | ||
const properties = feature.properties | ||
return ( | ||
<> | ||
{properties && | ||
<div> | ||
<h6>Asset Info</h6> | ||
<ul className='list-group list-group-flush'> | ||
<li className='list-group-item'> | ||
<strong>ID:</strong> {properties.asset_id ? properties.asset_id : properties.identifier } | ||
</li> | ||
<li className='list-group-item'> | ||
<strong>Name:</strong> {properties.asset_name ? properties.asset_name : properties.name } | ||
</li> | ||
{properties.asset_type | ||
&& <li className='list-group-item'> | ||
<strong>Asset Type:</strong> {properties.asset_type} | ||
</li> | ||
} | ||
</ul> | ||
</div> | ||
} | ||
</> | ||
) | ||
} | ||
|
||
export default function bindPopup(feature, layer, autoShow=false) { | ||
const popupContent = ReactDOMServer.renderToString( | ||
<Popup feature={feature} /> | ||
) | ||
|
||
layer.bindPopup(popupContent) | ||
} |
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
Oops, something went wrong.