Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/moon-ui-gpui/src/screener/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
10 changes: 10 additions & 0 deletions crates/moon-ui-gpui/src/screener/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion crates/moon-ui-gpui/src/screener/table/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
Loading