summaryrefslogtreecommitdiff
path: root/editor/ui.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-05-23 22:09:50 +0200
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:43:33 +0100
commit1eeaf137bd30aff1bef34d05eeec686f6da8959d (patch)
tree63589546a32b72382e94f1ee16cf671cec911648 /editor/ui.ml
parent97f3ac8054de22b94e4ae169dae33ed5b1b41a52 (diff)
Update editor
Diffstat (limited to 'editor/ui.ml')
-rwxr-xr-xeditor/ui.ml75
1 files changed, 0 insertions, 75 deletions
diff --git a/editor/ui.ml b/editor/ui.ml
deleted file mode 100755
index cc90481..0000000
--- a/editor/ui.ml
+++ /dev/null
@@ -1,75 +0,0 @@
-open Brr
-open Brr_note
-module Js = Js_of_ocaml.Js
-
-let popup
- : title:Jstr.t -> ?form:Forms.Events.t option -> Forms.Events.event option Note.E.send -> El.t
- = fun ~title ?(form = None) send ->
-
- (* Ensure we keep a track for the signal event.
-
- This looks a bit like the old memory magment in C, as it require to
- destroy the logger each time the popup is removed. *)
- let log_opt = Option.map
- (fun (values, _) -> Note.S.log values (fun _ -> ()))
- form in
-
- let close_btn =
- El.span
- ~at:At.[class' (Jstr.v "modal-close")]
- [ El.txt' "×"] in
-
- Evr.endless_listen
- (El.as_target close_btn)
- Ev.click
- (fun _ ->
- Option.iter Note.Logr.destroy log_opt;
- send None
- );
-
- let container = match form with
- | None -> El.div
- | Some _ -> El.form
-
- and body = match form with
- | None -> El.div []
- | Some (_, content) -> content
-
- and footer = match form with
- | None -> El.txt Jstr.empty
- | Some (values, _) ->
-
- let btn = El.input ()
- ~at:At.[type' (Jstr.v "submit")] in
-
- Evr.endless_listen
- (El.as_target btn)
- Ev.click
- (fun _ ->
- Option.iter Note.Logr.force log_opt;
- let form_content = (Note.S.value values) in
- Option.iter Note.Logr.destroy log_opt;
- send (Some form_content));
-
- El.div [ btn ]
- ~at:At.[class' (Jstr.v "row")] in
-
- let el = El.div
- ~at:At.[class' (Jstr.v "modal")]
- [ container
- ~at:At.[class' (Jstr.v "modal-content")]
- [ El.div
- ~at:At.[class' (Jstr.v "modal-header")]
- [ close_btn
- ; El.h3
- [ El.txt title ]]
- ; El.div
- ~at:At.[class' (Jstr.v "modal-body")]
- [ body ]
- ; El.div
- ~at:At.[class' (Jstr.v "modal-footer")]
- [ footer ]]] in
-
- El.append_children (Document.body G.document)
- [ el ]
- ; el