fix(ui): Onboarding navbar window titlebar buttons finally work

This commit is contained in:
LynithDev 2026-07-10 21:24:30 +02:00
parent fcc519d25e
commit 4ac89a44f2
4 changed files with 49 additions and 27 deletions

View file

@ -41,7 +41,7 @@ pub use link_confirm::ConfirmLinkOverlay;
pub use local_image::LocalImage;
pub use log_viewer::LogViewer;
pub use major_version_card::MajorVersionCard;
pub use navbar::AppNavbar;
pub use navbar::{AppNavbar, OnboardingNavbar};
pub(crate) use navbar::window_controls;
pub use notifications::NotificationCenter;
pub use overlay_popup::OverlayPopup;

View file

@ -1,6 +1,8 @@
mod app_navbar;
mod onboarding_navbar;
pub use app_navbar::Navbar as AppNavbar;
pub use onboarding_navbar::OnboardingNavbar;
use freya::prelude::*;

View file

@ -0,0 +1,43 @@
use freya::prelude::*;
use crate::components::window_controls;
use crate::theme::{self, colors};
#[derive(PartialEq)]
pub struct OnboardingNavbar;
impl Component for OnboardingNavbar {
fn render(&self) -> impl IntoElement {
rect()
.width(Size::fill())
.height(Size::px(theme::NAVBAR_HEIGHT_PX))
.child(
rect()
.horizontal()
.width(Size::fill())
.height(Size::fill())
.content(Content::Flex)
.cross_align(Alignment::Center)
.padding(Gaps::new_symmetric(0., 24.))
.child(logo())
.child(rect().width(Size::flex(1.0)).height(Size::fill()))
.child(window_controls()),
)
.child(
rect()
.window_drag()
.width(Size::window_percent(100.))
.height(Size::px(theme::NAVBAR_HEIGHT_PX))
.position(Position::new_absolute().top(0.).left(0.).right(0.)),
)
}
}
fn logo() -> impl IntoElement {
let bytes = use_memo(|| crate::AppAssets::get_bytes("logo.svg").unwrap_or_default());
svg(bytes.read().cloned())
.height(Size::px(36.))
.width(Size::px(170.))
.color(colors::fg_primary())
}

View file

@ -4,12 +4,12 @@ use freya::prelude::*;
use freya::router::{Outlet, use_route};
use crate::Route;
use crate::components::window_controls;
use crate::components::OnboardingNavbar;
use crate::hooks::{
OnboardingSelectionState, has_migration_data, onboarding_bundles_items, use_migration,
use_onboarding_bundles, use_provide_onboarding_selection,
};
use crate::theme::{self, colors};
use crate::theme::colors;
use crate::view::onboarding::{LoadingBackdrop, onboarding_step_index, onboarding_total};
#[derive(PartialEq)]
@ -71,7 +71,7 @@ impl Component for OnboardingShell {
step_index,
onboarding_total(detected_migration),
))
.child(header())
.child(OnboardingNavbar)
.child(
rect()
.width(Size::fill())
@ -99,29 +99,6 @@ fn progress_bar(step_index: usize, total: usize) -> impl IntoElement {
)
}
fn header() -> impl IntoElement {
rect()
.horizontal()
.width(Size::fill())
.height(Size::px(theme::NAVBAR_HEIGHT_PX))
.content(Content::Flex)
.cross_align(Alignment::Center)
.padding(Gaps::new_symmetric(0., 24.))
.window_drag()
.child(logo())
.child(rect().width(Size::flex(1.0)).height(Size::fill()))
.child(window_controls())
}
fn logo() -> impl IntoElement {
let bytes = use_memo(|| crate::AppAssets::get_bytes("logo.svg").unwrap_or_default());
svg(bytes.read().cloned())
.height(Size::px(36.))
.width(Size::px(170.))
.color(colors::fg_primary())
}
fn copyright() -> impl IntoElement {
rect()
.position(Position::new_absolute().bottom(16.).left(24.))