Skip to content

Commit 62f2d2c

Browse files
author
riteshsangwan
committed
mark rtfzs as optional
1 parent 6c9800b commit 62f2d2c

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

src/routes/MissionPlanner/components/MissionMap/MissionMap.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const MissionGoogleMap = withGoogleMap((props) => (
4747
))}
4848
<Polyline {...polylineConfig} path={props.lineMarkerPositions} />
4949
{props.noFlyZones.map((zone) => <NoFlyZone key={zone.id} zone={zone} />)}
50-
{props.rtfzs.filter((single) => single.show === true).map((rtfz) => <Rtfz key={rtfz._id} zone={rtfz} />)}
50+
{props.rtfzs && props.rtfzs.filter((single) => single.show === true).map((rtfz) => <Rtfz key={rtfz._id} zone={rtfz} />)}
5151
</GoogleMap>
5252
));
5353

@@ -154,7 +154,7 @@ MissionMap.propTypes = {
154154
onMapClick: PropTypes.func,
155155
loadNfz: PropTypes.func.isRequired,
156156
noFlyZones: PropTypes.array.isRequired,
157-
rtfzs: PropTypes.array.isRequired,
157+
rtfzs: PropTypes.array,
158158
};
159159

160160
export default CSSModules(MissionMap, styles);

src/routes/MissionPlanner/components/RTFZSidebar/RTFZSidebar.jsx

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,37 @@ class RTFZSidebar extends React.Component {
2020
render() {
2121
const {rtfzs} = this.props;
2222
return (
23-
<div styleName="rtfz-sidebar">
24-
{rtfzs && rtfzs.length > 0 ? (
25-
rtfzs.map((rtfz) => (
26-
<Grid key={rtfz._id} styleName="sidebar-item">
27-
<Row>
28-
<Col xs={6} md={6}>{rtfz.description}</Col>
29-
<Col xs={6} md={6}>
30-
<div styleName="toggle-wrapper">
31-
<ToggleButton
32-
value={rtfz.show}
33-
activeLabel="hide"
34-
inactiveLabel="show"
35-
onToggle={(value) => this.toggleRtfz(value, rtfz)}
36-
/>
37-
</div>
38-
</Col>
39-
</Row>
40-
</Grid>
41-
))
42-
) : (
43-
<div styleName="note">No region to flyzones defined</div>
44-
)}
23+
<div>
24+
{(rtfzs && rtfzs.length > 0) && (
25+
<div styleName="rtfz-sidebar">
26+
{
27+
rtfzs.map((rtfz) => (
28+
<Grid key={rtfz._id} styleName="sidebar-item">
29+
<Row>
30+
<Col xs={6} md={6}>{rtfz.description}</Col>
31+
<Col xs={6} md={6}>
32+
<div styleName="toggle-wrapper">
33+
<ToggleButton
34+
value={rtfz.show}
35+
activeLabel="hide"
36+
inactiveLabel="show"
37+
onToggle={(value) => this.toggleRtfz(value, rtfz)}
38+
/>
39+
</div>
40+
</Col>
41+
</Row>
42+
</Grid>
43+
))
44+
}
45+
</div>
46+
)}
4547
</div>
4648
);
4749
}
4850
}
4951

5052
RTFZSidebar.propTypes = {
51-
rtfzs: PropTypes.array.isRequired,
53+
rtfzs: PropTypes.array,
5254
toggleRtfzHandler: PropTypes.func.isRequired,
5355
};
5456

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy