Project · Time and databases: a time tracker, a pomodoro, a database
TimeTracker times a task: a field names it, Start or Enter starts the clock and Stop ends it, the running time counting up by the executor's clock; the entries sit under it in hours and minutes with their total. The owner keeps what runs and what was spent, and a blank name starts nothing. PomodoroTimer runs focus, a short break, and after the last round a long one. A ring counts each phase down around the time left, dots count the rounds, Pause banks the time gone, and a phase that runs out moves on, waits for Start, and reaches the owner through window.defer. motion::ProgressRing gains a size and content inside, its stroke kept at the theme ring's weight, the content outside the per-turn glide. DatabaseView shows tasks five ways, switched from a strip that scrolls when narrow: a table, a board by status whose moves hand on the new status, a gallery of issue cards, a month calendar by due day, and a timeline from start to due, which counts the records without dates. Task gains a start day. Along the way: table rows, groups and details fill with min_w_full, so they stretch in the table's column and fill a virtual list alike; before, a table in a measured column drew rows at their words' width. The gallery script logs each probe it aims at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
28973fe1d2
commit
6377f926c8
19 files changed
+1294
-23
No files matched your search
+5
-3
@@ -127,7 +127,7 @@ impl Body {
|
||||
let content = detail(&key, window, cx);
|
||||
let colors = &cx.theme().colors;
|
||||
div()
|
||||
.w_full()
|
||||
.min_w_full()
|
||||
.pl(self.lead_width())
|
||||
.pr_3()
|
||||
.py_3()
|
||||
@@ -152,7 +152,7 @@ impl Body {
|
||||
let colors = &theme.colors;
|
||||
let row = div()
|
||||
.id((self.id.clone(), format!("group-{name}-{lead}")))
|
||||
.w_full()
|
||||
.min_w_full()
|
||||
.h(self.height)
|
||||
.flex()
|
||||
.items_center()
|
||||
@@ -204,11 +204,13 @@ impl Body {
|
||||
let colors = &theme.colors;
|
||||
let press = self.select.clone();
|
||||
let open = self.open.contains(&key);
|
||||
let named = key.clone();
|
||||
div()
|
||||
.id((self.id.clone(), format!("row-{key}-{lead}")))
|
||||
.debug_selector(move || format!("table-row {named}"))
|
||||
.flex()
|
||||
.items_center()
|
||||
.w_full()
|
||||
.min_w_full()
|
||||
.h(self.height)
|
||||
.border_b_1()
|
||||
.border_color(colors.border)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
use gpui::{
|
||||
Context, IntoElement, KeyUpEvent, Keystroke, Modifiers, Render, Styled, TestAppContext, Window,
|
||||
point, px,
|
||||
Context, IntoElement, KeyUpEvent, Keystroke, Modifiers, ParentElement, Render, Styled,
|
||||
TestAppContext, Window, div, point, px,
|
||||
};
|
||||
|
||||
use super::{edit_at, settle};
|
||||
@@ -151,3 +151,41 @@ fn a_focused_header_past_the_edge_scrolls_into_view(cx: &mut TestAppContext) {
|
||||
"the last header's column sits at the box's end"
|
||||
);
|
||||
}
|
||||
|
||||
/// A table in a column beside a long line, in a box its row measures by content.
|
||||
struct Exposed;
|
||||
|
||||
impl Render for Exposed {
|
||||
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
|
||||
let table = DataTable::new(
|
||||
"exposed",
|
||||
[Column::new("name", "Name"), Column::new("note", "Note")],
|
||||
)
|
||||
.rows(vec![
|
||||
Row::new("a", ["A".into(), "".into()]),
|
||||
Row::new("b", ["A much longer name".into(), "Note".into()]),
|
||||
]);
|
||||
let line = "A line long enough to wrap in this box, so the column fills it, and more.";
|
||||
div()
|
||||
.flex()
|
||||
.child(div().child(div().flex().flex_col().child(table).child(line)))
|
||||
}
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn rows_span_the_table_whatever_their_words(cx: &mut TestAppContext) {
|
||||
cx.update(Theme::init);
|
||||
let (_, cx) = cx.add_window_view(|_, _| Exposed);
|
||||
cx.run_until_parked();
|
||||
let short = cx
|
||||
.debug_bounds("table-row a")
|
||||
.expect("row a draws")
|
||||
.size
|
||||
.width;
|
||||
let long = cx
|
||||
.debug_bounds("table-row b")
|
||||
.expect("row b draws")
|
||||
.size
|
||||
.width;
|
||||
assert_eq!(short, long, "a short row keeps the long row's width");
|
||||
}
|
||||
Reference in new issue
Block a user