1use crate::ui::theme::{self, pal}; 2use crate::ui::widgets::{lbl, mono}; 3use crate::workflow::model::Workflow; 4use crate::workflow::review::relations; 5use rune::{El, col, row, text}; 6 7pub fn view(wf: &Workflow, i: usize, right: El) -> El { 8 let p = pal(); 9 let t = &wf.tasks[i]; 10 let (after, with, _) = relations(wf, t); 11 let mut meta = format!("step {}", t.step); 12 if !with.is_empty() { 13 meta += &format!(" · ∥ {}", with.join(" ")); 14 } 15 if !after.is_empty() { 16 meta += &format!(" · after {}", after.join(" ")); 17 } 18 let head = row() 19 .gap(12.0) 20 .center_y() 21 .child(text(t.id.clone()).font(theme::DISPLAY).color(p.accent)) 22 .child( 23 col() 24 .child( 25 text(t.title.clone()) 26 .font(theme::TITLE) 27 .color(p.strong) 28 .selectable(true), 29 ) 30 .child(mono(meta, p.muted)), 31 ); 32 col() 33 .gap(12.0) 34 .child(row().justify_between().center_y().child(head).child(right)) 35 .child( 36 row() 37 .gap(24.0) 38 .items_start() 39 .child(section("Decisions", &t.decisions, "◆", p.muted)) 40 .child(section("Acceptance", &t.acceptance, "☐", p.muted)) 41 .child(section("Evidence", &t.evidence, "⎘", p.muted)), 42 ) 43} 44 45fn section(title: &str, items: &[String], glyph: &str, color: rune::Color) -> El { 46 let p = pal(); 47 col() 48 .grow(1.0) 49 .min_w(0.0) 50 .gap(2.0) 51 .selection_group(true) 52 .child(lbl(&format!("{title} · {}", items.len())).mb(4.0)) 53 .children(items.iter().map(|x| { 54 row().gap(6.0).child(mono(glyph, color)).child( 55 text(x.clone()) 56 .font(theme::BODY) 57 .color(p.fg) 58 .wrap() 59 .selectable(true) 60 .grow(1.0) 61 .min_w(0.0), 62 ) 63 })) 64}