@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
41 lines • 1.69 kB
JavaScript
import React from "react";
import { OBJECTIVE_YES, OBJECTIVE_NO, } from "../../types/index.js";
import { percentWithEdge } from "../../helpers/index.js";
import { ObjectiveStatus } from "../../components/ObjectiveStatus.js";
/**
* Displays status toward meeting Network objective
*/
export const RbcsNetworkObjectiveStatus = ({ objective, objectiveMet, renderMsg }) => {
const msg = renderMsg
? renderMsg(objective, objectiveMet)
: defaultMsg(objective, objectiveMet);
return React.createElement(ObjectiveStatus, { status: objectiveMet, msg: msg });
};
const defaultMsg = (objective, objectiveMet) => {
if (objectiveMet === OBJECTIVE_YES) {
return (React.createElement(React.Fragment, null,
"This plan meets the objective of protecting",
" ",
React.createElement("b", null, percentWithEdge(objective.target)),
" of planning area."));
}
else if (objectiveMet === OBJECTIVE_NO) {
return (React.createElement(React.Fragment, null,
"This plan ",
React.createElement("b", null, "does not"),
" meet the objective of protecting",
" ",
React.createElement("b", null, percentWithEdge(objective.target)),
" of planning area."));
}
else {
return (React.createElement(React.Fragment, null,
"This plan ",
React.createElement("b", null, "may"),
" meet the objective of protecting",
" ",
React.createElement("b", null, percentWithEdge(objective.target)),
" of planning area."));
}
};
//# sourceMappingURL=RbcsNetworkObjectiveStatus.js.map