Simple model Ids
This commit is contained in:
parent
60e33f985a
commit
7e8fa21ab7
30
src/App.re
30
src/App.re
|
@ -10,6 +10,15 @@ let routeToPath = route =>
|
||||||
| _ => "/"
|
| _ => "/"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module Models = {
|
||||||
|
let all = [|
|
||||||
|
EAFunds.Interface.model,
|
||||||
|
GlobalCatastrophe.Interface.model,
|
||||||
|
Human.Interface.model,
|
||||||
|
|];
|
||||||
|
let getById = id => E.A.getBy(all, r => r.id == id);
|
||||||
|
};
|
||||||
|
|
||||||
module Menu = {
|
module Menu = {
|
||||||
module Styles = {
|
module Styles = {
|
||||||
open Css;
|
open Css;
|
||||||
|
@ -55,12 +64,13 @@ module Menu = {
|
||||||
let make = () => {
|
let make = () => {
|
||||||
<div className=Styles.menu>
|
<div className=Styles.menu>
|
||||||
<Item href={routeToPath(Home)} key="home"> {"Home" |> E.ste} </Item>
|
<Item href={routeToPath(Home)} key="home"> {"Home" |> E.ste} </Item>
|
||||||
<Item href={routeToPath(Model("1"))} key="ea-funds">
|
{Models.all
|
||||||
{"EA Funds" |> E.ste}
|
|> E.A.fmap((model: Prop.Model.t) => {
|
||||||
</Item>
|
<Item href={routeToPath(Model(model.id))} key="ea-funds">
|
||||||
<Item href={routeToPath(Model("2"))} key="gc">
|
{model.name |> E.ste}
|
||||||
{"Global Catastrophe" |> E.ste}
|
</Item>
|
||||||
</Item>
|
})
|
||||||
|
|> ReasonReact.array}
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -79,9 +89,11 @@ let make = () => {
|
||||||
<div className="w-full max-w-screen-xl mx-auto px-6">
|
<div className="w-full max-w-screen-xl mx-auto px-6">
|
||||||
<Menu />
|
<Menu />
|
||||||
{switch (routing) {
|
{switch (routing) {
|
||||||
| Model("1") => <FormBuilder.ModelForm model=EAFunds.Interface.model />
|
| Model(n) =>
|
||||||
| Model("2") =>
|
switch (Models.getById(n)) {
|
||||||
<FormBuilder.ModelForm model=GlobalCatastrophe.Interface.model />
|
| Some(model) => <FormBuilder.ModelForm model />
|
||||||
|
| None => <div> {"Page is not found" |> E.ste} </div>
|
||||||
|
}
|
||||||
| Home => <div> {"Welcome" |> E.ste} </div>
|
| Home => <div> {"Welcome" |> E.ste} </div>
|
||||||
| _ => <div> {"Page is not found" |> E.ste} </div>
|
| _ => <div> {"Page is not found" |> E.ste} </div>
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -241,6 +241,7 @@ module TypeWithMetadata = {
|
||||||
module Model = {
|
module Model = {
|
||||||
type t = {
|
type t = {
|
||||||
name: string,
|
name: string,
|
||||||
|
id: string,
|
||||||
description: string,
|
description: string,
|
||||||
author: string,
|
author: string,
|
||||||
version: string,
|
version: string,
|
||||||
|
|
|
@ -216,7 +216,8 @@ module Interface = {
|
||||||
|
|
||||||
let model: Prop.Model.t =
|
let model: Prop.Model.t =
|
||||||
Prop.{
|
Prop.{
|
||||||
name: "CEA Funds: Donations & Payouts",
|
id: "ea-funds",
|
||||||
|
name: "EA Funds: Donations & Payouts",
|
||||||
description: "Calculate the payments and payouts of CEA Funds based on existing data.",
|
description: "Calculate the payments and payouts of CEA Funds based on existing data.",
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
author: "Ozzie Gooen",
|
author: "Ozzie Gooen",
|
||||||
|
|
|
@ -27,6 +27,7 @@ module Interface = {
|
||||||
let model: Prop.Model.t =
|
let model: Prop.Model.t =
|
||||||
Prop.{
|
Prop.{
|
||||||
name: "Global Catastrophe",
|
name: "Global Catastrophe",
|
||||||
|
id: "global-catastrophe",
|
||||||
description: "The chances of having at least one catastrophe per year in the future, assuming no other catastrophe until then.",
|
description: "The chances of having at least one catastrophe per year in the future, assuming no other catastrophe until then.",
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
author: "Ozzie Gooen",
|
author: "Ozzie Gooen",
|
||||||
|
|
|
@ -28,6 +28,7 @@ module Interface = {
|
||||||
let model: Prop.Model.t =
|
let model: Prop.Model.t =
|
||||||
Prop.{
|
Prop.{
|
||||||
name: "Death Time",
|
name: "Death Time",
|
||||||
|
id: "human-lifespan",
|
||||||
description: "When will you die?",
|
description: "When will you die?",
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
author: "Ozzie Gooen",
|
author: "Ozzie Gooen",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user