Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Subtasks, and completion times that are actually completion times

Yashwanth Kamireddi9117a8c17be0
diff --git a/.uiverify/keyboard.mjs b/.uiverify/keyboard.mjs
index baa3bb2..40b4208 100644
--- a/.uiverify/keyboard.mjs
+++ b/.uiverify/keyboard.mjs
@@ -18,10 +18,10 @@ function installStub({ screen, services, twoFactor }) {
];
const items = [
{ guid: "R1", listGuid: "L1", title: "Water the plants", notes: null, dueAt: 4102444800,
- completedAt: null, priority: 0, flagged: false, recurFrequency: null,
+ completedAt: null, priority: 0, flagged: false, parentGuid: null, recurFrequency: null,
recurInterval: null, etag: "t1" },
{ guid: "R2", listGuid: "L1", title: "Evening run", notes: null, dueAt: 4102448400,
- completedAt: null, priority: 1, flagged: false, recurFrequency: null,
+ completedAt: null, priority: 1, flagged: false, parentGuid: null, recurFrequency: null,
recurInterval: null, etag: "t2" },
];
window.__TAURI_INTERNALS__ = {
diff --git a/.uiverify/shots.mjs b/.uiverify/shots.mjs
index 926df83..e8693c1 100644
--- a/.uiverify/shots.mjs
+++ b/.uiverify/shots.mjs
@@ -100,13 +100,13 @@ function installStub({ screen, services, twoFactor, calendarFixture, notesFixtur
];
const reminderItems = !remindersFixture ? [] : [
{ guid: "r1", listGuid: "l1", title: "Plan tomorrow", notes: null,
- dueAt: base - 2 * HOUR, completedAt: null, priority: 0, flagged: false, etag: null },
+ dueAt: base - 2 * HOUR, completedAt: null, priority: 0, flagged: false, parentGuid: null, etag: null },
{ guid: "r2", listGuid: "l1", title: "Pick up the parcel", notes: null,
- dueAt: base + DAY + 7 * HOUR, completedAt: null, priority: 0, flagged: true, etag: null },
+ dueAt: base + DAY + 7 * HOUR, completedAt: null, priority: 0, flagged: true, parentGuid: null, etag: null },
{ guid: "r3", listGuid: "l2", title: "Evening run", notes: "Legs today",
- dueAt: base + 6 * HOUR, completedAt: null, priority: 0, flagged: false, etag: null },
+ dueAt: base + 6 * HOUR, completedAt: null, priority: 0, flagged: false, parentGuid: null, etag: null },
{ guid: "r4", listGuid: "l1", title: "Water the plants", notes: null,
- dueAt: base - DAY, completedAt: base - DAY, priority: 0, flagged: false, etag: null },
+ dueAt: base - DAY, completedAt: base - DAY, priority: 0, flagged: false, parentGuid: null, etag: null },
];
const calendars = [
{ guid: "work", title: "Work", colour: "#cc73e1", ctag: null, sortOrder: 0, enabled: true },
diff --git a/crates/quince-core/src/reminders.rs b/crates/quince-core/src/reminders.rs
index 51c17d9..ebfa14d 100644
--- a/crates/quince-core/src/reminders.rs
+++ b/crates/quince-core/src/reminders.rs
@@ -28,6 +28,9 @@ pub struct Reminder {
pub priority: i64,
#[serde(default)]
pub flagged: bool,
+ /// The reminder this one is a subtask of, if any.
+ #[serde(default)]
+ pub parent_guid: Option<String>,
/// Apple's repeat frequency: 0 daily, 1 weekly, 2 monthly, 3 yearly. `None` if it does
/// not repeat.
#[serde(default)]
@@ -198,7 +201,8 @@ impl Library {
pub fn reminders_due_between(&self, from: i64, to: i64) -> Result<Vec<Reminder>> {
let mut stmt = self.conn.prepare(
"SELECT r.guid, r.list_guid, r.title, r.notes, r.due_at, r.completed_at,
- r.priority, r.flagged, r.recur_frequency, r.recur_interval, r.etag, r.raw
+ r.priority, r.flagged, r.parent_guid, r.recur_frequency, r.recur_interval,
+ r.etag, r.raw
FROM reminders r
JOIN reminder_lists l ON l.guid = r.list_guid
WHERE l.enabled = 1 AND r.due_at IS NOT NULL
@@ -215,10 +219,11 @@ impl Library {
completed_at: row.get(5)?,
priority: row.get(6)?,
flagged: row.get::<_, i64>(7)? != 0,
- recur_frequency: row.get(8)?,
- recur_interval: row.get(9)?,
- etag: row.get(10)?,
- raw: row.get(11)?,
+ parent_guid: row.get(8)?,
+ recur_frequency: row.get(9)?,
+ recur_interval: row.get(10)?,
+ etag: row.get(11)?,
+ raw: row.get(12)?,
})
})?;
Ok(rows.collect::<rusqlite::Result<Vec<_>>>()?)
@@ -293,7 +298,8 @@ impl Library {
};
let sql = format!(
"SELECT r.guid, r.list_guid, r.title, r.notes, r.due_at, r.completed_at,
- r.priority, r.flagged, r.recur_frequency, r.recur_interval, r.etag, r.raw
+ r.priority, r.flagged, r.parent_guid, r.recur_frequency, r.recur_interval,
+ r.etag, r.raw
FROM reminders r
JOIN reminder_lists l ON l.guid = r.list_guid
WHERE l.enabled = 1 AND {clause}
@@ -310,10 +316,11 @@ impl Library {
completed_at: row.get(5)?,
priority: row.get(6)?,
flagged: row.get::<_, i64>(7)? != 0,
- recur_frequency: row.get(8)?,
- recur_interval: row.get(9)?,
- etag: row.get(10)?,
- raw: row.get(11)?,
+ parent_guid: row.get(8)?,
+ recur_frequency: row.get(9)?,
+ recur_interval: row.get(10)?,
+ etag: row.get(11)?,
+ raw: row.get(12)?,
})
})?;
Ok(rows.collect::<rusqlite::Result<Vec<_>>>()?)
@@ -409,14 +416,14 @@ impl Library {
{
let mut stmt = tx.prepare(
"INSERT INTO reminders (guid, list_guid, title, notes, due_at, completed_at,
- priority, flagged, recur_frequency, recur_interval,
- etag, raw, updated_at)
- VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)
+ priority, flagged, parent_guid, recur_frequency,
+ recur_interval, etag, raw, updated_at)
+ VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14)
ON CONFLICT(guid) DO UPDATE SET
list_guid = excluded.list_guid, title = excluded.title,
notes = excluded.notes, due_at = excluded.due_at,
completed_at = excluded.completed_at, priority = excluded.priority,
- flagged = excluded.flagged,
+ flagged = excluded.flagged, parent_guid = excluded.parent_guid,
recur_frequency = excluded.recur_frequency,
recur_interval = excluded.recur_interval,
etag = excluded.etag, raw = excluded.raw,
@@ -433,6 +440,7 @@ impl Library {
r.completed_at,
r.priority,
i64::from(r.flagged),
+ r.parent_guid,
r.recur_frequency,
r.recur_interval,
r.etag,
@@ -470,7 +478,7 @@ impl Library {
pub fn reminders_in(&self, list_guid: &str, include_done: bool) -> Result<Vec<Reminder>> {
let mut stmt = self.conn.prepare(
"SELECT guid, list_guid, title, notes, due_at, completed_at, priority, flagged,
- recur_frequency, recur_interval, etag, raw
+ parent_guid, recur_frequency, recur_interval, etag, raw
FROM reminders
WHERE list_guid = ?1 AND (?2 = 1 OR completed_at IS NULL)
ORDER BY completed_at IS NOT NULL,
@@ -488,10 +496,11 @@ impl Library {
completed_at: row.get(5)?,
priority: row.get(6)?,
flagged: row.get::<_, i64>(7)? != 0,
- recur_frequency: row.get(8)?,
- recur_interval: row.get(9)?,
- etag: row.get(10)?,
- raw: row.get(11)?,
+ parent_guid: row.get(8)?,
+ recur_frequency: row.get(9)?,
+ recur_interval: row.get(10)?,
+ etag: row.get(11)?,
+ raw: row.get(12)?,
})
})?;
Ok(rows.collect::<rusqlite::Result<Vec<_>>>()?)
@@ -522,6 +531,7 @@ mod tests {
due_at: due,
completed_at: done,
priority: 0,
+ parent_guid: None,
flagged: false,
recur_frequency: None,
recur_interval: None,
@@ -708,6 +718,7 @@ mod smart_tests {
due_at: due,
completed_at: done,
priority: 0,
+ parent_guid: None,
flagged,
recur_frequency: None,
recur_interval: None,
@@ -846,6 +857,7 @@ mod count_tests {
due_at: due,
completed_at: done.then_some(1),
priority: 0,
+ parent_guid: None,
flagged,
recur_frequency: None,
recur_interval: None,
diff --git a/crates/quince-core/src/schema.rs b/crates/quince-core/src/schema.rs
index a59c34f..8d327bf 100644
--- a/crates/quince-core/src/schema.rs
+++ b/crates/quince-core/src/schema.rs
@@ -197,4 +197,13 @@ pub const MIGRATIONS: &[&str] = &[
r#"
ALTER TABLE sync_state ADD COLUMN last_full_at INTEGER;
"#,
+ // 11 — subtasks.
+ //
+ // Apple nests a reminder under another with a ParentReminder reference. Without it,
+ // every subtask showed as a sibling of the thing it belongs to, which reads as a flat
+ // list of fragments rather than as one piece of work broken down.
+ r#"
+ ALTER TABLE reminders ADD COLUMN parent_guid TEXT;
+ CREATE INDEX reminders_by_parent ON reminders (parent_guid);
+ "#,
];
diff --git a/crates/quince-icloud/src/reminders.rs b/crates/quince-icloud/src/reminders.rs
index 5aa2d78..2a88ae2 100644
--- a/crates/quince-icloud/src/reminders.rs
+++ b/crates/quince-icloud/src/reminders.rs
@@ -50,6 +50,7 @@ fn reminder_from(v: &Value) -> Option<Reminder> {
// The legacy endpoint does not carry a flag; CloudKit does, and that is the path
// this account actually uses.
flagged: v.get("flagged").and_then(Value::as_bool).unwrap_or(false),
+ parent_guid: string(v, "parentId"),
recur_frequency: None,
recur_interval: None,
etag: string(v, "etag"),
@@ -422,14 +423,20 @@ fn reminder_from_record(record: &Value) -> Option<Reminder> {
title: field::document_text(record, "TitleDocument").unwrap_or_else(|| "Untitled".into()),
notes: field::document_text(record, "NotesDocument"),
due_at,
- // CloudKit stores completion as a flag; the closest instant it also gives us is the
- // last modification, which is when the tick happened.
+ // Apple records when it was ticked off in its own field. Falling back to the last
+ // modification was close but wrong: any later edit moved the completion time with it.
completed_at: completed
- .then(|| field::timestamp_seconds(record, "LastModifiedDate"))
+ .then(|| {
+ field::timestamp_seconds(record, "CompletionDate")
+ .or_else(|| field::timestamp_seconds(record, "LastModifiedDate"))
+ })
.flatten()
.or(if completed { Some(0) } else { None }),
priority: field::int(record, "Priority").unwrap_or(0),
flagged: field::flag(record, "Flagged"),
+ // Apple nests a reminder under another with this reference. Without reading it,
+ // every subtask showed as a sibling of the thing it belongs to.
+ parent_guid: field::reference(record, "ParentReminder"),
// Filled in from the RecurrenceRule records, which arrive separately.
recur_frequency: None,
recur_interval: None,
@@ -994,6 +1001,8 @@ pub struct ReminderEdit {
pub priority: Option<i64>,
/// Move to another list.
pub list_guid: Option<String>,
+ /// Nest under another reminder, or `Some(None)` to bring it back out to the top level.
+ pub parent_guid: Option<Option<String>>,
}
impl ReminderEdit {
@@ -1005,6 +1014,7 @@ impl ReminderEdit {
&& self.completed.is_none()
&& self.priority.is_none()
&& self.list_guid.is_none()
+ && self.parent_guid.is_none()
}
}
@@ -1084,6 +1094,19 @@ pub async fn edit_cloudkit(
fields.insert("List".into(), client.reference_to(ZONE, list_guid));
}
+ if let Some(parent) = &edit.parent_guid {
+ let client = ZoneClient::new(http, ckdatabasews_root, CONTAINER, params.clone());
+ fields.insert(
+ "ParentReminder".into(),
+ match parent {
+ Some(guid) => client.reference_to(ZONE, guid),
+ // CloudKit clears a reference with an explicit null; omitting the field
+ // would leave the reminder nested where it was.
+ None => Value::Null,
+ },
+ );
+ }
+
if let Some(flagged) = edit.flagged {
fields.insert(
"Flagged".into(),
@@ -1594,6 +1617,7 @@ mod write_tests {
due_at: None,
completed_at: None,
priority: 0,
+ parent_guid: None,
flagged: false,
recur_frequency: None,
recur_interval: None,
@@ -1647,6 +1671,7 @@ mod edit_tests {
due_at: None,
completed_at: None,
priority: 0,
+ parent_guid: None,
flagged: false,
recur_frequency: None,
recur_interval: None,
@@ -2042,6 +2067,7 @@ mod recurring_tick_tests {
due_at: Some(due),
completed_at: None,
priority: 0,
+ parent_guid: None,
flagged: false,
recur_frequency: Some(frequency),
recur_interval: Some(interval),
@@ -2233,6 +2259,7 @@ mod priority_and_move_tests {
due_at: None,
completed_at: None,
priority: 0,
+ parent_guid: None,
flagged: false,
recur_frequency: None,
recur_interval: None,
@@ -2289,6 +2316,33 @@ mod priority_and_move_tests {
assert_eq!(sent["Priority"]["value"], 0);
}
+ /// Apple nests a reminder under another with a reference, and clears it with an
+ /// explicit null — omitting the field would leave it nested where it was.
+ #[tokio::test]
+ async fn nesting_and_unnesting_both_write_the_reference() {
+ let nested = write(ReminderEdit {
+ parent_guid: Some(Some("Reminder/parent".into())),
+ ..ReminderEdit::default()
+ })
+ .await;
+ assert_eq!(nested["ParentReminder"]["type"], "REFERENCE");
+ assert_eq!(
+ nested["ParentReminder"]["value"]["recordName"],
+ "Reminder/parent"
+ );
+
+ let freed = write(ReminderEdit {
+ parent_guid: Some(None),
+ ..ReminderEdit::default()
+ })
+ .await;
+ assert_eq!(
+ freed["ParentReminder"],
+ Value::Null,
+ "coming back out has to be written, not omitted"
+ );
+ }
+
#[tokio::test]
async fn moving_rewrites_the_list_reference() {
let sent = write(ReminderEdit {
@@ -2373,6 +2427,7 @@ mod tombstone_tests {
due_at: None,
completed_at: None,
priority: 0,
+ parent_guid: None,
flagged: false,
recur_frequency: None,
recur_interval: None,
@@ -2504,6 +2559,7 @@ mod recurrence_write_tests {
due_at: Some(4_102_444_800),
completed_at: None,
priority: 0,
+ parent_guid: None,
flagged: false,
recur_frequency: None,
recur_interval: None,
diff --git a/probe/src/main.rs b/probe/src/main.rs
index 11d2d23..75e4c69 100644
--- a/probe/src/main.rs
+++ b/probe/src/main.rs
@@ -1356,12 +1356,101 @@ async fn main() -> Result<()> {
completed_at: None,
priority: 0,
flagged: false,
+ parent_guid: None,
recur_frequency: None,
recur_interval: None,
etag: None,
raw: None,
};
+ // Subtasks: nest one reminder under another, read it back, free it.
+ match quince_icloud::reminders::create_cloudkit(
+ &http,
+ &ck,
+ params.clone(),
+ &from.guid,
+ "Quince subtask test — safe to delete",
+ )
+ .await
+ {
+ Err(e) => println!(" \x1b[31mFAIL\x1b[0m create subtask: {e}"),
+ Ok(child_guid) => {
+ let child = quince_core::reminders::Reminder {
+ guid: child_guid.clone(),
+ ..reminder.clone()
+ };
+ let parent_of = |name: String| {
+ let zc = &zc;
+ async move {
+ let rec = zc
+ .lookup_record("Reminders", &name)
+ .await
+ .ok()
+ .flatten()?;
+ quince_icloud::cloudkit::field::reference(
+ &rec,
+ "ParentReminder",
+ )
+ }
+ };
+
+ match quince_icloud::reminders::edit_cloudkit(
+ &http,
+ &ck,
+ params.clone(),
+ &child,
+ &quince_icloud::reminders::ReminderEdit {
+ parent_guid: Some(Some(guid.clone())),
+ ..Default::default()
+ },
+ )
+ .await
+ {
+ Err(e) => println!(" \x1b[31mFAIL\x1b[0m nest: {e}"),
+ Ok(()) => match parent_of(child_guid.clone()).await {
+ Some(p) if p == guid => {
+ println!(" \x1b[32mPASS\x1b[0m Apple nested it under its parent");
+ }
+ other => println!(
+ " \x1b[31mFAIL\x1b[0m parent came back as {other:?}"
+ ),
+ },
+ }
+
+ match quince_icloud::reminders::edit_cloudkit(
+ &http,
+ &ck,
+ params.clone(),
+ &child,
+ &quince_icloud::reminders::ReminderEdit {
+ parent_guid: Some(None),
+ ..Default::default()
+ },
+ )
+ .await
+ {
+ Err(e) => println!(" \x1b[31mFAIL\x1b[0m un-nest: {e}"),
+ Ok(()) => match parent_of(child_guid.clone()).await {
+ None => {
+ println!(" \x1b[32mPASS\x1b[0m and let it back out")
+ }
+ Some(p) => {
+ println!(" \x1b[31mFAIL\x1b[0m still nested under {p}")
+ }
+ },
+ }
+
+ let _ = quince_icloud::reminders::delete_cloudkit(
+ &http,
+ &ck,
+ params.clone(),
+ &child,
+ )
+ .await;
+ let _ = zc.delete_record("Reminders", &child_guid).await;
+ }
+ }
+
// Repeats: set one, read it back, change it, clear it.
let dated = quince_core::reminders::Reminder {
due_at: Some(
@@ -1779,6 +1868,76 @@ async fn main() -> Result<()> {
}
}
+ // ---- how does Apple express sections and subtasks? -----------------------------
+ println!("\n\x1b[1m── Reminders: sections and subtasks ──\x1b[0m");
+ if let Some(ck) = session.service_url("ckdatabasews") {
+ let zc = quince_icloud::cloudkit::ZoneClient::new(
+ client.http(),
+ &ck,
+ "com.apple.reminders",
+ client.service_params(),
+ );
+ if let Ok(quince_icloud::cloudkit::ZoneWalk { records, .. }) =
+ zc.all_records("Reminders", None).await
+ {
+ for rec in records
+ .iter()
+ .filter(|r| r.get("recordType").and_then(|t| t.as_str()) == Some("ListSection"))
+ .take(3)
+ {
+ println!(
+ " ListSection {}",
+ quince_icloud::cloudkit::field::record_name(rec).unwrap_or_default()
+ );
+ if let Some(fields) = rec.get("fields").and_then(|f| f.as_object()) {
+ for (k, v) in fields {
+ println!(
+ " {k} = {}",
+ v.to_string().chars().take(110).collect::<String>()
+ );
+ }
+ }
+ }
+
+ // Which fields on a Reminder could carry a parent or a section?
+ let mut seen: std::collections::BTreeSet<String> = std::collections::BTreeSet::new();
+ for rec in records
+ .iter()
+ .filter(|r| r.get("recordType").and_then(|t| t.as_str()) == Some("Reminder"))
+ {
+ if let Some(fields) = rec.get("fields").and_then(|f| f.as_object()) {
+ for k in fields.keys() {
+ seen.insert(k.clone());
+ }
+ }
+ }
+ println!(
+ " every field seen on a Reminder: {}",
+ seen.iter().cloned().collect::<Vec<_>>().join(", ")
+ );
+
+ // And any reminder that actually has a parent or section set.
+ for rec in records
+ .iter()
+ .filter(|r| r.get("recordType").and_then(|t| t.as_str()) == Some("Reminder"))
+ {
+ for key in ["ParentID", "Parent", "ListSection", "SectionID", "Subtasks"] {
+ if let Some(v) = rec.pointer(&format!("/fields/{key}")) {
+ println!(
+ " {} has {key} = {}",
+ quince_icloud::cloudkit::field::document_text(rec, "TitleDocument")
+ .unwrap_or_default()
+ .chars()
+ .take(28)
+ .collect::<String>(),
+ v.to_string().chars().take(100).collect::<String>()
+ );
+ }
+ }
+ }
+ }
+ }
+
// ---- CloudKit containers ----------------------------------------------------
// Apple's legacy /rd and /ca endpoints answer with a placeholder once data has been
// upgraded to the modern format. The real records live in CloudKit, so find out which
diff --git a/src/lib/ipc.ts b/src/lib/ipc.ts
index ae75192..106f402 100644
--- a/src/lib/ipc.ts
+++ b/src/lib/ipc.ts
@@ -179,6 +179,8 @@ export type ReminderEdit = {
priority?: number;
/** Move the reminder to another list. */
listGuid?: string;
+ /** Nest under another reminder, or null to bring it back out to the top level. */
+ parentGuid?: string | null;
};
export type Reminder = {
@@ -191,6 +193,8 @@ export type Reminder = {
completedAt: number | null;
priority: number;
flagged: boolean;
+ /** The reminder this one is a subtask of, if any. */
+ parentGuid: string | null;
/** Apple's repeat frequency: 0 daily, 1 weekly, 2 monthly, 3 yearly. null if it never repeats. */
recurFrequency: number | null;
recurInterval: number | null;
diff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsx
index 384de7d..ce17623 100644
--- a/src/screens/RemindersView.tsx
+++ b/src/screens/RemindersView.tsx
@@ -244,6 +244,24 @@ export function RemindersView() {
};
const setPriority = (r: Reminder, priority: number) =>
write(r, () => api.reminderEdit(r.guid, r.listGuid, { priority }));
+ /** Nest a reminder under the one above it, the way Tab does in Apple's app. */
+ const indent = (r: Reminder) => {
+ const flat = threaded.map((t) => t.reminder);
+ const index = flat.findIndex((x) => x.guid === r.guid);
+ // Only under something above it, and never under another subtask: Apple nests one deep.
+ const above = flat
+ .slice(0, index)
+ .reverse()
+ .find((x) => !x.parentGuid);
+ if (!above) return Promise.resolve(null);
+ return write(r, () =>
+ api.reminderEdit(r.guid, r.listGuid, { parentGuid: above.guid })
+ );
+ };
+
+ const outdent = (r: Reminder) =>
+ write(r, () => api.reminderEdit(r.guid, r.listGuid, { parentGuid: null }));
+
const moveToList = (r: Reminder, listGuid: string) =>
listGuid === r.listGuid
? Promise.resolve(null)
@@ -299,6 +317,35 @@ export function RemindersView() {
: (SMART.find((s) => s.kind === (selection as { kind: SmartList }).kind)
?.title ?? "Reminders");
const outstanding = items.filter((r) => !r.completedAt).length;
+
+ /**
+ * Reminders in Apple's order, with each subtask directly beneath its parent.
+ *
+ * The library returns a flat list sorted by date and priority, which is right for the
+ * top level and wrong for what hangs off it: a subtask sorted away from its parent reads
+ * as an unrelated fragment. This re-threads them without re-sorting either level.
+ */
+ const threaded = useMemo(() => {
+ const children = new Map<string, Reminder[]>();
+ for (const r of items) {
+ if (!r.parentGuid) continue;
+ const bucket = children.get(r.parentGuid);
+ if (bucket) bucket.push(r);
+ else children.set(r.parentGuid, [r]);
+ }
+ const known = new Set(items.map((r) => r.guid));
+ const out: { reminder: Reminder; depth: number }[] = [];
+ for (const r of items) {
+ // A subtask whose parent is not in this view — filtered out, or in another list —
+ // has to appear at the top level rather than vanish.
+ if (r.parentGuid && known.has(r.parentGuid)) continue;
+ out.push({ reminder: r, depth: 0 });
+ for (const child of children.get(r.guid) ?? []) {
+ out.push({ reminder: child, depth: 1 });
+ }
+ }
+ return out;
+ }, [items]);
const colour = useMemo(
() => lists.find((l) => l.guid === listGuid)?.colour || "var(--gold)",
[lists, listGuid],
@@ -459,7 +506,7 @@ export function RemindersView() {
)}
<ul className="rem-list-items">
- {items.map((reminder) => {
+ {threaded.map(({ reminder, depth }) => {
const due =
reminder.dueAt === null ? null : dueLabel(reminder.dueAt);
const isOpen = openGuid === reminder.guid;
@@ -468,7 +515,9 @@ export function RemindersView() {
return (
<li
key={reminder.guid}
- className={reminder.completedAt ? "is-done" : undefined}
+ className={`${reminder.completedAt ? "is-done" : ""}${
+ depth > 0 ? " is-subtask" : ""
+ }`.trim() || undefined}
>
<button
className="tick"
@@ -531,6 +580,25 @@ export function RemindersView() {
onBlur={(e) => void setDue(reminder, e.target.value)}
/>
</label>
+ <div className="rem-field">
+ <span>Nesting</span>
+ <span className="rem-nesting">
+ <button
+ className="quiet"
+ disabled={busyGuid === reminder.guid || depth > 0}
+ onClick={() => void indent(reminder)}
+ >
+ Make subtask
+ </button>
+ <button
+ className="quiet"
+ disabled={busyGuid === reminder.guid || depth === 0}
+ onClick={() => void outdent(reminder)}
+ >
+ Move out
+ </button>
+ </span>
+ </div>
<div className="rem-field">
<span>Repeat</span>
<Picker
diff --git a/src/styles/app.css b/src/styles/app.css
index a720e8a..9366dfc 100644
--- a/src/styles/app.css
+++ b/src/styles/app.css
@@ -734,6 +734,10 @@
.rem-list-items li:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
+/* A subtask is indented to the parent's text, so the tick marks line up under the title
+ rather than under the parent's tick — which is what makes the nesting readable. */
+.rem-list-items li.is-subtask { padding-left: 36px; }
+
/* Apple's ring: an outline that fills with the list's colour when ticked. */
.tick {
width: 18px;
@@ -755,6 +759,8 @@
.rem-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rem-title-row { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
+
+.rem-nesting { display: flex; gap: 6px; }
.rem-title-row .rem-title-edit { flex: 1; min-width: 0; }
.rem-title { font-size: var(--t-13); }
.rem-notes {