From dee569d6a588ca23c038d63163375ee0e6bbb752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 27 Aug 2026 14:14:33 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20remove(app):=20floating=20notice?= =?UTF-8?q?=20plate=20=E2=80=94=20the=20ledger=20strip=20is=20the=20one=20?= =?UTF-8?q?notice=20channel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The plate doubled what the ledger's last-action line already says (user 2026-08-27). Gone with it: its severity/offset helpers, the keystroke and click dismiss paths, and its two layout guards; the picture-occlusion guard now pins the ledger as the sole channel. A refusal or failure keeps its tone in the strip (notice_tone tints the last-action line for error and warning; routine messages stay quiet). --- crates/app/src/notices.rs | 15 ++-- crates/app/src/player/actions.rs | 7 -- crates/app/src/tests/layout.rs | 73 ++------------- crates/app/src/ui/stance.rs | 147 +++---------------------------- 4 files changed, 29 insertions(+), 213 deletions(-) diff --git a/crates/app/src/notices.rs b/crates/app/src/notices.rs index ab0ddc7..7d1aa8d 100644 --- a/crates/app/src/notices.rs +++ b/crates/app/src/notices.rs @@ -55,14 +55,13 @@ pub(crate) fn audio_notice(session: &PlaybackSession) -> Option { mod tests { use super::*; - /// The class this guards: a notice queued behind an earlier, undismissed - /// one is never *lost* -- `push_notice` still appends it to the back -- - /// but a reader of `front()` alone (what `stance::notice_plate` read - /// before this fix) would never see it, because nothing but a keystroke - /// ever calls `dismiss_notice`, and most of what fills this queue (a - /// click on a gap, a menu row, a drag) is not one. `back()` is the read - /// that survives that: it always names the newest message, which is why - /// the plate and the ledger's "last action" both read it now. + /// The class this guards: a notice queued behind an earlier one is never + /// *lost* -- `push_notice` still appends it to the back -- but a reader + /// of `front()` alone would never see it, since nothing dismisses the + /// queue any more (the floating plate and its keystroke-dismiss went + /// with it, user 2026-08-27). `back()` is the read that survives that: + /// it always names the newest message, which is why the ledger's "last + /// action" -- the one notice channel left -- reads it. /// /// This is a value-level check on the queue only -- this binary has no /// `TestAppContext`, so it cannot measure what actually painted, and this diff --git a/crates/app/src/player/actions.rs b/crates/app/src/player/actions.rs index ccdca0a..53851c5 100644 --- a/crates/app/src/player/actions.rs +++ b/crates/app/src/player/actions.rs @@ -243,13 +243,6 @@ impl Player { push_notice(&mut self.notices, message); } - /// Answers the message on the bar and brings up the next one. Whether there - /// was one to answer, because a key that dismissed a notice owes a repaint - /// and a key that dismissed nothing does not. - pub(crate) fn dismiss_notice(&mut self) -> bool { - self.notices.pop_front().is_some() - } - /// The magnet off and on again, in words: a snap that stops working /// silently reads as a bug, and one that starts working silently reads as /// one too. The line goes with it -- nothing is being promised any more. diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index d087180..b4b49b3 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -1914,61 +1914,6 @@ fn a_lane_row_fits_what_its_own_head_draws() { ); } -/// The notice plate's own anchor ([`crate::ui::stance::notice_bottom_offset`]) -/// sits a fixed step above the ledger, not floated by `bench_h` -- a float -/// used to put the plate up beside the time band's transport timecode row -/// for a tall bench, reading as if it belonged to that row instead of the -/// ledger it answers (user report). `Player`'s live tree has no -/// `TestAppContext` in this binary to mount a real `notice_plate` in and -/// read its painted bounds back, so this checks the pure geometry the -/// anchor is built from, and the source-level anchor that now keeps the -/// plate off the bench's left-aligned V1/A1 lane chips horizontally instead -/// (right-aligned, DESIGN §11.6) rather than by floating with `bench_h`. -#[test] -fn the_notice_plate_sits_a_fixed_step_above_the_ledger_right_aligned() { - use crate::ui::stance::{LEDGER_H, notice_bottom_offset}; - - assert_eq!( - notice_bottom_offset(), - LEDGER_H + 6., - "the notice plate's bottom offset drifted off the ledger -- it must \ - stay a fixed step above it, not float with bench_h again" - ); - - let body = fn_body("notice_plate"); - assert!( - body.contains(".right(px(12.))") && !body.contains(".left(px(12.))"), - "notice_plate must anchor right, clear of the bench's left-aligned \ - V1/A1 lane chips (DESIGN §11.6)" - ); -} -/// The renderer only wraps text when the text measurement receives a definite -/// width and normal whitespace. This source-level guard keeps both declarations -/// on the notice plate: `max_w` alone limits max-content after that measurement -/// and silently permits one-line overflow. It cannot inspect GPUI's painted -/// lines; only live driving can confirm the full notice actually wrapped. -#[test] -fn the_notice_plate_declares_a_bounded_wrapping_text_layout() { - let stance = src_text("ui/stance.rs"); - let notice_start = stance - .find("fn notice_plate(") - .expect("notice plate moved or renamed"); - let notice_end = stance[notice_start..] - .find("\n/// Thin strip") - .map(|end| notice_start + end) - .expect("notice plate no longer precedes the ledger"); - let plate = &stance[notice_start..notice_end]; - - assert!( - plate.contains(".w_full()") && plate.contains(".max_w(px(480.))"), - "notice plate lacks a definite width bounded to 480 px; max_w alone does not wrap text" - ); - assert!( - plate.contains(".whitespace_normal()"), - "notice plate no longer explicitly requests GPUI's wrapping whitespace mode" - ); -} - /// A round trip through the file: what is saved is what the next load reads /// back, all five seams touched -- a scratch path, not the real config, the /// same isolation `keymap::tests`' own `load_from`/`save_to` already takes. @@ -2195,18 +2140,16 @@ fn the_picture_letterboxes_through_a_canvas_never_a_plain_img_object_fit() { /// [`Player::picture_area`](crate::Player::picture_area) directly, so a /// notice surface that reaches into that method unconditionally reaches the /// picture on the darkroom path too -- measured live covering the bottom 10% -/// of the frame (rows 300-333 of 335) *underneath* the stance's own -/// §8-conformant plate (`ui::stance::notice_plate`), which drew the same -/// notice a second time above the ledger. The legacy full-width `notice_bar` -/// and its non-darkroom caller are gone with the rest of the old tree now, -/// so this pins the sole remaining channel (`notice_plate`) off the -/// picture for good. +/// of the frame (rows 300-333 of 335). The legacy full-width `notice_bar` +/// and its non-darkroom caller are gone with the rest of the old tree, and +/// the floating notice plate went after them (user 2026-08-27: the ledger's +/// own "last action" strip is the one notice channel now), so this pins +/// `picture_area` itself never growing a notice surface back. #[test] fn the_darkroom_path_never_lets_a_notice_surface_reach_the_picture() { - // `notice_bar` and its legacy (non-darkroom) caller are gone with the - // rest of the old tree -- the darkroom's own `ui::stance::notice_plate` - // is the only notice channel left, and the stronger invariant now is - // that picture_area's body never draws a second one over the picture. + // The ledger strip (`ui::stance::ledger` reading `notices.back()`) is + // the only notice channel left, and the invariant is that + // picture_area's body never draws one over the picture. let body = fn_body("picture_area"); assert!( !body.contains("notice_bar"), diff --git a/crates/app/src/ui/stance.rs b/crates/app/src/ui/stance.rs index 88430f7..a197dac 100644 --- a/crates/app/src/ui/stance.rs +++ b/crates/app/src/ui/stance.rs @@ -453,8 +453,8 @@ fn keys_overlay(player: &Player, bench_h: f32, cx: &mut Context) -> impl .bottom_0() .left_0() .right_0() - // The live `bench_h` the caller already measures for `bench`/ - // `notice_plate`, not the fixed `BENCH_H` default: a hand-dragged + // The live `bench_h` the caller already measures for `bench`, + // not the fixed `BENCH_H` default: a hand-dragged // bench taller than the default left this scrim short of the real // footprint, so the overlay stopped mid-bench instead of covering it. .h(px(bench_h + LEDGER_H)) @@ -724,126 +724,6 @@ fn bench( .child(bench_stance::render(player, bench_h - BENCH_CHROME_H, cx)) } -/// Which of the three §8 severities a notice's own words carry. Reuses -/// [`notice_tone`] (the legacy bar's own classification, by word) rather than -/// a second heuristic, and folds its four-way answer onto the darkroom's -/// three tokens: `STATUS_ERROR`/`STATUS_WARNING` are the same constants as -/// `NOTICE_DECIDE`/`NOTICE_LOOK` already (`ui/theme.rs`'s `darkroom` module -/// aliases them both ways), so the two failure/refusal tones fold straight -/// across and everything else -- success included -- reads as *told you*. -fn notice_severity(message: &str) -> u32 { - let tone = notice_tone(message); - if tone == STATUS_ERROR() { - NOTICE_DECIDE() - } else if tone == STATUS_WARNING() { - NOTICE_LOOK() - } else { - NOTICE_TELL() - } -} - -/// [`notice_plate`]'s own `bottom` offset, pulled out as a pure function so -/// a `TestAppContext`-less test binary (this crate's own, no live `Context` -/// to mount a real `notice_plate` in) can still check the anchor without -/// duplicating the arithmetic by hand and risking the two drifting apart. -/// -/// Anchored a fixed `LEDGER_H + 6.` above the ledger, not floated by -/// `bench_h` (F3, user report): floating it `bench_h` further up put the -/// plate up beside the time band's transport timecode row for any tall -/// bench, reading as if it belonged to that row instead of the ledger it -/// answers. The old float existed only to dodge the bench's V1/A1 lane -/// chips (F2) -- [`notice_plate`] now dodges those horizontally instead -/// (right-aligned, DESIGN §11.6: the lane chips there are left-aligned), -/// so the vertical float is no longer needed to keep the plate clear. -pub(crate) fn notice_bottom_offset() -> f32 { - LEDGER_H + 6. -} - -/// A notice plate (DESIGN §8): one at a time, rising above the *bench*, its -/// severity a 3px left spine rather than a colour flood. Fed by the same -/// [`Player::notify_user`]/`notices` queue the legacy bar reads -/// ([`Player::notice_bar`]) -- no second notice channel. -/// -/// Reads the *back* of the queue, not the front: dismissal only ever fires -/// on a keystroke ([`render`]'s `on_key_down` calling `dismiss_notice()`), -/// and most of what fills this queue -- a click on a gap, a menu row, a -/// drag -- is not one. A `front()` plate left showing a `ctrl+s` "SAVED" -/// notice sat frozen through an unrelated mouse-driven refusal that queued -/// in behind it: the ledger strip's own "last action" already reads -/// `back()` for exactly this reason, and the plate disagreeing with it is -/// what made the refusal look like it never reached the notice surface at -/// all. `back()` keeps the two in step and guarantees the newest, most -/// actionable message is always the one on screen. -/// -/// Anchored a fixed [`notice_bottom_offset`] above the ledger, bottom-right -/// (DESIGN §5's timecode/transport row lives bottom-left of the time band, -/// well above this): a `bench_h`-floated offset used to put the plate right -/// beside that transport row for a tall bench, reading as if it belonged to -/// the wrong strip (user report). Right-aligned rather than left keeps it -/// off the bench's own V1/A1 lane chips, which are left-aligned there -/// (DESIGN §11.6 occlusion check) -- horizontal separation now does the job -/// the old vertical float existed for. -/// -/// corner-cut: amber's "carries a jump action" is not wired -- the queue -/// only ever held plain text, no structured jump target, in either the -/// legacy bar or here. Ceiling: give `notify_user` an optional jump payload -/// once a call site actually has one to carry. -fn notice_plate(message: SharedString, cx: &mut Context) -> impl IntoElement { - div() - .id("stance-notice") - .absolute() - .bottom(px(notice_bottom_offset())) - .right(px(12.)) - .cursor_pointer() - // A click answers the notice the same way any other key does - // (`stance-room`'s `on_key_down` -> `Player::dismiss_notice`): - // the darkroom's own click-to-dismiss for a plate with no other - // affordance on it (DESIGN §8). - .on_mouse_down( - MouseButton::Left, - cx.listener(|this, _: &MouseDownEvent, _, cx| { - if this.dismiss_notice() { - cx.notify(); - } - }), - ) - // `max_w` only caps a box after GPUI has measured its text at - // max-content width. `w_full` supplies a definite width to that - // measurement (then `max_w` bounds it at 480 px), and normal - // whitespace gives the text system permission to shape every word - // into the resulting lines. Keep this a block: as a flex child the - // text's automatic min-content width can overflow its own plate. - // - // No fixed height: GPUI's shaped lines contribute their actual - // default `phi()` line boxes, so two or three lines grow upward from - // this bottom anchor without reaching down over the bench lanes. - .w_full() - .max_w(px(480.)) - .whitespace_normal() - .px(px(10.)) - .py(px(6.)) - .rounded(px(2.)) - .bg(rgb(DARK_PANEL())) - // The severity spine (DESIGN §8): a 3px left border, coloured, same - // shape as the legacy notice bar's own tone stripe (`notice_bar`). - .border_l(px(3.)) - .border_color(rgb(notice_severity(&message))) - .type_style(type_scale::label( - type_scale::LABEL_ROW_PX, - gpui::FontWeight::MEDIUM, - )) - .text_color(rgb(INK1())) - // `div()` is a flex row by default, and a bare text child measures - // its min-content as the *whole line* (`TextLayout::layout` only - // wraps against a `Definite` available width, which a flex item's - // content-sizing pass never supplies). `w_full`/`max_w` on the - // plate itself only bounds the *container* -- the text still never - // sees a definite width to wrap against unless it is a `flex_1` - // child, which is handed the container's resolved width. Same fix - // as `overlays.rs`'s notice bar (`div().flex_1().min_w(...)`). - .child(div().flex_1().child(message)) -} - /// Thin strip at the bottom of the centre column: project identity, last /// action, export progress, position. Notices rise from here (DESIGN §5, §8). fn ledger(player: &Player, position: f64) -> impl IntoElement { @@ -860,6 +740,17 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement { } ); let last_action = player.notices.back().cloned().unwrap_or_else(|| "—".into()); + // With the floating plate gone (user 2026-08-27, "we also have notifier + // at the ledger section"), this strip is the one notice surface left -- + // a refusal or a failure keeps the tone the plate's severity spine + // carried ([`notice_tone`], the same word-read the legacy bar used), + // while everything routine stays at the strip's own quiet ink. + let tone = notice_tone(&last_action); + let action_ink = if tone == STATUS_ERROR() || tone == STATUS_WARNING() { + tone + } else { + INK3() + }; let export = player .exporting() .map(|h| format!("EXPORTING {:.0}%", h.progress() * 100.)); @@ -897,7 +788,7 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement { type_scale::CHORD_METADATA_MIN_PX, gpui::FontWeight::MEDIUM, )) - .text_color(rgb(INK3())) + .text_color(rgb(action_ink)) .child(last_action), ) .children(export.map(|e| { @@ -1012,9 +903,6 @@ pub(crate) fn render( Player::discard_sidecar(&sidecar); } } - if this.dismiss_notice() { - cx.notify(); - } // DESIGN §9: "`?` held ... surfaces chords ... release restores. // No modal cheat-sheet." Opened here, ahead of the modal guard // below (which would otherwise swallow a second `?` down once @@ -1245,13 +1133,6 @@ pub(crate) fn render( .children(player.silence_card(window_size, cx)) .children(player.mix_card(window_size, cx)) .children(player.subtitle_style_card(window_size, cx)) - }) - // Mounted after `card_maximized` (not beside `ledger` above - // any more): a maximized Mix/EQ card painted over a notice - // sitting below it in this same child list, and a notice is - // transient -- it should win over a card, not lose to one. - .when_some(player.notices.back().cloned(), |el, n| { - el.child(notice_plate(n, cx)) }), ) .child(divider(Split::Dock, cx))