Remove redrawing on tick from ui

The `musicplayer` will update the state as needed,
e.g. on an interval
This commit is contained in:
Alexander Heldt
2025-11-25 20:41:57 +01:00
parent fdfd44017f
commit c90f4716f4
2 changed files with 0 additions and 14 deletions

View File

@@ -3,7 +3,6 @@ import gleam/erlang/process.{type Subject}
import musicplayer/ui/layout.{type Section}
pub type Control {
Redraw
UpdateState(section: Section, content: String)
Exit(reply_to: Subject(Nil))

View File

@@ -35,8 +35,6 @@ pub fn new() -> Result(Subject(Control), String) {
redraw_on_update_loop(redraw)
})
process.spawn(fn() { redraw_on_tick_loop(ui, 1000) })
Ok(ui)
}
}
@@ -47,10 +45,6 @@ fn handle_message(
control: Control,
) -> actor.Next(State(redraw, layout), Control) {
case control {
control.Redraw -> {
actor.send(state.redraw, state.layout)
actor.continue(state)
}
control.UpdateState(section, content) -> {
let layout = layout.update_section(state.layout, section, content)
let state = State(..state, layout:)
@@ -76,13 +70,6 @@ fn redraw_on_update_loop(redraw: Subject(Layout)) -> Nil {
redraw_on_update_loop(redraw)
}
fn redraw_on_tick_loop(ui: Subject(Control), interval_ms: Int) {
process.sleep(interval_ms)
process.send(ui, control.Redraw)
redraw_on_tick_loop(ui, interval_ms)
}
fn render_layout(layout: Layout, from: Section) -> Nil {
case dict.get(layout.nodes, from) {
Error(_) -> Nil