Skip to content

Commit

Permalink
Add status
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinans committed May 11, 2024
1 parent 6c85356 commit 81e837b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ let button model (i, j) =
]
[Vdom.text txt]

let status {camels; flagged_camels; _} =
Vdom.text
(Printf.sprintf "%s / %s = %d / %d\n" cactus_string camel_string flagged_camels camels)

let view ({grid; _} as model) =
let buttons =
Array.mapi (fun i row ->
Expand All @@ -199,8 +203,10 @@ let view ({grid; _} as model) =
) grid
|> Array.to_list
in
Vdom.div
buttons
Vdom.div [
Vdom.div buttons;
Vdom.div [status model];
]

let _ =
let app = Vdom.app ~init ~update ~view () in
Expand Down

0 comments on commit 81e837b

Please sign in to comment.