aboutsummaryrefslogtreecommitdiff
path: root/editor/actions
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-06-03 11:41:28 +0200
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:43:33 +0100
commita6e30a95b5dcd34fb9e65d9a26f0844ec75bb004 (patch)
treeda22adc487aa729e5c18f9c282eb48a77a54d7c1 /editor/actions
parent8bb6631ea1c8f54071d09ced2d62a16d6319e6f6 (diff)
Greyed the delete button on main page
Diffstat (limited to 'editor/actions')
-rwxr-xr-xeditor/actions/editor_actions.ml23
-rwxr-xr-xeditor/actions/editor_actions.mli2
2 files changed, 16 insertions, 9 deletions
diff --git a/editor/actions/editor_actions.ml b/editor/actions/editor_actions.ml
index 0053890..5b2a3d3 100755
--- a/editor/actions/editor_actions.ml
+++ b/editor/actions/editor_actions.ml
@@ -13,6 +13,7 @@ type t =
; childs : El.t list
; ul : El.t
; mutable completed : bool
+ ; delete_button : El.t
}
let build
@@ -153,6 +154,7 @@ let build
{ ev = result_event
; childs
; ul
+ ; delete_button
; completed = false
}
@@ -175,23 +177,28 @@ let get_notes _ =
[ El.txt name ] ])
let complete
- : t -> State.t Note.event -> El.t list
- = fun ({ childs; ul ; completed ; _ } as t) change ->
+ : t -> State.t Note.signal -> El.t list
+ = fun ({ childs; ul ; completed ; delete_button ; _ } as t) change ->
let () =
if completed then
raise (Failure "The action panel is already registered") in
let note_list =
- Note.E.map get_notes
+ Note.S.map get_notes
change
in
t.completed <- true;
- (* Register all the notes at the creation time *)
- El.set_children ul (get_notes ());
-
- (* Then register updates *)
- Elr.set_children ul ~on:note_list;
+ Elr.def_children ul note_list;
+ Elr.def_at
+ (Jstr.v "disabled")
+ (Note.S.map
+ (fun state ->
+ match state.State.page_id with
+ | None -> Some Jstr.empty
+ | Some _ -> None)
+ change)
+ delete_button;
childs
diff --git a/editor/actions/editor_actions.mli b/editor/actions/editor_actions.mli
index 48d5676..27b09d7 100755
--- a/editor/actions/editor_actions.mli
+++ b/editor/actions/editor_actions.mli
@@ -14,4 +14,4 @@ val get_event
*)
val complete
- : t -> State.t Note.event -> Brr.El.t list
+ : t -> State.t Note.signal -> Brr.El.t list