Skip to content

Commit

Permalink
fix warning styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Chen authored and Amy Chen committed Mar 13, 2024
1 parent 10d16b9 commit e6a60af
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/components/graph/SurveyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ export default class SurveyGraph extends Component {
title={
this.isInSurveyGraph(item)
? `Remove ${item} from graph`
: `Add ${item} to graph`
: this.isSurveyInDateRange(item)
? `Add ${item} to graph`
: "No data in selected date range"
}
>
<input
Expand Down Expand Up @@ -839,6 +841,20 @@ export default class SurveyGraph extends Component {
</div>
);
}

renderNotInGraphMessage() {
if (!this.state.qids || !this.state.qids.length) return null;
const noDataQids = this.state.qids
.filter((item) => !this.isSurveyInDateRange(item))
.map((item) => String(item).toUpperCase());
if (!noDataQids.length) return null;
return (
<div
className="text-warning"
style={{ margin: "8px" }}
>{`No data for ${noDataQids.join(", ")} in selected date range`}</div>
);
}
render() {
const noEntry =
!this.state.originalGraphData || !this.state.originalGraphData.length;
Expand Down Expand Up @@ -1183,6 +1199,7 @@ export default class SurveyGraph extends Component {
</div>
</div>
{this.renderPrintOnlyImage()}
{this.renderNotInGraphMessage()}
</div>
</React.Fragment>
);
Expand Down

0 comments on commit e6a60af

Please sign in to comment.