refactor(ui): finish dialog form helper adoption

This commit is contained in:
Karim Jerbi committed 2026-10-18 12:56:33 +01:00
1 parent c80a1d1703
commit b97e67b533
8 files changed
+110 -149

No files matched your search

+2 -36
View File
@@ -9,6 +9,7 @@
use crate::app::Message;
use crate::t;
use crate::ui::style::common::muted_style;
use crate::ui::style::editor_table::{danger_input_style, danger_text_style, EDITOR_TABLE_GUTTER};
use iced::widget::{button, column, container, row, scrollable, text, text_input, Space};
use iced::{Background, Element, Length, Theme};
@@ -19,41 +20,6 @@ pub enum AliasField {
Command,
}
/// Right-hand lane reserved for the scrollbar so it never overlaps the ✕ column.
const GUTTER: f32 = 16.0;
fn danger_text_style(theme: &Theme) -> iced::widget::text::Style {
iced::widget::text::Style {
color: Some(theme.palette().danger.base.color),
}
}
/// Text-input variant flagging an invalid value: danger border and value
/// color on the theme's danger weak background.
fn danger_input_style(
theme: &Theme,
status: iced::widget::text_input::Status,
) -> iced::widget::text_input::Style {
let danger = theme.palette().danger.base;
iced::widget::text_input::Style {
background: Background::Color(theme.palette().danger.weak.color),
border: iced::border::rounded(4).color(danger.color).width(
if matches!(
status,
iced::widget::text_input::Status::Focused { is_hovered: _ }
) {
1.5
} else {
1.0
},
),
icon: danger.color,
placeholder: danger.color.scale_alpha(0.7),
value: danger.text,
selection: danger.color,
}
}
/// Build the alias editor content. `rows` is the live working buffer.
pub fn view_window<'a>(
rows: &'a [(String, String)],
@@ -78,7 +44,7 @@ pub fn view_window<'a>(
// scrollable rows so the columns stay aligned.
let gutter = iced::Padding {
top: 0.0,
right: GUTTER,
right: EDITOR_TABLE_GUTTER,
bottom: 0.0,
left: 0.0,
};