dash-frontend: Welcome screen: Add "You're all set"

This commit is contained in:
Aleksander 2026-07-01 00:03:36 +02:00 committed by galister
parent 741ffee62e
commit 169fa0d32a
7 changed files with 53 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1,16 +1,14 @@
<layout>
<include src="theme.xml" />
<macro name="home_button" round="8" color="#00000033" border_color="#FFFFFF77" hover_color="~color_accent" hover_border_color="#FFFFFF" />
<template name="MenuButton">
<Button
id="${id}"
width="120"
height="82"
color="#00000033"
border_color="#FFFFFF77"
hover_color="~color_accent"
hover_border_color="#FFFFFF"
round="8">
macro="home_button">
<div gap="8"
align_items="center"
justify_content="center"

View File

@ -18,6 +18,10 @@
<MenuButton id="btn_monado" icon="dashboard/monado.svg" text="Monado" />
<MenuButton id="btn_settings" icon="dashboard/settings.svg" translation="SETTINGS" />
</div>
<Button id="btn_welcome_screen" macro="home_button" tooltip="APP_SETTINGS.SHOW_WELCOME_SCREEN">
<sprite src_builtin="dashboard/welcome.svg" width="32" height="32" margin="16"/>
</Button>
</div>
</elements>
</layout>

View File

@ -12,6 +12,10 @@
<label wrap="1" text="${text}" size="20" width="500" shadow="#000000" weight="bold"/>
</template>
<template name="TextDescBig">
<label text="${text}" size="24" shadow="#000000" weight="bold"/>
</template>
<macro name="video_overlay_component" looping="1" width="100%" height="auto" max_height="100%" aspect_ratio="1.777777" position="relative"/>
<macro name="video_overlay_content" new_pass="1" position="absolute" width="100%" height="100%" padding_bottom="32"/>

View File

@ -0,0 +1,19 @@
<layout>
<include src_builtin="welcome_common.xml"/>
<elements>
<div flex_direction="row" align_items="center">
<image src_builtin="dashboard/check_3d.png" width="256" height="256"/>
<div flex_direction="column" gap="8" max_width="480">
<TextDescBig text="You're all set!"/>
<label size="16" wrap="1" text="These basics will allow you to start using WayVR with ease."/>
<label size="16" wrap="1" text="There are many other features worth customizing. For more information, check the documentation at"/>
<div flex_direction="row" align_items="center" gap="8">
<sprite src_builtin="dashboard/globe.svg" width="24" height="24" color="~color_accent"/>
<label size="20" weight="bold" text="wayvr.org" color="~color_accent"/>
</div>
<Button margin_top="16" sprite_src_builtin="dashboard/home.svg" id="btn_home_screen" text="Go back to Home screen" min_height="32" align_self="baseline"/>
</div>
</div>
</elements>
</layout>

View File

@ -69,15 +69,15 @@ impl<T> TabHome<T> {
let btn_apps = state.fetch_component_as::<ComponentButton>("btn_apps")?;
let btn_games = state.fetch_component_as::<ComponentButton>("btn_games")?;
let btn_monado = state.fetch_component_as::<ComponentButton>("btn_monado")?;
//let btn_processes = state.fetch_component_as::<ComponentButton>("btn_processes")?;
let btn_settings = state.fetch_component_as::<ComponentButton>("btn_settings")?;
let btn_welcome_screen = state.fetch_component_as::<ComponentButton>("btn_welcome_screen")?;
let tasks = &mut frontend.tasks;
tasks.handle_button(&btn_apps, FrontendTask::SetTab(TabType::Apps));
tasks.handle_button(&btn_games, FrontendTask::SetTab(TabType::Games));
tasks.handle_button(&btn_monado, FrontendTask::SetTab(TabType::Monado));
//tasks.handle_button(&btn_processes, FrontendTask::SetTab(TabType::Processes));
tasks.handle_button(&btn_settings, FrontendTask::SetTab(TabType::Settings));
tasks.handle_button(&btn_welcome_screen, FrontendTask::SetTab(TabType::Welcome));
Ok(Self {
state,

View File

@ -1,4 +1,4 @@
use std::marker::PhantomData;
use std::{marker::PhantomData, rc::Rc};
use wgui::{
assets::AssetPath,
@ -10,7 +10,7 @@ use wgui::{
};
use crate::{
frontend::Frontend,
frontend::{Frontend, FrontendTask, FrontendTasks},
tab::{Tab, TabType},
};
@ -30,11 +30,12 @@ pub struct TabWelcome<T> {
current_page: u8,
id_pips: WidgetID,
id_content: WidgetID,
frontend_tasks: FrontendTasks,
state_tab: Option<ParserState>,
}
const PAGE_COUNT: u8 = 5; // 0-4 inclusive
const PAGE_COUNT: u8 = 6; // 0-5 inclusive
impl<T> Tab<T> for TabWelcome<T> {
fn get_type(&self) -> TabType {
@ -97,6 +98,7 @@ impl<T> TabWelcome<T> {
id_content,
tasks,
state_tab: None,
frontend_tasks: frontend.tasks.clone(),
})
}
@ -123,7 +125,7 @@ impl<T> TabWelcome<T> {
let globals = layout.state.globals.clone();
self.state_tab = Some(wgui::parser::parse_from_assets(
let state = wgui::parser::parse_from_assets(
&ParseDocumentParams {
globals,
path: AssetPath::BuiltIn(&format!("gui/tab/welcome_page_{}.xml", self.current_page)),
@ -131,7 +133,19 @@ impl<T> TabWelcome<T> {
},
layout,
self.id_content,
)?);
)?;
if let Ok(btn) = state.fetch_component_as::<ComponentButton>("btn_home_screen") {
btn.on_click({
let tasks = self.frontend_tasks.clone();
Rc::new(move |_, _| {
tasks.push(FrontendTask::SetTab(TabType::Home));
Ok(())
})
});
}
self.state_tab = Some(state);
Ok(())
}