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

Copy Markdown View Source

Safety panel — displays safety state, runtime state, and control hints.

Combines safety status indicator, runtime state, and keyboard shortcuts in a single left-sidebar panel. When the robot is disarming, shows a throbber animation.

Pure function — takes state, returns a widget struct.

Summary

Functions

Renders the safety panel with status indicator, runtime state, and key hints.

Functions

render(state, focused?)

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

Renders the safety panel with status indicator, runtime state, and key hints.

When the robot is in the :disarming state, returns a Throbber widget instead to show the animated transition indicator.

Examples

iex> state = %BB.TUI.State{safety: %BB.TUI.State.Safety{state: :armed, runtime: :idle}}
iex> %ExRatatui.Widgets.Paragraph{} = BB.TUI.Panels.Safety.render(state, true)

iex> state = %BB.TUI.State{ui: %BB.TUI.State.UI{throbber_step: 0}, safety: %BB.TUI.State.Safety{state: :disarming, runtime: :disarming}}
iex> %ExRatatui.Widgets.Throbber{} = BB.TUI.Panels.Safety.render(state, false)