Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/ALWAYS-ON.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ Setup's sub-step shows each row as Signed in / Sign in there / Not on that machi
A setting, off by default (Settings, Appearance, "Group projects", `sidebar.groups`): off, the rest stays in Active, newest first, and
only a group the person made (Move to group, New group…) is a section.
6. **Quiet:** nothing for 2 weeks; auto-collapsed, never deleted, searchable.
- **D12, revised Nov 23 (the crew band, the inbox, the bench):** with forty projects the bots and rooms were a screen below the list, and
"Active" held nearly every project. Now, top to bottom:
1. **The crew band**, above the list and never scrolled with it: Bub, the bots as one strip of cats (name and note under the pointer, a red
mark on one that waits), the rooms as `#name`, each with its `+`.
2. **Needs you**, then **Running** (every project's running threads in one list, not repeated under their projects), then **Snoozed**
(folded; `ThreadSnoozed`, the row's clock offers 1 hour, Tomorrow, 1 week; an open ask is never snoozed away). A row is two lines: its
title, then its status as a word (`label`, `tone`: Approve, Input, Sign in, Failed, Stopped, Working, Waiting, Done), its project and its
age. No status dots: a word reads at a glance. A stop settles in one press (`settle`).
3. **Pinned** projects, then **Recent**: the eight projects the person was in last (`sidebar.visit.<project id>`, written when a thread or the
project's page is opened, at most once in ten minutes; never visited: by last activity), so a board reopened daily stays at hand with no
agent activity and a merged software project sinks by itself. A hardware project (KiCad files) carries a board glyph (`hasBoard`).
4. **All projects** (the rest, by name, one folded line), then **Quiet**.
- **A project's page:** running, then needs you, then recent, with done threads behind "Done (n)".
- **Ctrl+K** jumps to any project or thread on any machine (registry-backed).
- Same on GPUI, iOS and Android: the hub presents it (present/screen.rs sections), the clients draw sections generically.
Expand Down
11 changes: 9 additions & 2 deletions native/gpui/src/screens/sections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,15 @@ fn project(this: &Backplane, cx: &mut Context<Backplane>, light: bool, p: &Value
.child(twisty)
.child(crate::screens::badge::mark(light, p))
.child(div().flex_1().min_w_0().overflow_hidden().whitespace_nowrap().text_ellipsis().child(string(p, "title")))
// a hardware project (a board or schematic in it): a faint board glyph, so the bench reads hardware and software apart at a glance
.children((p["hasBoard"] == true).then(|| crate::art::icon("circuit-board", 12., c("faint"))))
.children((!dots.is_empty()).then(|| div().flex().gap_1().items_center().children(dots)))
// its threads with no row here (finished ones): a faint count, so none seems lost; they are on its page
.children((rest > 0).then(|| crate::ui::with_rect(div().id(SharedString::from(format!("prest-{pid}"))), { let p = pid.clone(); move || format!("project-rest:{p}") }).text_size(crate::scale::tpx(11.)).text_color(c("faint"))
.tooltip(crate::keys::tip_raw(&tf("gpui.sections.rest", &[("n", rest.into())]), "", light)).child(rest.to_string())))
.children((running > 0).then(|| div().text_size(crate::scale::tpx(11.)).text_color(c("accent")).child(tf("gpui.sections.running", &[("n", running.into())]))))
// what of it runs (its rows are in Running): a count in the running colour, outlined as the Working label is
.children((running > 0).then(|| div().id(SharedString::from(format!("prun-{pid}"))).px(px(4.)).h(px(16.)).flex().items_center().border_1().border_color(c("accent")).text_size(crate::scale::tpx(10.)).text_color(c("accent"))
.tooltip(crate::keys::tip_raw(&tf("gpui.sections.running", &[("n", running.into())]), "", light)).child(running.to_string())))
// what of it waits on the person (its rows are in Needs you, folded or not)
.children((needs_n > 0).then(|| div().px(px(5.)).h(px(16.)).flex().items_center().bg(c("bad")).text_size(crate::scale::tpx(10.)).text_color(c("bg")).child(needs_n.to_string())))
.when(pinned, |d| d.child(crate::ui::ic(light, "pin", 12., "dim")))
Expand Down Expand Up @@ -144,7 +148,10 @@ impl Backplane {
// no project name after the title: the sidebar is narrow and the title is what the person reads (sub " ": an Active-view row, so no tree chevron and no drag)
// a stop says so by its dot alone (the right column is the title's); an ask keeps its red word (approval, question)
let mut t = t.clone(); if matches!(t["want"].as_str(), Some("failed" | "stopped")) { t["want"] = serde_json::json!(""); }
rows.push(self.side_thread(cx, light, &t, "", " ", t["off"] == true, ctl));
// Running lists every project's work in one place, so each row names its project (faint, after the title)
let sub = string(&t, "project");
if t["settle"].as_str().map_or(false, |v| !v.is_empty()) { let v = string(&t, "settle"); ctl.push(CtlEntry { id: format!("settle:{}", v.rsplit('|').next().unwrap_or("")), label: "Settle".into() /* i18n-ok: a ctl label */, ctl: Ctl::Node("row-settle".into(), v) }); }
rows.push(self.side_thread(cx, light, &t, "", if sub.is_empty() { " " } else { &sub }, t["off"] == true, ctl));
}
}
_ => {
Expand Down
51 changes: 51 additions & 0 deletions native/gpui/src/screens/siderow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,57 @@ pub fn pin_button_as(cx: &mut Context<Backplane>, light: bool, t: &Value, group:
.into_any_element()
}

/// A row's status label (the hub's `label` and `tone`): a short word in its tone's colour, filled when it asks the person (Approve, Input,
/// Sign in), outlined otherwise. Read at a glance where a 6 px dot was not. `None` for a row with nothing to say.
pub struct Pill { text: String, token: &'static str, filled: bool, light: bool }
pub fn pill(light: bool, t: &Value) -> Option<Pill> {
let text = string(t, "label"); if text.is_empty() { return None }
let token = pill_token(t["tone"].as_str().unwrap_or(""));
Some(Pill { filled: t["word"] == "needs", text, token, light })
}
/// The colour token of a label's tone.
pub fn pill_token(tone: &str) -> &'static str { match tone { "bad" => "bad", "run" => "accent", "wait" => "waiting", "ok" => "ok", _ => "dim" } }
pub trait PillEl { fn clone_el(&self) -> Option<AnyElement>; }
impl PillEl for Option<Pill> {
fn clone_el(&self) -> Option<AnyElement> {
let p = self.as_ref()?; let col = theme::color(p.light, p.token);
Some(div().flex_shrink_0().h(px(15.)).px(px(4.)).flex().items_center().text_size(crate::scale::tpx(10.)).line_height(px(13.)).border_1().border_color(col)
.when(p.filled, |d| d.bg(col).text_color(theme::color(p.light, "bg"))).when(!p.filled, |d| d.text_color(col))
.child(crate::i18n::trs(&p.text)).into_any_element())
}
}
/// Snooze, under the pointer: a clock that opens the hub's spans (`snooze`: 1 hour, Tomorrow, 1 week); on a snoozed row (`wake`) it wakes it in
/// one press. None for a row that can do neither.
pub fn snooze_button(cx: &mut Context<Backplane>, light: bool, t: &Value, group: SharedString) -> Option<AnyElement> {
let (wake, opts) = (string(t, "wake"), t["snooze"].as_array().cloned().unwrap_or_default());
if wake.is_empty() && opts.is_empty() { return None }
let c = |n: &str| theme::color(light, n);
let id = string(t, "id"); let raw = id.rsplit('|').next().unwrap_or("").to_string();
/* i18n-ok: the menu's words, drawn through trs */ let tip = crate::i18n::trs(if wake.is_empty() { "Snooze" } else { "Wake" });
Some(crate::ui::with_rect(div().id(SharedString::from(format!("snooze-{id}"))), move || format!("snooze:{raw}")).flex_shrink_0().w(px(16.)).h(px(16.)).flex().items_center().justify_center().cursor_pointer()
.invisible().group_hover(group, |s| s.visible()).hover(|s| s.bg(c("line")))
.tooltip(crate::keys::tip(&tip, "", light))
.child(crate::art::icon(if wake.is_empty() { "clock" } else { "bell" }, 12., c("dim")))
.on_click(cx.listener(move |this, e: &ClickEvent, _, cx| { cx.stop_propagation();
if !wake.is_empty() { let _ = this.tx.try_send(Command::Action("row-snooze".into(), wake.clone())); cx.notify(); return }
/* i18n-ok: menu labels, drawn through trs */ let items = opts.iter().map(|o| crate::screens::ctxmenu::Item { label: format!("Snooze {}", string(o, "label").to_lowercase()), action: "row-snooze".into(), value: string(o, "value"), confirm: false, note: String::new() }).collect();
this.ctx_open(e.position(), items, cx); }))
.into_any_element())
}

/// Settle in one press: a check on a row the hub says can be settled (`settle`: its id), shown under the pointer. None for any other row.
pub fn settle_button(cx: &mut Context<Backplane>, light: bool, t: &Value, group: SharedString) -> Option<AnyElement> {
let value = string(t, "settle"); if value.is_empty() { return None }
let c = |n: &str| theme::color(light, n);
let raw = value.rsplit('|').next().unwrap_or("").to_string();
Some(crate::ui::with_rect(div().id(SharedString::from(format!("settle-{value}"))), move || format!("settle:{raw}")).flex_shrink_0().w(px(16.)).h(px(16.)).flex().items_center().justify_center().cursor_pointer()
.invisible().group_hover(group, |s| s.visible()).hover(|s| s.bg(c("line")))
/* i18n-ok: the context menu's word, drawn through trs */ .tooltip(crate::keys::tip(&crate::i18n::trs("Settle"), "", light))
.child(crate::art::icon("check", 12., c("dim")))
.on_click(cx.listener(move |this, _, _, cx| { let _ = this.tx.try_send(Command::Action("row-settle".into(), value.clone())); cx.stop_propagation(); cx.notify(); }))
.into_any_element())
}

pub fn strip_projects(data: &Value) -> Vec<(String, String, &Value)> {
data["projects"].as_array().into_iter().flatten().map(|p| { let id = string(p, "id"); (id.rsplit('|').next().unwrap_or("").to_string(), string(p, "title"), p) }).filter(|(id, _, _)| !id.is_empty()).collect()
}
Expand Down
Loading
Loading