implement controller traits
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
i do not exist 2026-08-11 17:41:51 +03:00
parent a4931d8e4f
commit def7a1b210
17 changed files with 2209 additions and 1790 deletions

View file

@ -12,7 +12,11 @@ impl App {
}
#[tek_proc::commands(BrowseCommand = "browse")]
impl Browse {
pub trait BrowseController:
for<'a> Namespace<'a, usize> +
for<'a> Namespace<'a, PathBuf> +
for<'a> Namespace<'a, Arc<str>>
{
/// Toggle visibility of browser
#[command(Show = "show")]
fn show (&mut self) -> Perhaps<BrowseCommand> {
@ -171,3 +175,14 @@ pub fn scan (dir: &PathBuf) -> Usually<(Vec<OsString>, Vec<OsString>)> {
files.sort();
Ok((subdirs, files))
}
pub fn view_browse_title (state: &App) -> impl Draw<Tui> {
field_v(ItemTheme::default(), match state.dialog.browser_target().unwrap() {
BrowseTarget::SaveProject => "Save project:",
BrowseTarget::LoadProject => "Load project:",
BrowseTarget::ImportSample(_) => "Import sample:",
BrowseTarget::ExportSample(_) => "Export sample:",
BrowseTarget::ImportClip(_) => "Import clip:",
BrowseTarget::ExportClip(_) => "Export clip:",
}, fg(g(96), x_repeat("🭻")).exact_h(1)).align_w().full_w()
}