From 28830e1c9d726e3a5f5bd6ae430293a1583ddc33 Mon Sep 17 00:00:00 2001 From: kirillDevPro <113171057+kirillDevPro@users.noreply.github.com> Date: Sat, 29 Aug 2026 23:40:53 +0200 Subject: [PATCH] fix(screener): align filter labels and row hover --- Cargo.lock | 74 +++++++++---------- crates/moon-ui-gpui/src/screener/mod.rs | 2 +- crates/moon-ui-gpui/src/screener/table.rs | 10 +++ .../moon-ui-gpui/src/screener/table/tests.rs | 18 ++++- crates/moon-ui-gpui/src/screener/view.rs | 10 ++- 5 files changed, 71 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea41f53c..232b08ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -255,7 +255,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -266,7 +266,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -1673,7 +1673,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -1905,7 +1905,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -2805,7 +2805,7 @@ dependencies = [ "hyper", "libc", "pin-project-lite", - "socket2 0.5.10", + "socket2 0.6.5", "tokio", "tower-service", "tracing", @@ -3771,7 +3771,7 @@ dependencies = [ [[package]] name = "moon-collections" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "indexmap", "moon-gpui-util", @@ -3818,7 +3818,7 @@ dependencies = [ [[package]] name = "moon-derive-refineable" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "proc-macro2", "quote", @@ -3828,7 +3828,7 @@ dependencies = [ [[package]] name = "moon-gpui" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "accesskit", "anyhow", @@ -3912,7 +3912,7 @@ dependencies = [ [[package]] name = "moon-gpui-linux" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "accesskit", "accesskit_unix", @@ -3963,7 +3963,7 @@ dependencies = [ [[package]] name = "moon-gpui-macos" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "accesskit", "accesskit_macos", @@ -4010,7 +4010,7 @@ dependencies = [ [[package]] name = "moon-gpui-macros" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -4021,7 +4021,7 @@ dependencies = [ [[package]] name = "moon-gpui-platform" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "console_error_panic_hook", "moon-gpui", @@ -4034,7 +4034,7 @@ dependencies = [ [[package]] name = "moon-gpui-shared-string" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "schemars", "serde", @@ -4044,7 +4044,7 @@ dependencies = [ [[package]] name = "moon-gpui-util" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "anyhow", "log", @@ -4054,7 +4054,7 @@ dependencies = [ [[package]] name = "moon-gpui-web" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "anyhow", "console_error_panic_hook", @@ -4078,7 +4078,7 @@ dependencies = [ [[package]] name = "moon-gpui-wgpu" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "anyhow", "bytemuck", @@ -4107,7 +4107,7 @@ dependencies = [ [[package]] name = "moon-gpui-windows" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "accesskit", "accesskit_windows", @@ -4135,7 +4135,7 @@ dependencies = [ [[package]] name = "moon-http-client" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "anyhow", "async-compression", @@ -4155,7 +4155,7 @@ dependencies = [ [[package]] name = "moon-media" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "anyhow", "bindgen", @@ -4170,7 +4170,7 @@ dependencies = [ [[package]] name = "moon-perf" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "moon-collections", "serde", @@ -4180,7 +4180,7 @@ dependencies = [ [[package]] name = "moon-refineable" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "moon-derive-refineable", ] @@ -4188,7 +4188,7 @@ dependencies = [ [[package]] name = "moon-scheduler" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "async-task", "backtrace", @@ -4203,7 +4203,7 @@ dependencies = [ [[package]] name = "moon-sum-tree" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "heapless", "log", @@ -4214,7 +4214,7 @@ dependencies = [ [[package]] name = "moon-ui" version = "0.1.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "moon-ui-components", "moon-ui-components-assets", @@ -4223,7 +4223,7 @@ dependencies = [ [[package]] name = "moon-ui-components" version = "0.1.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "aho-corasick", "anyhow", @@ -4273,7 +4273,7 @@ dependencies = [ [[package]] name = "moon-ui-components-assets" version = "0.1.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "anyhow", "log", @@ -4287,7 +4287,7 @@ dependencies = [ [[package]] name = "moon-ui-components-macros" version = "0.1.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "proc-macro2", "quote", @@ -4338,7 +4338,7 @@ dependencies = [ [[package]] name = "moon-util-macros" version = "0.0.0" -source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#7bc25ba6baad02ce658f63c9875c313b207c9371" +source = "git+https://github.com/Moonbot-Tech/MoonUI?branch=master#3a005c158689f9ed27f1247975c8368be4654736" dependencies = [ "moon-perf", "quote", @@ -5631,7 +5631,7 @@ dependencies = [ "quinn-udp", "rustc-hash 2.1.3", "rustls", - "socket2 0.5.10", + "socket2 0.6.5", "thiserror 2.0.20", "tokio", "tracing", @@ -5669,9 +5669,9 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.10", + "socket2 0.6.5", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -6233,7 +6233,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -6830,7 +6830,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -6888,7 +6888,7 @@ dependencies = [ "cfg-if", "libc", "psm", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -7231,7 +7231,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix 1.1.4", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -7681,7 +7681,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" dependencies = [ "memoffset", "tempfile", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -8601,7 +8601,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] diff --git a/crates/moon-ui-gpui/src/screener/mod.rs b/crates/moon-ui-gpui/src/screener/mod.rs index c79721de..fb5bf012 100644 --- a/crates/moon-ui-gpui/src/screener/mod.rs +++ b/crates/moon-ui-gpui/src/screener/mod.rs @@ -1,7 +1,7 @@ //! Screener window: a Moonbot-style coin table. //! //! A separate singleton OS window, following the Strategies-window pattern, hosts a `MoonDataTable` -//! for every market on connected exchanges. Headers control sorting, while Coin and DVol filters +//! for every market on connected exchanges. Headers control sorting, while Market and Vol. filters //! sit in the footer. Multi-core data is grouped by the market-data provider returned by //! `MarketDataSource::provider_of`: cores on one exchange share a provider in deduplicated mode, //! while per-core mode keeps separate providers. Market columns are read once per provider group; diff --git a/crates/moon-ui-gpui/src/screener/table.rs b/crates/moon-ui-gpui/src/screener/table.rs index 33a792ba..048f8b27 100644 --- a/crates/moon-ui-gpui/src/screener/table.rs +++ b/crates/moon-ui-gpui/src/screener/table.rs @@ -45,6 +45,16 @@ pub(super) const COLS: &[ColDef] = &[ ("pos", "Pos", 66.0, true), ]; +/// Return the displayed title for a Screener column key. +/// +/// Footer filters resolve their labels through the same schema as the header so the two surfaces +/// cannot drift back to different Moonbot terminology. +pub(super) fn column_title(key: &str) -> &'static str { + COLS.iter() + .find(|column| column.0 == key) + .map_or("", |column| column.1) +} + /// Restore a visible Screener sort as `(key, descending)`. /// /// The historical Vol.-descending default remains preferred while that column is visible. If it is diff --git a/crates/moon-ui-gpui/src/screener/table/tests.rs b/crates/moon-ui-gpui/src/screener/table/tests.rs index 8685f03e..90cd7a72 100644 --- a/crates/moon-ui-gpui/src/screener/table/tests.rs +++ b/crates/moon-ui-gpui/src/screener/table/tests.rs @@ -4,7 +4,23 @@ use std::collections::HashSet; use moon_core::config::TableSortPreference; -use super::{COLS, restore_sort}; +use super::{COLS, column_title, restore_sort}; + +/// The footer labels must resolve from the same schema as the Market and Vol. headers. +/// +/// Mutation: restore independent `Coin` or `DVol` footer literals. The footer would again disagree +/// with the headers and the source assertion below would redden. +#[test] +fn screener_filter_labels_reuse_matching_column_titles() { + assert_eq!(column_title("market"), "Market"); + assert_eq!(column_title("vol24"), "Vol."); + + let view_source = include_str!("../view.rs"); + assert!(view_source.contains("label(column_title(\"market\"))")); + assert!(view_source.contains("label(column_title(\"vol24\"))")); + assert!(!view_source.contains("label(\"Coin\")")); + assert!(!view_source.contains("label(\"DVol\")")); +} /// `screener/table.rs:restore_sort` must translate MoonUI ascending into the existing `desc` flag. /// diff --git a/crates/moon-ui-gpui/src/screener/view.rs b/crates/moon-ui-gpui/src/screener/view.rs index 13c55418..9a354955 100644 --- a/crates/moon-ui-gpui/src/screener/view.rs +++ b/crates/moon-ui-gpui/src/screener/view.rs @@ -20,7 +20,9 @@ use moon_core::session::CoreId; use crate::panels::{RenderGate, data_table_host}; use crate::{Backend, design}; -use super::table::{COLS, ColDef, Entry, moon, moon_alpha, parse_vol, screener_row, sort_entries}; +use super::table::{ + COLS, ColDef, Entry, column_title, moon, moon_alpha, parse_vol, screener_row, sort_entries, +}; const SCREENER_HEADER_H: f32 = 32.0; @@ -514,7 +516,7 @@ impl ScreenerView { .child(menu) } - /// Build the bottom bar with Moonbot-style source, Coin, and DVol controls on the left and the + /// Build the bottom bar with Moonbot-style source, Market, and Vol. controls on the left and the /// filtered/total count plus column menu on the right. fn bottom_bar(&self, p: MoonPalette, cx: &Context) -> impl IntoElement { let label = |text: &'static str| { @@ -534,7 +536,7 @@ impl ScreenerView { .border_t(px(1.0)) .border_color(moon_alpha(p.border, 1.0)) .child(self.source_combo(cx)) - .child(label("Coin")) + .child(label(column_title("market"))) .child( div().w(px(90.0)).child( MoonInput::new("scr-coin") @@ -543,7 +545,7 @@ impl ScreenerView { .cleanable(true), ), ) - .child(label("DVol")) + .child(label(column_title("vol24"))) .child( div().w(px(90.0)).child( MoonInput::new("scr-dvol")