From 0ef96a333afdb7d8437b9862ec4631863da9a392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Sat, 27 Apr 2024 13:08:46 +0200 Subject: [PATCH] Simple now playing display --- bin/main.ml | 2 +- bin/player.ml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/main.ml b/bin/main.ml index f8f0273..d928bfc 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -22,13 +22,13 @@ let app _idb = El.txt' ("click" ^ string_of_int pl))); ]) in - let player = P.make () in let status = Elwd.div ~at:[ `P (At.style (Jstr.v "grid-column:1/-1")) ] [ `P (El.h1 [ El.txt' "Welcome to OCAMIX" ]); `R (Servers.ui ()) ] in let player_ui = + let player = P.make () in Elwd.div ~at:[ `P (At.style (Jstr.v "grid-column:1/-1")) ] [ `R player ] in let f_search = diff --git a/bin/player.ml b/bin/player.ml index 4ba6d38..1b5a64e 100644 --- a/bin/player.ml +++ b/bin/player.ml @@ -165,5 +165,10 @@ struct Brr_lwd_ui.Button.v ~ev:[ `P (Elwd.handler Ev.click next) ] (`P "NEXT") in let at = [ `P (At.class' (Jstr.v "player-wrapper")) ] in - Elwd.div ~at [ `P audio_elt; `R btn_next ] + let now_playing = + Lwd.map (Lwd.get now_playing) ~f:(function + | None -> El.txt' "Nothing playing" + | Some { item = { name; _ }; _ } -> El.txt' name) + in + Elwd.div ~at [ `R now_playing; `P audio_elt; `R btn_next ] end