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

View File

@@ -0,0 +1,20 @@
# frozen_string_literal: true
module PageViewPage
def self.configure(tui)
tui.page :page_view do
render do
text @page_meta[0, cont_w], x: CONT_X, y: CONT_Y, style: THEME[:normal]
(@detail[@scroll, cont_h - 2] || []).each_with_index do |l, i|
text l[0, cont_w], x: CONT_X, y: CONT_Y + 2 + i, style: THEME[:normal]
end
text "#{@scroll + 1}/#{@detail.size} ↑↓ scroll q back",
x: CONT_X, y: CONT_Y + cont_h, style: THEME[:normal]
end
nav :scroll, content: -> { @detail }, window: -> { cont_h - 2 }
key('q') { @scroll = 0; go(@prev_page || :idle) }
key(:escape) { @scroll = 0; go(@prev_page || :idle) }
end
end
end