Improvements to server browser

This commit is contained in:
2024-03-05 12:50:51 -06:00
parent 0cbe013a11
commit d350e51d0b
2 changed files with 14 additions and 2 deletions

View File

@@ -476,6 +476,17 @@ class W3DHub
app.channels.detect { |g| g.id.to_s == channel_id.to_s }&.name app.channels.detect { |g| g.id.to_s == channel_id.to_s }&.name
end end
def application(app_id)
Store.applications.games.detect { |g| g.id.to_s == app_id.to_s }
end
def channel(app_id, channel_id)
app = Store.applications.games.detect { |g| g.id.to_s == app_id.to_s }
return unless app
app.channels.detect { |g| g.id.to_s == channel_id.to_s }
end
# No application tasks are being done # No application tasks are being done
def idle? def idle?
!busy? !busy?

View File

@@ -369,7 +369,7 @@ class W3DHub
flow(fill: true) flow(fill: true)
image game_icon(server), height: 1.0 image game_icon(server), height: 1.0
title server.status.name, text_wrap: :none title server.status.name[0..30], text_wrap: :none
flow(fill: true) flow(fill: true)
end end
@@ -377,7 +377,8 @@ class W3DHub
flow(width: 1.0, height: 46, margin_top: 16, margin_bottom: 16) do flow(width: 1.0, height: 46, margin_top: 16, margin_bottom: 16) do
game_installed = Store.application_manager.installed?(server.game, server.channel) game_installed = Store.application_manager.installed?(server.game, server.channel)
game_updatable = Store.application_manager.updateable?(server.game, server.channel) game_updatable = Store.application_manager.updateable?(server.game, server.channel)
style = server.channel != "release" ? TESTING_BUTTON : {} channel = Store.application_manager.channel(server.game, server.channel)
style = ((channel && channel.user_level.downcase.strip == "public") || server.channel == "release") ? {} : TESTING_BUTTON
flow(fill: true) flow(fill: true)
button "<b>#{I18n.t(:"server_browser.join_server")}</b>", enabled: (game_installed && !game_updatable), **style do button "<b>#{I18n.t(:"server_browser.join_server")}</b>", enabled: (game_installed && !game_updatable), **style do