Adds spacer
This commit is contained in:
parent
b37d052b4f
commit
746d74da96
|
@ -40,6 +40,8 @@ module Styles = {
|
||||||
open Css;
|
open Css;
|
||||||
let row =
|
let row =
|
||||||
style([display(`flex), selector("div > div", [flex(`num(1.))])]);
|
style([display(`flex), selector("div > div", [flex(`num(1.))])]);
|
||||||
|
let form = style([backgroundColor(hex("eee")), padding(em(1.))]);
|
||||||
|
let spacer = style([marginTop(em(3.))]);
|
||||||
};
|
};
|
||||||
|
|
||||||
module FieldFloat = {
|
module FieldFloat = {
|
||||||
|
@ -70,8 +72,8 @@ let make = () => {
|
||||||
~initialState={
|
~initialState={
|
||||||
guesstimatorString: "mm(5 to 20, floor(normal(20,2)), [.5, .5])",
|
guesstimatorString: "mm(5 to 20, floor(normal(20,2)), [.5, .5])",
|
||||||
domainType: "Complete",
|
domainType: "Complete",
|
||||||
xPoint: "0.0",
|
xPoint: "50.0",
|
||||||
excludingProbabilityMass: "",
|
excludingProbabilityMass: "0.3",
|
||||||
unitType: "UnspecifiedDistribution",
|
unitType: "UnspecifiedDistribution",
|
||||||
zero: MomentRe.momentNow(),
|
zero: MomentRe.momentNow(),
|
||||||
unit: "days",
|
unit: "days",
|
||||||
|
@ -84,6 +86,65 @@ let make = () => {
|
||||||
reform.submit();
|
reform.submit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let domain =
|
||||||
|
switch (reform.state.values.domainType) {
|
||||||
|
| "Complete" => DistTypes.Complete
|
||||||
|
| "LeftLimited" =>
|
||||||
|
LeftLimited({
|
||||||
|
xPoint: reform.state.values.xPoint |> float_of_string,
|
||||||
|
excludingProbabilityMass:
|
||||||
|
reform.state.values.excludingProbabilityMass |> float_of_string,
|
||||||
|
})
|
||||||
|
| "RightLimited" =>
|
||||||
|
RightLimited({
|
||||||
|
xPoint: reform.state.values.xPoint |> float_of_string,
|
||||||
|
excludingProbabilityMass:
|
||||||
|
reform.state.values.excludingProbabilityMass |> float_of_string,
|
||||||
|
})
|
||||||
|
| "LeftAndRightLimited" =>
|
||||||
|
LeftAndRightLimited(
|
||||||
|
{
|
||||||
|
xPoint: reform.state.values.xPoint |> float_of_string,
|
||||||
|
excludingProbabilityMass:
|
||||||
|
reform.state.values.excludingProbabilityMass |> float_of_string,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xPoint: reform.state.values.xPoint |> float_of_string,
|
||||||
|
excludingProbabilityMass:
|
||||||
|
reform.state.values.excludingProbabilityMass |> float_of_string,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
| _ => Js.Exn.raiseError("domain is unknown")
|
||||||
|
};
|
||||||
|
|
||||||
|
let unit =
|
||||||
|
switch (reform.state.values.unitType) {
|
||||||
|
| "UnspecifiedDistribution" => DistTypes.UnspecifiedDistribution
|
||||||
|
| "TimeDistribution" =>
|
||||||
|
TimeDistribution({
|
||||||
|
zero: reform.state.values.zero,
|
||||||
|
unit: reform.state.values.unit |> TimeTypes.TimeUnit.ofString,
|
||||||
|
})
|
||||||
|
| _ => Js.Exn.raiseError("unit is unknown")
|
||||||
|
};
|
||||||
|
|
||||||
|
let guesstimatorString = reform.state.values.guesstimatorString;
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div className=Styles.spacer />
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
{DistPlusIngredients.make(~guesstimatorString, ~domain, ~unit, ())
|
||||||
|
|> DistPlusIngredients.toDistPlus(
|
||||||
|
~sampleCount=10000,
|
||||||
|
~outputXYPoints=2000,
|
||||||
|
~truncateTo=Some(1000),
|
||||||
|
)
|
||||||
|
|> E.O.React.fmapOrNull(distPlus => <DistPlusPlot distPlus />)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className=Styles.spacer />
|
||||||
|
<div className=Styles.form>
|
||||||
<Form.Provider value=reform>
|
<Form.Provider value=reform>
|
||||||
<Antd.Form onSubmit>
|
<Antd.Form onSubmit>
|
||||||
<FieldString
|
<FieldString
|
||||||
|
@ -196,13 +257,8 @@ let make = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Antd.Form.Item>
|
|
||||||
{reform.state.formState == Submitting
|
|
||||||
? "Loading" |> E.ste
|
|
||||||
: <Antd.Button _type=`primary onClick=onSubmit>
|
|
||||||
{"Submit" |> E.ste}
|
|
||||||
</Antd.Button>}
|
|
||||||
</Antd.Form.Item>
|
|
||||||
</Antd.Form>
|
</Antd.Form>
|
||||||
</Form.Provider>;
|
</Form.Provider>
|
||||||
|
</div>
|
||||||
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,20 @@ module TimeUnit = {
|
||||||
| `weeks => "weeks"
|
| `weeks => "weeks"
|
||||||
| `years => "years"
|
| `years => "years"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let ofString = (timeUnit: string) =>
|
||||||
|
switch (timeUnit) {
|
||||||
|
| "days" => `days
|
||||||
|
| "hours" => `hours
|
||||||
|
| "milliseconds" => `milliseconds
|
||||||
|
| "minutes" => `minutes
|
||||||
|
| "months" => `months
|
||||||
|
| "quarters" => `quarters
|
||||||
|
| "seconds" => `seconds
|
||||||
|
| "weeks" => `weeks
|
||||||
|
| "years" => `years
|
||||||
|
| _ => Js.Exn.raiseError("TimeUnit is unknown")
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
module TimePoint = {
|
module TimePoint = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user