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

Copy Markdown View Source

Title bar โ€” single-line branded header at the top of the dashboard.

Renders a rich-text %Line{} via BB.TUI.Theme.brand_title/2, so the bot icon, BB.TUI brand, robot module, and optional @ node segment each carry their own color and modifier. The whole line sits over Theme.title_bg/0 for visual separation from the panels beneath it.

Pure function โ€” takes state, returns a widget struct.

Summary

Functions

Renders the title bar as a Paragraph widget. The text is the rich %Line{} returned by BB.TUI.Theme.brand_title/2; the paragraph background is Theme.title_bg/0.

Functions

render(state)

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

Renders the title bar as a Paragraph widget. The text is the rich %Line{} returned by BB.TUI.Theme.brand_title/2; the paragraph background is Theme.title_bg/0.

Examples

iex> state = %BB.TUI.State{robot: MyApp.Robot, node: nil}
iex> %ExRatatui.Widgets.Paragraph{text: %ExRatatui.Text.Line{spans: spans}} =
...>   BB.TUI.Panels.TitleBar.render(state)
iex> Enum.map_join(spans, "", & &1.content)
" ๐Ÿค– BB.TUI ยท MyApp.Robot"

iex> state = %BB.TUI.State{robot: MyApp.Robot, node: :"robot@host"}
iex> %ExRatatui.Widgets.Paragraph{text: %ExRatatui.Text.Line{spans: spans}} =
...>   BB.TUI.Panels.TitleBar.render(state)
iex> Enum.map_join(spans, "", & &1.content) =~ "@ robot@host"
true