From 37dc3ffa47524560a74a94189fd1fd1a97b251c4 Mon Sep 17 00:00:00 2001 From: restitux Date: Sun, 25 Jan 2026 13:15:26 -0700 Subject: [PATCH 1/2] channel selection works a lot better --- gui/assets/main.scss | 34 +++++++++++++++++++++++++++++++- gui/src/app.rs | 47 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 72 insertions(+), 9 deletions(-) diff --git a/gui/assets/main.scss b/gui/assets/main.scss index 4e7f13c..3e6341a 100644 --- a/gui/assets/main.scss +++ b/gui/assets/main.scss @@ -83,6 +83,38 @@ a:visited { } } + + +.channel_header { + display: flex; + flex-direction: row; + align-items: center; +} + +.channel_arrow { + width: 1em; + text-align: center; + margin-right: 0.25rem; +} + +.channel_arrow--placeholder { + pointer-events: none; + visibility: hidden; +} + +/* The whole right side of the row is the dblclick target */ +.channel_row_click { + flex: 1; + cursor: pointer; +} + +/* still keep text non-selectable if desired */ +.channel_details { + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + .channel { &_details { flex: 0 0 100%; @@ -392,4 +424,4 @@ a:visited { color: red; } } -} \ No newline at end of file +} diff --git a/gui/src/app.rs b/gui/src/app.rs index 0a865d3..d60dad1 100644 --- a/gui/src/app.rs +++ b/gui/src/app.rs @@ -291,22 +291,53 @@ pub fn Channel(id: ChannelId) -> Element { return rsx!("missing channel {id}"); }; + let mut open = use_signal(|| true); + + let has_children = !state.users.is_empty() || !state.children.is_empty(); + rsx!( - details { + div { class: "channel_details", - open: true, - summary { - span { - role: "button", - ondoubleclick: move |evt| { + + div { + class: "channel_header", + // Arrow: only toggles open + if has_children { + span { + class: "channel_arrow", + onclick: move |evt| { + evt.stop_propagation(); + evt.prevent_default(); + let mut w = open.write(); + *w = !*w; + }, + if *open.read() { "▾" } else { "▸" } + } + } else { + span { + class: "channel_arrow channel_arrow--placeholder", + " " + } + } + + // Clickable row area (everything except the arrow) + div { + class: "channel_row_click", + ondblclick: move |evt| { evt.stop_propagation(); evt.prevent_default(); net.send(EnterChannel { channel: id, user }) }, - "{state.name}" + // remove dblclick from the inner span + span { + class: "channel_title", + "{state.name}" + } + // if you add icons/badges later, put them here too } } - if state.users.len() + state.children.len() > 0 { + + if *open.read() && has_children { div { class: "channel_children", for id in state.users.iter() { -- 2.52.0 From bd4620139fd0676287f3e1fa9edfc8cebf0d9874 Mon Sep 17 00:00:00 2001 From: restitux Date: Sun, 25 Jan 2026 13:19:00 -0700 Subject: [PATCH 2/2] add background hover color change --- gui/assets/main.scss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gui/assets/main.scss b/gui/assets/main.scss index 3e6341a..f6054ab 100644 --- a/gui/assets/main.scss +++ b/gui/assets/main.scss @@ -84,7 +84,6 @@ a:visited { } - .channel_header { display: flex; flex-direction: row; @@ -105,9 +104,16 @@ a:visited { /* The whole right side of the row is the dblclick target */ .channel_row_click { flex: 1; + padding: 0.1rem 0.25rem 0.1rem 0.5rem; cursor: pointer; } +/* Hover highlight for whole row area (title + blank space) */ +.channel_row_click:hover { + background-color: var(--channel-hover-bg, #222); /* pick your color */ +} + + /* still keep text non-selectable if desired */ .channel_details { -webkit-user-select: none; -- 2.52.0