Show invited people the Rule, let them copy its cards for their community, and replace an expired invitation link.
This commit is contained in:
1 parent
727a92a9ac
commit
3c984e00c5
37 files changed
+1962
-19
No files matched your search
@@ -1,7 +1,9 @@
|
||||
import type { CopiedNameHit } from "./copiedRuleDocument";
|
||||
|
||||
/**
|
||||
* Bridges final-review → completed without query strings, and re-opens a rule
|
||||
* from profile (`/create/completed?ruleId=…`) after GET /api/rules/[id]. Profile
|
||||
* "Manage" links here; "View" uses `/rules/[id]`.
|
||||
* "Manage" links here; stakeholder "View" uses `/invite/[id]`.
|
||||
*/
|
||||
export const CREATE_FLOW_LAST_PUBLISHED_KEY = "createFlow.lastPublished";
|
||||
|
||||
@@ -10,6 +12,9 @@ export type StoredLastPublishedRule = {
|
||||
title: string;
|
||||
summary?: string | null;
|
||||
document: Record<string, unknown>;
|
||||
/** Present after Make a copy; drives the copy-ready banner and lavender surface. */
|
||||
copiedFromTitle?: string;
|
||||
copiedNameHit?: CopiedNameHit | null;
|
||||
};
|
||||
|
||||
export function writeLastPublishedRule(data: StoredLastPublishedRule): void {
|
||||
@@ -39,11 +44,33 @@ export function readLastPublishedRule(): StoredLastPublishedRule | null {
|
||||
} else {
|
||||
summary = undefined;
|
||||
}
|
||||
let copiedFromTitle: string | undefined;
|
||||
if (
|
||||
typeof o.copiedFromTitle === "string" &&
|
||||
o.copiedFromTitle.trim().length > 0
|
||||
) {
|
||||
copiedFromTitle = o.copiedFromTitle;
|
||||
}
|
||||
let copiedNameHit: CopiedNameHit | null | undefined;
|
||||
if (o.copiedNameHit && typeof o.copiedNameHit === "object") {
|
||||
const hit = o.copiedNameHit as Record<string, unknown>;
|
||||
if (
|
||||
typeof hit.categoryName === "string" &&
|
||||
typeof hit.entryTitle === "string"
|
||||
) {
|
||||
copiedNameHit = {
|
||||
categoryName: hit.categoryName,
|
||||
entryTitle: hit.entryTitle,
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
id: o.id,
|
||||
title: o.title,
|
||||
summary,
|
||||
document: doc as Record<string, unknown>,
|
||||
...(copiedFromTitle ? { copiedFromTitle } : {}),
|
||||
...(copiedNameHit ? { copiedNameHit } : {}),
|
||||
};
|
||||
} catch {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user