chore: add tooltip on settings system info (#926)

* chore: add tooltip on settings system info

* chore: add changeset
This commit is contained in:
LynithDev 2026-10-05 22:06:40 +02:00 • committed by GitHub
parent c765a3c2d4
commit a9fab65a0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 16 deletions

View file

@ -0,0 +1,5 @@
---
default: patch
---
# System information in the settings sidebar shows a tooltip explaining it can be clicked to copy

View file

@ -122,7 +122,7 @@ pub use tab_bar::{TabBar, TabItem};
pub use text_input::{TextInput, validate_memory, validate_number}; pub use text_input::{TextInput, validate_memory, validate_number};
pub use toasts::Toasts; pub use toasts::Toasts;
pub use toggle::{toggle, toggle_controlled}; pub use toggle::{toggle, toggle_controlled};
pub use tooltip::{TooltipHost, TooltipPlacement, use_provide_tooltips}; pub use tooltip::{TooltipHost, TooltipPlacement, use_provide_tooltips, use_tooltip_anchor};
pub use update_prompt::UpdatePromptOverlay; pub use update_prompt::UpdatePromptOverlay;
pub use version_art_gallery::{GALLERY_COVER_EDGE, VersionArtGallery}; pub use version_art_gallery::{GALLERY_COVER_EDGE, VersionArtGallery};
pub use version_card::VersionCard; pub use version_card::VersionCard;

View file

@ -11,7 +11,9 @@ use sysinfo::MemoryRefreshKind;
use sysinfo::RefreshKind; use sysinfo::RefreshKind;
use sysinfo::System; use sysinfo::System;
use crate::components::{Icon, IconType, ScrollArea, ScrollAreaCtx, TextInput}; use crate::components::{
Icon, IconType, ScrollArea, ScrollAreaCtx, TextInput, TooltipPlacement, use_tooltip_anchor,
};
use crate::hooks::{latest_changelog_version, use_changelog, use_settings_snapshot}; use crate::hooks::{latest_changelog_version, use_changelog, use_settings_snapshot};
use crate::routes::Route; use crate::routes::Route;
use crate::theme::colors; use crate::theme::colors;
@ -730,6 +732,10 @@ impl SidebarInfo {
impl Component for SidebarInfo { impl Component for SidebarInfo {
fn render(&self) -> impl IntoElement { fn render(&self) -> impl IntoElement {
let dispatch = use_dispatch(); let dispatch = use_dispatch();
let tooltip = use_tooltip_anchor(
Some("Click to copy to clipboard".into()),
TooltipPlacement::Top,
);
let items: [Cow<'static, str>; 4] = [ let items: [Cow<'static, str>; 4] = [
Cow::Borrowed(concat!( Cow::Borrowed(concat!(
@ -771,20 +777,22 @@ impl Component for SidebarInfo {
} }
}; };
rect() tooltip.attach(
.vertical() rect()
.width(Size::fill()) .vertical()
.spacing(4.) .width(Size::fill())
.font_size(12.) .spacing(4.)
.padding(Gaps::new(15., 0., 0., 0.)) .font_size(12.)
.color(colors::fg_secondary()) .padding(Gaps::new(15., 0., 0., 0.))
.children( .color(colors::fg_secondary())
items .children(
.into_iter() items
.map(|item| label().text(item).into_element()), .into_iter()
) .map(|item| label().text(item).into_element()),
.cursor(CursorIcon::Pointer) )
.on_press(copy_to_clipboard) .cursor(CursorIcon::Pointer)
.on_press(copy_to_clipboard),
)
} }
} }