focus: allow entering phrase list

This commit is contained in:
🪞👃🪞 2024-11-09 14:39:12 +01:00
parent ac8e8b2bf0
commit 89cb8d7bbe
3 changed files with 15 additions and 7 deletions

View file

@ -89,9 +89,13 @@ impl Content for PhrasePool<Tui> {
let border = Lozenge(Style::default().bg(Color::Rgb(40, 50, 30)).fg(border_color));
let content = content.fill_xy().bg(Color::Rgb(28, 35, 25)).border(border);
let title_color = if *focused {Color::Rgb(150, 160, 90)} else {Color::Rgb(120, 130, 100)};
let title = format!("[{}] Phrases ({})", phrases.len(), " ");
let title = TuiStyle::fg(title, title_color).push_x(1);
Layers::new(move|add|{ add(&content)?; Ok(add(&title)?) })
let upper_left = format!("[{}] Phrases", if self.entered {""} else {" "});
let upper_right = format!("({})", phrases.len());
lay!(
content,
TuiStyle::fg(upper_left.to_string(), title_color).push_x(1).align_nw().fill_xy(),
TuiStyle::fg(upper_right.to_string(), title_color).pull_x(1).align_ne().fill_xy(),
)
}
}
impl Handle<Tui> for PhrasePool<Tui> {