fix(bluetooth): improve device list UX and transitions

This commit is contained in:
Andrei Ivanou 2026-03-08 17:06:03 +01:00 committed by Michael Murphy
parent b3e3738189
commit 415e1d8832

View file

@ -903,6 +903,7 @@ fn connected_devices() -> Section<crate::pages::Message> {
fn available_devices() -> Section<crate::pages::Message> { fn available_devices() -> Section<crate::pages::Message> {
crate::slab!(descriptions { crate::slab!(descriptions {
device_connect = fl!("bluetooth", "connect");
device_connecting = fl!("bluetooth", "connecting"); device_connecting = fl!("bluetooth", "connecting");
}); });
@ -938,18 +939,15 @@ fn available_devices() -> Section<crate::pages::Message> {
widget::horizontal_space().into(), widget::horizontal_space().into(),
]; ];
if device.enabled == Active::Enabling { if device.enabled == Active::Disabled {
items.push( items.push(widget::button::text(&descriptions[device_connect]).on_press(Message::ConnectDevice(path.clone())).into(), )
text(&descriptions[device_connecting])
.class(theme::Text::Color(color!(128, 128, 128)))
.into(),
);
} }
Some(
widget::mouse_area(settings::item_row(items)) if device.enabled == Active::Enabling || device.enabled == Active::Enabled {
.on_press(Message::ConnectDevice(path.clone())) items.push(text(&descriptions[device_connecting]).class(theme::Text::Color(color!(128, 128, 128))).into(), );
.into(), }
)
Some(widget::mouse_area(settings::item_row(items)).into(), )
}) })
.fold(section, settings::Section::add) .fold(section, settings::Section::add)
.apply(Element::from) .apply(Element::from)