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:
29
lib/page/sysinfo_page.rb
Normal file
29
lib/page/sysinfo_page.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module SysinfoPage
|
||||
def self.configure(tui)
|
||||
tui.page :sysinfo do
|
||||
enter do
|
||||
@page_title = 'SYSTEM INFO'
|
||||
@items = [
|
||||
"Online users #{ONLINE.count}",
|
||||
"Messages #{MESSAGES.count}",
|
||||
"Wiki https://wiki.teletypegames.org",
|
||||
"Games API https://teletypegames.org",
|
||||
"Platform #{RUBY_PLATFORM}",
|
||||
"Ruby #{RUBY_VERSION}"
|
||||
]
|
||||
end
|
||||
|
||||
render do
|
||||
@items.each_with_index do |row, i|
|
||||
text row[0, cont_w], x: CONT_X, y: CONT_Y + i, style: THEME[:normal]
|
||||
end
|
||||
text 'q back', x: CONT_X, y: CONT_Y + cont_h, style: THEME[:normal]
|
||||
end
|
||||
|
||||
key('q') { go :idle }
|
||||
key(:escape) { go :idle }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user