From c46eede457e29798fbaa639e8df8fd62b5cdd2c8 Mon Sep 17 00:00:00 2001 From: Afnan <72243953+Afnanksalal@users.noreply.github.com> Date: Thu, 30 Jul 2026 02:55:33 +0530 Subject: [PATCH] feat: add app-header sync status slot (#19) --- examples/gallery.rs | 1 + src/components.rs | 8 ++++++++ src/lib.rs | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/examples/gallery.rs b/examples/gallery.rs index b083ede..5626604 100644 --- a/examples/gallery.rs +++ b/examples/gallery.rs @@ -241,6 +241,7 @@ impl Gallery { t, &mut self.header_project_name, &mut self.header_editing, + Some(("Sync live", true)), ); ui.add_space(2.0); diff --git a/src/components.rs b/src/components.rs index 078e43a..9267f39 100644 --- a/src/components.rs +++ b/src/components.rs @@ -1635,6 +1635,8 @@ pub struct AppHeaderActions { /// `&mut is_editing` flag. Click the name to enter edit mode, Enter to commit /// (returns `renamed: true`), Esc to cancel (caller restores the previous /// name from its own copy if needed). +/// `status` optionally renders a shared chip beside the name; the boolean +/// selects its active/accent treatment. /// /// The brand block paints the Tokito mark (via [`crate::brand_mark`]); the /// mark itself carries the wordmark, so no system-font label is rendered. @@ -1643,6 +1645,7 @@ pub fn app_header( t: &Tokens, project_name: &mut String, is_editing: &mut bool, + status: Option<(&str, bool)>, ) -> AppHeaderActions { let mut actions = AppHeaderActions::default(); let height = 52.0; @@ -1698,6 +1701,11 @@ pub fn app_header( } } + if let Some((label, active)) = status { + ui.add_space(t.space_3); + let _ = chip(ui, t, label, active); + } + // Right side: settings gear. ui.with_layout(Layout::right_to_left(Align::Center), |ui| { if icon_button(ui, t, icons::ph::GEAR_SIX, 32.0, t.text_2).clicked() { diff --git a/src/lib.rs b/src/lib.rs index 90480ef..3212e1f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,9 @@ +#![allow(unknown_lints)] +// egui's geometry APIs determine these literals as f32 unambiguously. Newer +// Rust releases warn on that established fallback under `-D warnings`, while +// Tokito still supports compilers from before the lint existed. +#![allow(float_literal_f32_fallback)] + //! # tokito_ui //! //! A small, opinionated component library for [`egui`] 0.29 — the shared