feat(period): p and a letter picks a period from any page

p t current period, p m month to date, p 7 and p 3 the last seven and
thirty days, p y year to date, p l last year, p a everything, p c
custom dates, p p opens the period menu, which now shows each key. The
same presets are in the palette. Currencies make primary moves to P and
the subscriptions card/currency toggle to v to free p.
This commit is contained in:
hh committed 2026-10-17 16:13:29 +00:00
1 parent 617a4700e2
commit 4a03ab8e1a
7 files changed
+68 -13

No files matched your search

+19 -4
View File
@@ -15,6 +15,8 @@ const STORAGE_KEY = "ffui.period";
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
export interface Preset {
hint?: string;
key?: string;
label: string;
range: Range;
}
@@ -113,31 +115,44 @@ class Period {
if (!isDynamic(view)) {
const prev = shiftPeriod(this.range, view, -1);
const next = shiftPeriod(this.range, view, 1);
presets.push({ label: periodLabel(prev, view), range: prev });
presets.push({ label: periodLabel(next, view), range: next });
presets.push({ hint: "[", label: periodLabel(prev, view), range: prev });
presets.push({ hint: "]", label: periodLabel(next, view), range: next });
}
const current = periodOf(now, view);
presets.push({
key: "t",
label: `Today (${periodLabel(current, view)})`,
range: current,
});
presets.push({
key: "7",
label: "Last seven days",
range: { end: now, start: addDays(now, -7) },
});
presets.push({
key: "3",
label: "Last thirty days",
range: { end: now, start: addDays(now, -30) },
});
presets.push({ label: "Month to date", range: periodOf(now, "MTD") });
presets.push({ label: "Year to date", range: periodOf(now, "YTD") });
presets.push({
key: "m",
label: "Month to date",
range: periodOf(now, "MTD"),
});
presets.push({
key: "y",
label: "Year to date",
range: periodOf(now, "YTD"),
});
const year = Number(now.slice(0, 4)) - 1;
presets.push({
key: "l",
label: `Previous year (${year})`,
range: { end: `${year}-12-31`, start: `${year}-01-01` },
});
if (this.first) {
presets.push({
key: "a",
label: "Everything",
range: { end: now, start: this.first },
});