Class: SolidQueueTui::Components::HelpBar

Inherits:
Object
  • Object
show all
Defined in:
lib/solid_queue_tui/components/help_bar.rb

Constant Summary collapse

DEFAULT_BINDINGS =
[
  { key: "q", action: "Quit" },
  { key: "r", action: "Refresh" },
  { key: "Tab", action: "Next View" },
  { key: "j/k", action: "Navigate" },
  { key: "/", action: "Filter" },
  { key: "Esc", action: "Clear" }
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(tui, breadcrumb:, bindings: nil, status: nil) ⇒ HelpBar

Returns a new instance of HelpBar.



15
16
17
18
19
20
# File 'lib/solid_queue_tui/components/help_bar.rb', line 15

def initialize(tui, breadcrumb:, bindings: nil, status: nil)
  @tui = tui
  @breadcrumb = breadcrumb
  @bindings = bindings || DEFAULT_BINDINGS
  @status = status
end

Instance Method Details

#render(frame, area) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/solid_queue_tui/components/help_bar.rb', line 22

def render(frame, area)
  left, right = @tui.layout_split(
    area,
    direction: :horizontal,
    constraints: [
      @tui.constraint_percentage(30),
      @tui.constraint_percentage(70)
    ]
  )

  render_breadcrumb(frame, left)
  render_bindings(frame, right)
end