Give finished Rules a print path, folded launch counts, and a two-day follow-up.

Export is PDF, RULE.md, and Print on US Letter, with every shared term, no member names, and a takeaway that points at Ask an organizer. Finished Rules keep type and place so the team can read folded counts without a database, Umami can sit beside the app with no cookies, and the person who holds the pen gets working PDF and RULE.md links 48 hours later.
This commit is contained in:
adilallo committed 2026-11-10 18:32:33 -07:00
1 parent 0efc907633
commit d9c475a967
74 files changed
+2401 -630

No files matched your search

+18
View File
@@ -12,11 +12,24 @@ export type StoredLastPublishedRule = {
title: string;
summary?: string | null;
document: Record<string, unknown>;
/** ISO date the Rule was finished, for RULE.md front matter. */
finishedAt?: string;
/** Present after Make a copy; drives the copy-ready banner and lavender surface. */
copiedFromTitle?: string;
copiedNameHit?: CopiedNameHit | null;
};
export function finishedAtIso(value: unknown): string | undefined {
if (typeof value === "string" && value.trim().length > 0) {
const date = new Date(value);
if (!Number.isNaN(date.getTime())) return date.toISOString();
}
if (value instanceof Date && !Number.isNaN(value.getTime())) {
return value.toISOString();
}
return undefined;
}
export function writeLastPublishedRule(data: StoredLastPublishedRule): void {
if (typeof sessionStorage === "undefined") return;
sessionStorage.setItem(CREATE_FLOW_LAST_PUBLISHED_KEY, JSON.stringify(data));
@@ -44,6 +57,10 @@ export function readLastPublishedRule(): StoredLastPublishedRule | null {
} else {
summary = undefined;
}
let finishedAt: string | undefined;
if (typeof o.finishedAt === "string" && o.finishedAt.trim().length > 0) {
finishedAt = o.finishedAt;
}
let copiedFromTitle: string | undefined;
if (
typeof o.copiedFromTitle === "string" &&
@@ -69,6 +86,7 @@ export function readLastPublishedRule(): StoredLastPublishedRule | null {
title: o.title,
summary,
document: doc as Record<string, unknown>,
...(finishedAt ? { finishedAt } : {}),
...(copiedFromTitle ? { copiedFromTitle } : {}),
...(copiedNameHit ? { copiedNameHit } : {}),
};