| 1 | //! Pure fixture facts for workspace composition and the summoned workbar. |
| 2 | use super::Entry; |
| 3 | use crate::{ContextItem, ContextRibbon, Paint, PaneHeader, Role, Theme, WorkspaceFrame}; |
| 4 | use ratatui::{buffer::Buffer, layout::Rect}; |
| 5 | |
| 6 | pub(crate) fn context() -> ContextRibbon<'static> { |
| 7 | ContextRibbon::new(vec![ |
| 8 | ContextItem::new("", "codewhale-ratatui").priority(3), |
| 9 | ContextItem::new("", "workspace-polish").priority(2), |
| 10 | ContextItem::new("", "Local / selected model") |
| 11 | .priority(0) |
| 12 | .role(Role::Primary), |
| 13 | ContextItem::new("", "3 attachments").priority(1), |
| 14 | ]) |
| 15 | } |
| 16 | fn frame(area: Rect, buf: &mut Buffer, theme: &Theme) { |
| 17 | let frame = WorkspaceFrame::new("codewhale-ratatui") |
| 18 | .branch("workspace-polish") |
| 19 | .footer("Illustrative workspace / host owns sessions and actions"); |
| 20 | frame.paint(area, buf, theme); |
| 21 | let areas = frame.areas(area); |
| 22 | PaneHeader::new("Conversation") |
| 23 | .meta("Today") |
| 24 | .paint(areas.main, buf, theme); |
| 25 | if let Some(side) = areas.side { |
| 26 | PaneHeader::new("Files & review") |
| 27 | .meta("4 changed") |
| 28 | .paint(side, buf, theme); |
| 29 | } |
| 30 | } |
| 31 | fn pane(area: Rect, buf: &mut Buffer, theme: &Theme) { |
| 32 | PaneHeader::new("Files & review") |
| 33 | .meta("4 changed") |
| 34 | .focused(true) |
| 35 | .paint(area, buf, theme); |
| 36 | } |
| 37 | fn ribbon(area: Rect, buf: &mut Buffer, theme: &Theme) { |
| 38 | context().paint(area, buf, theme); |
| 39 | } |
| 40 | fn ribbon_narrow(area: Rect, buf: &mut Buffer, theme: &Theme) { |
| 41 | context().paint(area, buf, theme); |
| 42 | } |
| 43 | pub(crate) fn entries() -> Vec<Entry> { |
| 44 | vec![ |
| 45 | Entry { |
| 46 | name: "workbench-frame", |
| 47 | width: 112, |
| 48 | height: 12, |
| 49 | draw: frame, |
| 50 | }, |
| 51 | Entry { |
| 52 | name: "pane-header", |
| 53 | width: 48, |
| 54 | height: 3, |
| 55 | draw: pane, |
| 56 | }, |
| 57 | Entry { |
| 58 | name: "context-ribbon", |
| 59 | width: 100, |
| 60 | height: 2, |
| 61 | draw: ribbon, |
| 62 | }, |
| 63 | Entry { |
| 64 | name: "context-ribbon-narrow", |
| 65 | width: 40, |
| 66 | height: 2, |
| 67 | draw: ribbon_narrow, |
| 68 | }, |
| 69 | ] |
| 70 | } |
| 71 |