forked from 1b-agent/opencadstudio-upstream
fix(blocks-palette): message placeholders, SVG arrows, tests follow the new palette
#1573's five formatted block messages carried {}/{name} in every locale, so the catalog never filled them and the UI printed the brace text; they use the __ocs_fmt_0__ marker now. The Options collapse arrow, the library up button and the folder picker are SVG icons instead of glyph text, and the Details header drops its sort glyph. The contrast test follows the cards to the weak surface pair and the palette test closes with BLOCKSPALETTECLOSE, since BLOCKSPALETTE now only opens. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7a6908c7ca
commit
369dc93029
23 files changed
+128
-111
No files matched your search
@@ -1770,7 +1770,10 @@ mod tests {
|
||||
app.dock_expanded == Some(crate::ui::dock::PanelId::BlockPalette),
|
||||
"palette must open expanded, not as the collapsed bar"
|
||||
);
|
||||
// BLOCKSPALETTE only opens; BLOCKSPALETTECLOSE closes.
|
||||
let _ = app.run_command_line("BLOCKSPALETTE");
|
||||
assert!(app.show_block_palette);
|
||||
let _ = app.run_command_line("BLOCKSPALETTECLOSE");
|
||||
assert!(!app.show_block_palette);
|
||||
}
|
||||
|
||||
|
||||
@@ -480,14 +480,16 @@ fn test_block_palette_contrast() {
|
||||
// a hardcoded foreground, these equality checks fail on every theme
|
||||
// whose surface text is not pure white.
|
||||
let (normal_bg, normal_fg) = block_card_colors(theme, false, BtnStatus::Active);
|
||||
// Cards sit on the dock's base surface, so they take the weak pair
|
||||
// to read as cards.
|
||||
assert_eq!(
|
||||
normal_bg, p.background.base.color,
|
||||
"Theme {:?} block card normal background drifted from base pair",
|
||||
normal_bg, p.background.weak.color,
|
||||
"Theme {:?} block card normal background drifted from weak pair",
|
||||
theme
|
||||
);
|
||||
assert_eq!(
|
||||
normal_fg, p.background.base.text,
|
||||
"Theme {:?} block card normal label must use base text (was hardcoded WHITE)",
|
||||
normal_fg, p.background.weak.text,
|
||||
"Theme {:?} block card normal label must use weak text (was hardcoded WHITE)",
|
||||
theme
|
||||
);
|
||||
|
||||
@@ -505,11 +507,11 @@ fn test_block_palette_contrast() {
|
||||
theme
|
||||
);
|
||||
|
||||
// Default-branch statuses (Active/Disabled/Focused/...) share the base pair.
|
||||
// Default-branch statuses (Active/Disabled/Focused/...) share the weak pair.
|
||||
let (_, disabled_fg) = block_card_colors(theme, false, BtnStatus::Disabled);
|
||||
assert_eq!(
|
||||
disabled_fg, p.background.base.text,
|
||||
"Theme {:?} block card default-state label must use base text",
|
||||
disabled_fg, p.background.weak.text,
|
||||
"Theme {:?} block card default-state label must use weak text",
|
||||
theme
|
||||
);
|
||||
|
||||
|
||||
@@ -587,7 +587,11 @@ fn options_card<'a>(palette: &'a BlockPalette) -> Element<'a, Message> {
|
||||
row![
|
||||
text(crate::t!("Options").to_uppercase()).size(10).style(accent_text),
|
||||
Space::new().width(Fill),
|
||||
text(if palette.options_collapsed { "▸" } else { "▾" }).size(22),
|
||||
if palette.options_collapsed {
|
||||
crate::ui::icons::themed_arrow_right(12.0)
|
||||
} else {
|
||||
crate::ui::icons::themed_arrow_down(12.0)
|
||||
},
|
||||
]
|
||||
.align_y(iced::Center),
|
||||
)
|
||||
@@ -705,7 +709,10 @@ pub fn view(palette: &BlockPalette, width: f32, auto_collapse: bool) -> Element<
|
||||
.text_size(11)
|
||||
.padding([3, 6])
|
||||
.width(Fill),
|
||||
button(text("…").size(12)).on_press(pm(BlockPaletteMsg::LibraryBrowse)).style(button_style(false)).padding([3, 8]),
|
||||
button(crate::ui::icons::themed(crate::ui::icons::FOLDER_OPEN, 14.0))
|
||||
.on_press(pm(BlockPaletteMsg::LibraryBrowse))
|
||||
.style(button_style(false))
|
||||
.padding([3, 8]),
|
||||
]
|
||||
.spacing(4)
|
||||
.align_y(iced::Center);
|
||||
@@ -713,7 +720,12 @@ pub fn view(palette: &BlockPalette, width: f32, auto_collapse: bool) -> Element<
|
||||
palette.libraries.first().is_some_and(|root| d != &PathBuf::from(root))
|
||||
});
|
||||
if in_sub {
|
||||
lib_row = lib_row.push(button(text("↑").size(12)).on_press(pm(BlockPaletteMsg::LibraryUp)).style(button_style(false)).padding([3, 8]));
|
||||
lib_row = lib_row.push(
|
||||
button(crate::ui::icons::themed_arrow_up(12.0))
|
||||
.on_press(pm(BlockPaletteMsg::LibraryUp))
|
||||
.style(button_style(false))
|
||||
.padding([3, 8]),
|
||||
);
|
||||
}
|
||||
top = top.push(lib_row);
|
||||
if let (Some(root), Some(dir)) = (palette.libraries.first(), palette.library_dir.as_ref()) {
|
||||
@@ -767,7 +779,7 @@ pub fn view(palette: &BlockPalette, width: f32, auto_collapse: bool) -> Element<
|
||||
col = col.push(
|
||||
row![
|
||||
text(crate::t!("Icon")).size(11).style(muted_style).width(Length::Fixed(40.0)),
|
||||
text(format!("{} ▲", crate::t!("Name"))).size(11).style(muted_style).width(Fill),
|
||||
text(crate::t!("Name")).size(11).style(muted_style).width(Fill),
|
||||
text(crate::t!("Annotative / Dynamic")).size(11).style(muted_style).width(Length::Fixed(140.0)),
|
||||
]
|
||||
.spacing(4),
|
||||
|
||||
Reference in new issue
Block a user