BB.TUI.Panels.StatusBar (BB.TUI v0.1.0)

Copy Markdown View Source

Status bar — single-line bar at the bottom of the dashboard.

Carries (in order) the robot module, a colored safety badge, a runtime-state pill, the global key hints (Tab / q / ?), and a set of context-sensitive key pills for the active panel.

Every segment is a %ExRatatui.Text.Span{} so each piece can carry its own color: the safety badge changes color with the safety state (green / yellow / red / dim), key labels render as cyan pills (red for q), descriptions render dim. See BB.TUI.Theme.brand_title/2, safety_badge/1, key_pill/2 for the underlying primitives.

Pure function — takes state, returns a widget struct.

Summary

Functions

Renders the status bar as a Paragraph widget.

Functions

render(state)

@spec render(BB.TUI.State.t()) :: struct()

Renders the status bar as a Paragraph widget.

Examples

iex> state = %BB.TUI.State{
...>   robot: MyApp.Robot, ui: %BB.TUI.State.UI{active_panel: :safety},
...>   safety: %BB.TUI.State.Safety{state: :armed, runtime: :idle}
...> }
iex> %ExRatatui.Widgets.Paragraph{text: %ExRatatui.Text.Line{spans: spans}} =
...>   BB.TUI.Panels.StatusBar.render(state)
iex> Enum.map_join(spans, "", & &1.content) =~ "MyApp.Robot"
true

iex> state = %BB.TUI.State{
...>   robot: MyApp.Robot, ui: %BB.TUI.State.UI{active_panel: :safety},
...>   safety: %BB.TUI.State.Safety{state: :armed, runtime: :idle}
...> }
iex> %ExRatatui.Widgets.Paragraph{text: %ExRatatui.Text.Line{spans: spans}} =
...>   BB.TUI.Panels.StatusBar.render(state)
iex> Enum.map_join(spans, "", & &1.content) =~ "ARMED"
true