Extract pages into lib/page/ modules; thin down bbs.rb
Each page is now a self-contained module with a configure(tui) class method. Shared helpers live in TUIHelpers. bbs.rb is reduced to constants, chrome, and wiring. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
22
lib/page/online_page.rb
Normal file
22
lib/page/online_page.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module OnlinePage
|
||||
def self.configure(tui)
|
||||
tui.page :online do
|
||||
enter { @page_title = 'ONLINE USERS'; @items = ONLINE.snapshot.sort.map { |_, name| name } }
|
||||
|
||||
render do
|
||||
@items.each_with_index do |uname, i|
|
||||
you = uname == @username ? tc(:normal, ' ← you') : ''
|
||||
text tc(:bright, uname) + you, x: CONT_X, y: CONT_Y + i
|
||||
end
|
||||
text "#{@items.size} user(s) online q back",
|
||||
x: CONT_X, y: CONT_Y + cont_h, style: THEME[:normal]
|
||||
end
|
||||
|
||||
key('r') { reload }
|
||||
key('q') { go :idle }
|
||||
key(:escape) { go :idle }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user