open BsReform;
open Antd.Grid;
module FormConfig = [%lenses type state = {guesstimatorString: string}];
module Form = ReForm.Make(FormConfig);
let schema = Form.Validation.Schema([||]);
module FieldString = {
[@react.component]
let make = (~field, ~label) => {
R.ste}>
validate()}
/>
}
/>;
};
};
module Styles = {
open Css;
let dist = style([padding(em(1.))]);
let spacer = style([marginTop(em(1.))]);
};
module DemoDist = {
[@react.component]
let make = (~guesstimatorString: string) => {
let (ys, xs, isEmpty) =
DistEditor.getPdfFromUserInput(guesstimatorString);
let inside =
isEmpty
? "Nothing to show" |> R.ste
: {
let distPlus =
Distributions.DistPlus.make(
~shape=
Continuous(
Distributions.Continuous.make(`Linear, {xs, ys}, None),
),
~domain=Complete,
~unit=UnspecifiedDistribution,
~guesstimatorString=None,
(),
)
|> Distributions.DistPlus.T.normalize;
;
};
R.ste}>
inside
;
};
};
[@react.component]
let make = () => {
let reform =
Form.use(
~validationStrategy=OnDemand,
~schema,
~onSubmit=({state}) => {None},
~initialState={guesstimatorString: "lognormal(6.1, 1)"},
(),
);
let demoDist =
React.useMemo1(
() => {
},
[|reform.state.values.guesstimatorString|],
);
;
};