Skip to content

Commit 5f2ce39

Browse files
committed
different icons, show hsp count
1 parent 4fae0b1 commit 5f2ce39

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed

public/images/drinking-water.png

-6.13 KB
Loading

public/images/dumpster.png

-9.7 KB
Loading

src/components/StatusBar/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { isMobile } from 'react-device-detect';
33

4-
const StatusBar = ({ treeCount, waterSourceCount, mobileCount }) => {
4+
const StatusBar = ({ treeCount, waterSourceCount, pumpCount, mobileCount }) => {
55
const desktop = () => {
66
return (
77
<div
@@ -28,6 +28,12 @@ const StatusBar = ({ treeCount, waterSourceCount, mobileCount }) => {
2828
</div>
2929
<div style={{ paddingTop: 15, fontWeight: 'bold', float: 'left' }}>{treeCount}</div>
3030
</div>
31+
<div style={{ float: 'left', paddingRight: '40px'}}>
32+
<div style={{ paddingTop: 8, float: 'left', paddingRight: '10px' }}>
33+
<img src="images/pumpe_64.png" height={32} alt="hand swivel pump" title="Anzahl Handschwengelpumpen im aktuellen Ausschnitt"/>
34+
</div>
35+
<div style={{ paddingTop: 15, fontWeight: 'bold', float: 'left' }}>{pumpCount}</div>
36+
</div>
3137
<div style={{ float: 'left', paddingRight: '40px'}}>
3238
<div style={{ paddingTop: 8, float: 'left', paddingRight: '10px' }}>
3339
<img src="images/drinking-water.png" height={32} alt="water tap and a can" title="Anzahl Wasserquellen im aktuellen Ausschnitt"/>
@@ -71,6 +77,10 @@ const StatusBar = ({ treeCount, waterSourceCount, mobileCount }) => {
7177
{ !isMobile &&
7278
<div style={{ paddingBottom: 15, fontWeight: 'bold', paddingRight: 6 }}>{treeCount}</div>
7379
}
80+
<div style={{ paddingBottom: 5 }}>
81+
<img src="images/pumpe64.png" height={32} alt="hand swivel pump" title="Anzahl Handschwengelpumpen im aktuellen Ausschnitt"/>
82+
</div>
83+
<div style={{ paddingBottom: 15, fontWeight: 'bold', paddingRight: 6 }}>{pumpCount}</div>
7484
<div style={{ paddingBottom: 5 }}>
7585
<img src="images/drinking-water.png" height={32} alt="water tap and a can" title="Anzahl Wasserquellen im aktuellen Ausschnitt"/>
7686
</div>

src/components/TreesMap/DeckGLMap.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ interface DeckGLPropType {
4545
deckRef: any;
4646
handleViewStateChanged: any;
4747
treeCount: number;
48+
pumpCount: number;
4849
waterSourceCount: number;
4950
mobileCount: number;
5051
zoom: any;
@@ -669,7 +670,7 @@ class DeckGLMap extends React.Component<DeckGLPropType, DeckGLStateType> {
669670
}
670671

671672
render(): ReactNode {
672-
const { isNavOpen, showControls, deckRef, handleViewStateChanged, treeCount, waterSourceCount, mobileCount } = this.props;
673+
const { isNavOpen, showControls, deckRef, handleViewStateChanged, treeCount, pumpCount, waterSourceCount, mobileCount } = this.props;
673674
const { viewport } = this.state;
674675
const toggle2dAnd3d = () => {
675676
const newShow2d = !this.state.show2d;
@@ -755,6 +756,7 @@ class DeckGLMap extends React.Component<DeckGLPropType, DeckGLStateType> {
755756
</DeckGL>
756757
<StatusBar
757758
treeCount={treeCount}
759+
pumpCount={pumpCount}
758760
waterSourceCount={waterSourceCount}
759761
mobileCount={mobileCount}
760762
/>

src/components/TreesMap/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ export const Map: FC<{
3939
const history = useHistory();
4040

4141
const initialTreeCount = (treesGeoJson as any).features.length
42+
const initialPumpCount = (waterSourcesGeoJson as any).features.filter(
43+
(feature) => feature.properties?.type === 'Handschwengelpumpe').length;
4244
const initialWaterSourceCount = (waterSourcesGeoJson as any).features.filter(
43-
(feature) => feature.properties?.type !== 'LEIPZIG GIESST-Mobil').length;
45+
(feature) => feature.properties?.type !== 'LEIPZIG GIESST-Mobil' && feature.properties?.type !== 'Handschwengelpumpe').length;
4446
const initialMobileCount = (waterSourcesGeoJson as any).features.filter(
4547
(feature) => feature.properties?.type === 'LEIPZIG GIESST-Mobil').length;
4648
const [treeCount, setTreeCount] = useState(initialTreeCount);
49+
const [pumpCount, setPumpCount] = useState(initialPumpCount);
4750
const [waterSourceCount, setWaterSourceCount] = useState(initialWaterSourceCount);
4851
const [mobileCount, setMobileCount] = useState(initialMobileCount);
4952
const [zoom, setZoom] = useState(isMobile ? 13 : 11);
@@ -80,10 +83,12 @@ export const Map: FC<{
8083
} else {
8184
getTreeCount().then((count) => setTreeCount((count as number)));
8285
}
83-
getFeatureCount('waterSources', (feature) => feature?.object?.properties?.type !== 'LEIPZIG GIESST-Mobil').then((count) => setWaterSourceCount(count as number));
86+
getFeatureCount('waterSources', (feature) => feature?.object?.properties?.type === 'Handschwengelpumpe').then((count) => setPumpCount(count as number));
87+
getFeatureCount('waterSources', (feature) => feature?.object?.properties?.type !== 'LEIPZIG GIESST-Mobil' && feature?.object?.properties?.type !== 'Handschwengelpumpe').then((count) => setWaterSourceCount(count as number));
8488
getFeatureCount('waterSources', (feature) => feature?.object?.properties?.type === 'LEIPZIG GIESST-Mobil').then((count) => setMobileCount(count as number));
8589
} else {
8690
setTreeCount(initialTreeCount);
91+
setPumpCount(initialPumpCount);
8792
setWaterSourceCount(initialWaterSourceCount);
8893
setMobileCount(initialMobileCount);
8994
}
@@ -103,6 +108,7 @@ export const Map: FC<{
103108
ref={mapRef}
104109
deckRef={deckRef}
105110
treeCount={treeCount}
111+
pumpCount={pumpCount}
106112
waterSourceCount={waterSourceCount}
107113
mobileCount={mobileCount}
108114
handleViewStateChanged={onViewStateChanged}

0 commit comments

Comments
 (0)