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
Binary file removed assets/fonts/Inter-400.ttf
Binary file not shown.
Binary file removed assets/fonts/Inter-500.ttf
Binary file not shown.
Binary file removed assets/fonts/Inter-600.ttf
Binary file not shown.
6 changes: 3 additions & 3 deletions crates/moon-ui-gpui/src/analytics/profit_monitor/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use std::collections::HashSet;
use gpui::*;
use moon_core::config::layout::WindowLayout;
use moon_ui::{
MoonCheckbox, MoonCheckboxSize, MoonGroupBox, MoonPalette, MoonPopover, MoonPopoverPlacement,
h_flex, v_flex,
MoonCheckbox, MoonGroupBox, MoonPalette, MoonPopover, MoonPopoverPlacement, MoonSize, h_flex,
v_flex,
};
use rust_i18n::t;

Expand Down Expand Up @@ -523,7 +523,7 @@ fn pref_group(
)))
.label(t!(row.label).to_string())
.checked((row.read)(&prefs))
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
.on_change(move |checked: &bool, _window, app| {
let checked = *checked;
target.update(app, |this, cx| {
Expand Down
8 changes: 4 additions & 4 deletions crates/moon-ui-gpui/src/analytics/tuner/coins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ pub(in crate::analytics::tuner) mod state;
use gpui::prelude::FluentBuilder;
use gpui::*;
use moon_ui::{
MoonButton, MoonButtonSize, MoonButtonVariant, MoonCheckbox, MoonCheckboxSize, MoonInput,
MoonInputEvent, MoonInputState, MoonPalette, MoonScrollbarVisibility, MoonSlider,
MoonSliderEvent, MoonSliderState, MoonVirtualList, h_flex, v_flex,
MoonButton, MoonButtonSize, MoonButtonVariant, MoonCheckbox, MoonInput, MoonInputEvent,
MoonInputState, MoonPalette, MoonScrollbarVisibility, MoonSize, MoonSlider, MoonSliderEvent,
MoonSliderState, MoonVirtualList, h_flex, v_flex,
};
use rust_i18n::t;

Expand Down Expand Up @@ -594,7 +594,7 @@ fn coin_row(
if black_side { "bl" } else { "wl" }
)))
.checked(on)
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
.on_change(move |_, _w, app| {
let token = coin_token(&coin);
// The view may already be gone; a dropped window is not an error here.
Expand Down
1 change: 0 additions & 1 deletion crates/moon-ui-gpui/src/analytics/tuner/coins/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ impl AnalyticsView {
Some(n) => format!("{} {n}", t!("analytics.coins.pick_title")),
None => t!("analytics.coins.pick_title").to_string(),
},
p,
cx,
))
// The field's own label, spelled as the strategy parameter it will be written to
Expand Down
8 changes: 3 additions & 5 deletions crates/moon-ui-gpui/src/analytics/tuner/filter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use std::sync::Arc;
use gpui::prelude::FluentBuilder;
use gpui::*;
use moon_ui::{
MoonCheckbox, MoonCheckboxSize, MoonInput, MoonInputEvent, MoonInputState, MoonPalette, h_flex,
v_flex,
MoonCheckbox, MoonInput, MoonInputEvent, MoonInputState, MoonPalette, MoonSize, h_flex, v_flex,
};
use rust_i18n::t;

Expand Down Expand Up @@ -506,7 +505,7 @@ impl AnalyticsView {
// The master checkbox ignores unmapped fields (no matching
// strategy parameter): 'all enabled' = all MAPPED ones.
.checked(self.tuner.all_mapped_enabled())
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
.on_change({
let view = cx.entity();
move |ch: &bool, _w, app| {
Expand Down Expand Up @@ -633,7 +632,7 @@ impl AnalyticsView {
div().flex_none().child(
MoonCheckbox::new(SharedString::from(format!("tun-en-{fi}")))
.checked(self.tuner.enabled[fi])
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
.on_change({
let view = cx.entity();
move |ch: &bool, _w, app| {
Expand Down Expand Up @@ -801,7 +800,6 @@ impl AnalyticsView {
let header = self.shell_toolbar(
TunerKind::Filter,
t!("analytics.tuner.fields_title").to_string(),
p,
cx,
);
v_flex()
Expand Down
6 changes: 3 additions & 3 deletions crates/moon-ui-gpui/src/analytics/tuner/list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ mod tests;

use gpui::*;
use moon_ui::{
MoonButtonSize, MoonButtonVariant, MoonCheckbox, MoonCheckboxSize, MoonDropdown, MoonInput,
MoonInputEvent, MoonInputState, MoonMenuItem, MoonMenuSize, MoonPalette, h_flex,
MoonButtonSize, MoonButtonVariant, MoonCheckbox, MoonDropdown, MoonInput, MoonInputEvent,
MoonInputState, MoonMenuItem, MoonMenuSize, MoonPalette, MoonSize, h_flex,
};
use rust_i18n::t;
use std::cmp::Ordering;
Expand Down Expand Up @@ -441,7 +441,7 @@ impl AnalyticsView {
div().font_family(design::ui_font()).child(
MoonCheckbox::new("an-strat-active")
.checked(self.strat_active_only)
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
.label(t!("analytics.strat.active_only").to_string())
.on_change({
let view = cx.entity();
Expand Down
78 changes: 33 additions & 45 deletions crates/moon-ui-gpui/src/analytics/tuner/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use gpui::prelude::FluentBuilder;
use gpui::*;
use moon_core::db::ReadFail;
use moon_ui::{
MoonButton, MoonButtonSize, MoonButtonVariant, MoonCheckbox, MoonCheckboxSize, MoonDropdown,
MoonInput, MoonInputEvent, MoonInputState, MoonMenuSize, MoonPalette, MoonPopover,
MoonPopoverPlacement, MoonTag, MoonTooltipView, h_flex, v_flex,
MoonButton, MoonButtonSize, MoonButtonVariant, MoonCheckbox, MoonDropdown, MoonInput,
MoonInputEvent, MoonInputState, MoonMenuSize, MoonPalette, MoonPopover, MoonPopoverPlacement,
MoonSize, MoonTag, MoonTooltipView, h_flex, v_flex,
};
use rust_i18n::t;

Expand Down Expand Up @@ -102,7 +102,6 @@ impl AnalyticsView {
&self,
kind: TunerKind,
title: String,
p: MoonPalette,
cx: &Context<Self>,
) -> AnyElement {
let k = match kind {
Expand Down Expand Up @@ -142,41 +141,35 @@ impl AnalyticsView {
// Rounding the result affects the SUGGESTION — always shown (the suggestion is
// available without a selected strategy too, over the current scope).
if let Some(round) = round {
header = header
.child(
div()
.text_size(design::t_caption(cx))
.text_color(moon(p.text_muted))
.child(t!("analytics.tuner.round_lbl").to_string()),
)
.child(
div().flex_none().child(
MoonCheckbox::new(SharedString::from(format!("tun-round-{k}")))
.checked(round)
.size(MoonCheckboxSize::Compact)
.on_change({
let view = cx.entity();
move |ch: &bool, _w, app| {
let on = *ch;
view.update(app, |this, cx| {
match kind {
TunerKind::Filter => {
this.tuner.round_results = on;
this.tuner.invalidate_suggest();
}
TunerKind::Time => {
this.time_tuner.round_results = on;
this.time_tuner.invalidate_suggest();
}
// No rounding on this axis — the control is hidden.
TunerKind::Coins => {}
header = header.child(
div().flex_none().child(
MoonCheckbox::new(SharedString::from(format!("tun-round-{k}")))
.label(t!("analytics.tuner.round_lbl").to_string())
.checked(round)
.size(MoonSize::Sm)
.on_change({
let view = cx.entity();
move |ch: &bool, _w, app| {
let on = *ch;
view.update(app, |this, cx| {
match kind {
TunerKind::Filter => {
this.tuner.round_results = on;
this.tuner.invalidate_suggest();
}
cx.notify();
});
}
}),
),
);
TunerKind::Time => {
this.time_tuner.round_results = on;
this.time_tuner.invalidate_suggest();
}
// No rounding on this axis — the control is hidden.
TunerKind::Coins => {}
}
cx.notify();
});
}
}),
),
);
}
// Render write controls for a retained anchor, but enable them only when the action
// authority admits at least one selected target.
Expand Down Expand Up @@ -724,8 +717,9 @@ impl AnalyticsView {
.child(
MoonCheckbox::new(SharedString::from("tun-cfg-compose-f"))
.label(t!("analytics.tuner.compose_toggle").to_string())
.description(t!("analytics.tuner.compose_short").to_string())
.checked(self.tuner.compose)
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
// `on_change` hands the callback an `&mut App`, not a
// `Context`, so this is one of the call sites where a
// `cx.listener` does not fit.
Expand All @@ -745,12 +739,6 @@ impl AnalyticsView {
}
}),
)
.child(
div()
.w_full()
.text_color(moon(p.text_muted))
.child(t!("analytics.tuner.compose_short").to_string()),
)
.child(
h_flex()
.w_full()
Expand Down
14 changes: 4 additions & 10 deletions crates/moon-ui-gpui/src/analytics/tuner/time/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use gpui::*;
use moon_ui::{
MoonCheckbox, MoonCheckboxSize, MoonInput, MoonInputEvent, MoonInputState, MoonPalette,
MoonCheckbox, MoonInput, MoonInputEvent, MoonInputState, MoonPalette, MoonSize,
MoonTooltipView, h_flex, v_flex,
};
use rust_i18n::t;
Expand All @@ -28,10 +28,6 @@ use crate::design;
use crate::design::{moon, moon_alpha};
use moon_core::db::tuner::TimeWindow;

/// Width of the row-checkbox column, in `design::ui_px` units. The header spacer and the
/// slider lead-in reuse it so the field names stay in one line down the card; it is sized
/// above the compact checkbox's own box, which moonui draws at a fixed size.
pub(in crate::analytics::tuner) const CHECK_COL: f32 = 16.0;
/// Field-name column: fits "WorkingWeekTime" on one line next to the checkbox.
pub(in crate::analytics::tuner) const NAME_COL: f32 = 110.0;

Expand Down Expand Up @@ -359,7 +355,6 @@ impl AnalyticsView {
let header = self.shell_toolbar(
TunerKind::Time,
t!("analytics.time.autopick_title").to_string(),
p,
cx,
);
let cfg_row = self.shell_config_row(TunerKind::Time, p, window, cx);
Expand All @@ -386,10 +381,10 @@ impl AnalyticsView {
.bg(moon(p.table_head))
// Master checkbox over the rows' column — the filter tuner's "all on/off".
.child(
div().w(design::ui_px(cx, CHECK_COL)).flex_none().child(
div().flex_none().child(
MoonCheckbox::new("tt-en-all")
.checked(self.time_tuner.enabled.iter().all(|&e| e))
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
.on_change({
let view = cx.entity();
move |ch: &bool, _w, app| {
Expand Down Expand Up @@ -530,12 +525,11 @@ impl AnalyticsView {
let check = div()
.id(SharedString::from(format!("tt-en-w-{field}")))
.flex_none()
.w(design::ui_px(cx, CHECK_COL))
.tooltip(move |_w, cx| cx.new(|_| MoonTooltipView::new(tip.clone())).into())
.child(
MoonCheckbox::new(SharedString::from(format!("tt-en-{field}")))
.checked(enabled)
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
.on_change({
let view = cx.entity();
move |ch: &bool, _w, app| {
Expand Down
17 changes: 12 additions & 5 deletions crates/moon-ui-gpui/src/analytics/tuner/time/sliders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
//! cursor is not lost once it leaves the track.

use gpui::*;
use moon_ui::{MoonPalette, h_flex, v_flex};
use moon_ui::{MoonCheckbox, MoonPalette, MoonSize, h_flex, v_flex};
use rust_i18n::t;

use super::super::super::AnalyticsView;
use super::super::super::calendar::split_i18n;
use super::grid::{CHECK_COL, NAME_COL};
use super::grid::NAME_COL;
use super::state::{WEEK_MIN, fmt_min, fmt_week_ep, parse_moh, parse_time};
use crate::design;
use crate::design::{moon, moon_alpha};
Expand Down Expand Up @@ -437,11 +437,18 @@ impl AnalyticsView {
h_flex()
.w_full()
.items_end()
// Gap 4 (not 6) plus a CHECK_COL lead-in: together they reproduce the grid
// row's checkbox column, so the slider labels stay under the field names.
// Gap 4 (not 6) plus a checkbox-wide lead-in: together they reproduce the grid
// row's checkbox column, so the slider labels stay under the field names. The
// lead-in is an invisible `Sm` checkbox rather than a stated width, so it keeps MoonUI's
// own box size at any UI zoom; hidden, it takes layout but paints nothing.
.gap(design::ui_px(cx, 4.0))
.opacity(if dim { 0.5 } else { 1.0 })
.child(div().w(design::ui_px(cx, CHECK_COL)).flex_none())
.child(
div().flex_none().invisible().child(
MoonCheckbox::new(SharedString::from(format!("tt-slider-lead-{field}")))
.size(MoonSize::Sm),
),
)
.child(
// Matches the grid's field-name column so the slider labels line up under it.
div()
Expand Down
6 changes: 3 additions & 3 deletions crates/moon-ui-gpui/src/chart_tabs/apply_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use gpui::*;
use moon_core::config::ChartTabKind;
use moon_ui::{
MoonButton, MoonButtonSize, MoonButtonVariant, MoonCheckbox, MoonCheckboxSize, MoonPalette,
h_flex, v_flex,
MoonButton, MoonButtonSize, MoonButtonVariant, MoonCheckbox, MoonPalette, MoonSize, h_flex,
v_flex,
};
use rust_i18n::t;

Expand Down Expand Up @@ -120,7 +120,7 @@ pub(super) fn render_apply_row<T: ApplyRowHost>(
MoonCheckbox::new(SharedString::from(format!("{id_prefix}-apply-{index}")))
.label(label)
.checked(targets.has(kind))
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
.on_change(move |checked: &bool, _w, app| {
let checked = *checked;
toggle_entity.update(app, |this, cx| {
Expand Down
4 changes: 2 additions & 2 deletions crates/moon-ui-gpui/src/chart_tabs/candle_popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use moon_core::market::candles::{
CandleViewCfg,
};
use moon_ui::{
MoonCheckbox, MoonCheckboxSize, MoonPalette, MoonPopover, MoonPopoverPlacement, h_flex, v_flex,
MoonCheckbox, MoonPalette, MoonPopover, MoonPopoverPlacement, MoonSize, h_flex, v_flex,
};
use rust_i18n::t;

Expand Down Expand Up @@ -108,7 +108,7 @@ fn flag_cb<T: CandlePopupHost>(
MoonCheckbox::new(SharedString::from(format!("{id}-{suffix}")))
.label(t!(label_key).to_string())
.checked(checked)
.size(MoonCheckboxSize::Compact)
.size(MoonSize::Sm)
.on_change(move |ch: &bool, _w, app| {
let v = *ch;
write_cfg(&entity, app, |c| set(c, v));
Expand Down
Loading