import React from "react"; import Emblem from "../Emblem"; import { FormattedMessage } from "react-intl"; import css from "../css/Config.css"; const Options = props => { const emblem = (t1, t2) => const renderOptions = () => { let c = props.pattern.config; let rows = []; if (typeof c.options !== "undefined") { let list = []; for (let item of Object.keys(c.options).sort()) { let values = null; if (typeof c.options[item] === "boolean") { rows.push( {item}: {c.options[item] ? "TRUE" : "FALSE"} ); } else if (typeof c.options[item] !== "object") { rows.push( {item}: {c.options[item]} ); } else { if (typeof c.options[item].pct !== "undefined") { rows.push( {item}: {c.options[item].min}% {" / "} {c.options[item].pct}% {" / "} {c.options[item].max}% ); } else if (typeof c.options[item].deg !== "undefined") { rows.push( {item}: {c.options[item].min}° {" / "} {c.options[item].deg}° {" / "} {c.options[item].max}° ); } else if (typeof c.options[item].mm !== "undefined") { rows.push( {item}: {c.options[item].min}mm; {" / "} {c.options[item].mm}mm {" / "} {c.options[item].max}mm ); } else if (typeof c.options[item].bool !== "undefined") { rows.push( {item}: {c.options[item].bool ? TRUE / FALSE : TRUE / FALSE } ); } else if (typeof c.options[item].list !== "undefined") { let list = []; for (let opt of c.options[item].list) { if (opt === c.options[item].dflt) list.push(
  • {opt} «
  • ); else list.push(
  • {opt}
  • ); } rows.push( {item}: ); } else { rows.push( {item}: FIXME ); } } } } else return null; return ( {rows}
    {emblem(c.name+".config",".options")}
    ); } return (
    {renderOptions()}
    ); } export default Options;