def_visibility + reactive map buttons

This commit is contained in:
Swrup 2025-04-15 06:41:50 +02:00
parent 930c49e8d6
commit 281b40d64a
7 changed files with 52 additions and 46 deletions

View file

@ -64,19 +64,19 @@ module Home = struct
]
in
let thread_view = Html_thread.f t_s in
let new_thread_link = Html_thread.new_thread_link_el t_s in
let new_thread_link = Html_util.new_thread_link_el t_s in
let return_link = El.a ~at:[ href (to_path Home) ] [ el_txt "Return" ] in
let navigation_div =
El.div
~at:[ class' "home-left-navigation-div" ]
[ new_thread_link; return_link ]
in
let mode k = S.map (is_page_kind k) t_s in
def_on (mode New_thread) new_thread_view;
def_off (mode Thread) navigation_div;
def_on (mode Thread) thread_view;
def_off (mode New_thread) new_thread_link;
def_on (mode New_thread) return_link;
def_visibility_when_page [ New_thread ] `On new_thread_view t_s;
def_visibility_when_page [ Thread ] `Off navigation_div t_s;
def_visibility_when_page [ Thread ] `On thread_view t_s;
def_visibility_when_page [ New_thread ] `On return_link t_s;
(* done in new_thread_link_el fun
def_visibility_when_page [ New_thread ] `Off new_thread_link t_s;*)
let el =
El.div
~at:[ class' "home-left" ]
@ -88,13 +88,7 @@ module Home = struct
let left_el = left t_s in
let right_el = Leaflet_map.f t_s in
let el = El.div ~at:[ class' "home-page" ] [ left_el; right_el ] in
def_on
(S.map
(fun t ->
is_page_kind Home t || is_page_kind New_thread t
|| is_page_kind Thread t )
t_s )
el;
def_visibility_when_page [ Home; New_thread; Thread ] `On el t_s;
el
end
@ -311,7 +305,8 @@ module Error_popup = struct
let f t_s =
let el = El.div ~at:[ class' "error-popup" ] [] in
Elr.def_children el (S.map (fun t -> mk el t.error) t_s);
def_off (S.map (fun t -> Option.is_none t.error) t_s) el;
let is_error = S.map (fun t -> Option.is_some t.error) t_s in
def_visibility `On is_error el;
el
end