diary: templates, a calendar, the days either side and this day before

A folder called templates at the root of any space holds templates. `:new
<template> [yyyy-mm-dd] [name]` starts a document from one, with {{date}},
{{weekday}}, {{time}} and {{title}} filled in on the server, in
WORKSPACE_TIMEZONE, for the date the document is for. A new diary entry starts
from templates/day when the diary has one, whether it comes from T, o, the
calendar or a capture. Templates are not entries: the calendar, the reminder
and "written today" leave them out.

C (or :cal) shows the diary by month: h/l a day, j/k a week, H/L a month, .
today, and Enter opens the day's entry or starts one dated that day. [d and
]d step to the entry before or after the open one by date, backdated ones
included. The agenda ends with what the diary holds from this day in earlier
years; a 29 February is remembered on the 28th in years without one.

New routes: GET /api/diary/days?month=, GET /api/diary/around/{id} and
GET /api/nodes/{id}/templates. POST /api/nodes takes template_id.
This commit is contained in:
nvrl committed 2026-10-20 23:41:04 +02:00
1 parent f629f5af97
commit 824f2bb945
14 files changed
+1048 -50

No files matched your search

+33
View File
@@ -183,6 +183,27 @@ export interface Agenda {
cards: AgendaCard[]
/** Whether the diary has an entry today; null when there is no diary. */
diary_today: boolean | null
/** Diary entries from this day in earlier years, the latest year first. */
on_this_day: DiaryEntry[]
}
/** A diary entry, by the local day it is about. */
export interface DiaryEntry {
id: number
name: string
/** `2026-10-20`, in the server's timezone. */
day: string
created_at: number
/** `diary/untitled`, to open it by. */
path: string
excerpt: string
}
/** A document in a space's `templates` folder. */
export interface Template {
id: number
name: string
slug: string
}
export interface BoardList {
@@ -433,8 +454,20 @@ export const api = {
name?: string
body?: string
created_at?: number
/** Start from this document, its `{{date}}` and the rest filled in. */
template_id?: number
}) => request<WorkspaceNode>('/nodes', { method: 'POST', body: body(input) }),
/** The templates of the space `id` is in. */
templates: (id: number) => request<Template[]>(`/nodes/${id}/templates`),
/** A month's diary entries: `2026-10`. */
diaryDays: (month: string) => request<DiaryEntry[]>(`/diary/days?month=${encodeURIComponent(month)}`),
/** The entries before and after a diary entry, by date. */
diaryAround: (id: number) =>
request<{ prev: DiaryEntry | null; next: DiaryEntry | null }>(`/diary/around/${id}`),
/**
* `base_updated_at`: refused with 409 if the node was saved since then.
* `restore`: the text is a revision brought back, so what it replaces is