window.open

This commit is contained in:
2026-05-13 21:12:39 +02:00
parent 757d999b9a
commit f79a98229a
10 changed files with 277 additions and 269 deletions

View File

@@ -2,38 +2,40 @@
module UI
module Windows
module_function
def online_users(app, services:)
users = services[:online].user_list
username = app.context[:username]
body = if users.empty?
[' (no one else here yet)']
else
users.map { |u| u == username ? " #{u} ← you" : " #{u}" }
end
BBS::Windows::Info.open(app,
title: ' Online Users ',
width: 50, height: [users.size + 6, 10].max,
scroll: true, body: body
)
class OnlineUsers
def self.open(app, services:)
users = services[:online].user_list
username = app.context[:username]
body = if users.empty?
[' (no one else here yet)']
else
users.map { |u| u == username ? " #{u} ← you" : " #{u}" }
end
BBS::Windows::Info.open(app,
title: ' Online Users ',
width: 50, height: [users.size + 6, 10].max,
scroll: true, body: body
)
end
end
def last_callers(app, services:)
callers = services[:last_callers].recent(15)
body = if callers.empty?
[' (no callers recorded yet)']
else
callers.map do |c|
ts = c.timestamp.to_s[0, 19].sub('T', ' ')
" \e[2;37m#{ts}\e[0m \e[1;33m#{c.username}\e[0m"
class LastCallers
def self.open(app, services:)
callers = services[:last_callers].recent(15)
body = if callers.empty?
[' (no callers recorded yet)']
else
callers.map do |c|
ts = c.timestamp.to_s[0, 19].sub('T', ' ')
" \e[2;37m#{ts}\e[0m \e[1;33m#{c.username}\e[0m"
end
end
end
BBS::Windows::Info.open(app,
title: ' Last Callers ',
width: 64, height: [callers.size + 6, 10].max,
scroll: true, body: body
)
BBS::Windows::Info.open(app,
title: ' Last Callers ',
width: 64, height: [callers.size + 6, 10].max,
scroll: true, body: body
)
end
end
end
end