Added app icon, removed W3DHub::NAME constant, replaced stub content in community updates section with actual W3D Hub news

This commit is contained in:
2021-11-29 18:39:15 -06:00
parent e9aeb4a3e2
commit 13103a7380
6 changed files with 91 additions and 17 deletions

View File

@@ -2,19 +2,25 @@ class W3DHub
class Pages
class Community < Page
def setup
@w3dhub_news ||= nil
body.clear do
stack(width: 1.0, height: 1.0, padding: 8) do
stack(width: 1.0, height: 0.15) do
tagline "<b>Welcome to the #{W3DHub::NAME}</b>"
para "The #{W3DHub::NAME} is a one-stop shop for your W3D gaming needs, providing game downloads, automatic updating, an integrated server browser, and centralized management of in-game options."
tagline "<b>Welcome to #{I18n.t(:app_name)}</b>"
para "The #{I18n.t(:app_name_simple)} is a one-stop shop for your W3D gaming needs, providing game downloads, automatic updating, an integrated server browser, and centralized management of in-game options."
end
flow(width: 1.0, height: 0.15, margin_bottom: 24) do
flow(width: (1.0 - 0.27) / 2, height: 1.0) do
icon_container_width = 0.37
flow(width: (1.0 - icon_container_width) / 2, height: 1.0) do
end
flow(width: 0.27, height: 1.0) do
image "#{GAME_ROOT_PATH}/media/icons/w3dhub.png", height: 1.0, hover: { color: 0xaa_ffffff }, tip: "W3D Hub Forums" do
flow(width: icon_container_width, height: 1.0) do
image "#{GAME_ROOT_PATH}/media/icons/app.png", hover: { color: 0xaa_ffffff }, height: 1.0, tip: "#{I18n.t(:app_name)} Github Repository" do
Launchy.open("https://github.com/cyberarm/w3dhub_ruby")
end
image "#{GAME_ROOT_PATH}/media/icons/w3dhub.png", hover: { color: 0xaa_ffffff }, height: 1.0, margin_left: 32, tip: "W3D Hub Forums" do
Launchy.open("https://w3dhub.com/forum/")
end
image "#{GAME_ROOT_PATH}/media/social_media_icons/discord.png", hover: { color: 0xaa_ffffff }, height: 1.0, margin_left: 32, tip: "W3D Hub Discord Server" do
@@ -26,9 +32,11 @@ class W3DHub
end
end
stack(width: 1.0, height: 0.55, scroll: true) do
tagline "<b>Latest Updates</b>"
para "Hello World " * 100
stack(width: 1.0, height: 0.55) do
tagline "<b>Latest Updates</b>", height: 0.1
@wd3hub_news_container = flow(width: 1.0, height: 0.9, padding: 8, scroll: true) do
end
end
stack(width: 1.0, height: 0.15, margin_top: 16) do
@@ -44,6 +52,69 @@ class W3DHub
end
end
end
if @w3dhub_news
populate_w3dhub_news
else
Thread.new do
fetch_w3dhub_news
main_thread_queue << proc { populate_w3dhub_news }
end
@wd3hub_news_container.clear do
para I18n.t(:"games.fetching_news"), padding: 8
end
end
end
def fetch_w3dhub_news
news = Api.news("launcher-home")
if news
news.items[0..9].each do |item|
Cache.fetch(item.image)
end
@w3dhub_news = news
end
end
def populate_w3dhub_news
return unless @w3dhub_news
if (feed = @w3dhub_news)
@wd3hub_news_container.clear do
feed.items.sort_by { |i| i.timestamp }.reverse[0..9].each do |item|
flow(width: 0.5, height: 128, margin: 4) do
# background 0x88_000000
path = Cache.path(item.image)
if File.exist?(path)
image path, height: 1.0, padding: 4
else
image BLACK_IMAGE, height: 1.0, padding: 4
end
stack(width: 0.6, height: 1.0) do
stack(width: 1.0, height: 112) do
link "<b>#{item.title}</b>", text_size: 18 do
Launchy.open(item.uri)
end
inscription item.blurb.gsub(/\n+/, "\n").strip[0..180]
end
flow(width: 1.0) do
inscription item.timestamp.strftime("%Y-%m-%d"), width: 0.499
link I18n.t(:"games.read_more"), width: 0.5, text_align: :right, text_size: 14 do
Launchy.open(item.uri)
end
end
end
end
end
end
end
end
end
end

View File

@@ -7,7 +7,7 @@ class W3DHub
background 0xff_252525
@fraction = 0.0
@w3dhub_logo = get_image("#{GAME_ROOT_PATH}/media/icons/w3dhub.png")
@w3dhub_logo = get_image("#{GAME_ROOT_PATH}/media/icons/app.png")
@tasks = {
refresh_user_token: { started: false, complete: false },
service_status: { started: false, complete: false },
@@ -24,8 +24,8 @@ class W3DHub
@progressbar = progress height: 0.025, width: 1.0
flow(width: 1.0, height: 0.05, padding_left: 16, padding_right: 16, padding_bottom: 8, padding_top: 8) do
@status_label = caption "Starting #{NAME}...", width: 0.5
inscription "#{NAME} #{W3DHub::VERSION}", width: 0.5, text_align: :right
@status_label = caption "Starting #{I18n.t(:app_name_simple)}...", width: 0.5
inscription "#{I18n.t(:app_name)} #{W3DHub::VERSION}", width: 0.5, text_align: :right
end
end
end
@@ -94,13 +94,13 @@ class W3DHub
@tasks[:service_status][:complete] = true
else
# FIXME: MAIN THREAD!
@status_label.value = "W3D Hub Service is down."
@status_label.value = I18n.t(:"boot.w3dhub_service_is_down")
end
end
end
def applications
@status_label.value = "Checking for updates..."
@status_label.value = I18n.t(:"boot.checking_for_updates")
Thread.new do
@applications = Api.applications
@@ -114,7 +114,7 @@ class W3DHub
end
def server_list
@status_label.value = "Getting server list..."
@status_label.value = I18n.t(:"server_browser.fetching_server_list")
Thread.new do
begin

View File

@@ -26,7 +26,7 @@ class W3DHub
background 0xff_252525
@header_container = flow(width: 1.0, height: 0.15, padding: 4) do
image "#{GAME_ROOT_PATH}/media/icons/w3dhub.png", width: 0.11
image "#{GAME_ROOT_PATH}/media/icons/app.png", width: 0.11
stack(width: 0.89, height: 1.0) do
# background 0xff_885500

View File

@@ -1,5 +1,4 @@
class W3DHub
DIR_NAME = "W3DHubAlt"
NAME = "W3D Hub Launcher"
VERSION = "0.1.0"
end

View File

@@ -1,5 +1,9 @@
en:
app_name: W3D Hub Launcher
app_name: Cyberarm's Linux Friendly W3D Hub Launcher # W3D Hub Launcher
app_name_simple: W3D Hub Linux Launcher
boot:
w3dhub_service_is_down: W3D Hub service is down.
checking_for_updates: Checking for updates...
interface:
log_in: Log in
register: Register

BIN
media/icons/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB