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:
2026-05-11 22:23:10 +02:00
parent 1cd1eceb1c
commit 1e2b8321fd
10 changed files with 323 additions and 300 deletions

30
lib/page/idle_page.rb Normal file
View File

@@ -0,0 +1,30 @@
# frozen_string_literal: true
module IdlePage
def self.configure(tui)
tui.page :idle do
enter { @page_title = 'TELETYPE BBS' }
render do
text 'Navigate the menu with ↑↓, select with Enter.',
x: CONT_X, y: CONT_Y + cont_h / 2, style: THEME[:normal]
end
nav :menu, size: MENU_ITEMS.size
key(:enter) do
case MENU_ITEMS[@menu_sel]
when 'Messages' then go :messages
when 'Post Message' then go :new_msg
when 'Blog Posts' then go :blog
when 'HowTo Guides' then go :howto
when 'Game Catalog' then go :games
when 'Online Users' then go :online
when 'System Info' then go :sysinfo
when 'Exit' then :halt
end
end
key('q') { :halt }
key(:escape) { :halt }
end
end
end