fix(rectification): start new case from homepage
This commit is contained in:
@@ -12,7 +12,7 @@ export const runtime = "nodejs";
|
||||
/**
|
||||
* GET /api/rectification/cases/entry-summary
|
||||
*
|
||||
* Server-truth homepage CTA: "开始生时校正" / "继续上次校正" / "再次校正".
|
||||
* Server-truth context for homepage copy; the primary homepage action always creates.
|
||||
*/
|
||||
export async function GET() {
|
||||
let supabase;
|
||||
|
||||
@@ -28,7 +28,7 @@ function serviceErrorResponse(error: unknown) {
|
||||
*
|
||||
* Browser sends only { intent, requestId } (+ sessionId for intent=session).
|
||||
* The server derives the user from the session, normalizes the profile and
|
||||
* decides resume-or-create. Double-click / multi-tab are idempotent.
|
||||
* creates for homepage/new or restores the exact requested session. Retries are idempotent.
|
||||
*/
|
||||
export async function POST(request: Request) {
|
||||
let supabase;
|
||||
|
||||
@@ -3423,8 +3423,8 @@ export default function Home() {
|
||||
<div className="product-entrypoint-copy">
|
||||
<span className="product-entrypoint-kicker">出生资料</span>
|
||||
<h2 id="birth-rectification-title">生时校正</h2>
|
||||
<p>{rectificationCardAction === "resume"
|
||||
? "你有一段未完成的校正记录,可以从上次的位置继续。"
|
||||
<p>{rectificationEntrySummary?.hasResumableCase
|
||||
? "新建一段独立校正;未完成的记录仍可从左侧历史会话继续。"
|
||||
: rectificationCardAction === "restart"
|
||||
? "上一次校正已经完成,可以基于最新资料再次校正。"
|
||||
: "不确定准确出生时间时,可通过已经发生的人生事件逐步缩小范围。"}</p>
|
||||
|
||||
@@ -20,18 +20,16 @@ export type RectificationEntrySummary = Readonly<{
|
||||
}> | null;
|
||||
}>;
|
||||
|
||||
export type RectificationCardAction = "start" | "resume" | "restart";
|
||||
export type RectificationCardAction = "start" | "restart";
|
||||
|
||||
export const rectificationEntryLabels: Readonly<Record<RectificationCardAction, string>> = {
|
||||
start: "开始生时校正",
|
||||
resume: "继续上次校正",
|
||||
start: "开始新的生时校正",
|
||||
restart: "再次校正",
|
||||
};
|
||||
|
||||
export function resolveRectificationEntryAction(
|
||||
summary: RectificationEntrySummary,
|
||||
): RectificationCardAction {
|
||||
if (summary.hasResumableCase) return "resume";
|
||||
if (summary.hasTerminalCaseWithTime) return "restart";
|
||||
return "start";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user