fix(home): split starter fine print, show hints only when actionable (BUG-1041)
TASK-starter-home-polish-20260926: - D1 today's trend moves to a sub-line under the greeting (.starter-greeting-sub), read from the same dailyStarlanguage state the warm snapshot seeds; static sentence until ready, hidden without a minute. - D2 the line under the pills appears only for a resumable case or a non-self subject; the first-run and redo sentences are removed. - BUG-1041 entrySummaryFromResponse read snake_case keys while the entry-summary route returns camelCase, so every account parsed as a first run; the parser now reads the route's shape (snake_case still ok). - D3 daily entry icon MoonStar, credits icon Coins; D4 boundary line kept. - Records: CHANGELOG, DESIGN, VOICE, BUG_HISTORY, PROGRESS, testing list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6d371d82a7
commit
b5a02ca861
@@ -69,32 +69,45 @@ export function isTerminalRectificationStatus(status: string): boolean {
|
||||
return TERMINAL_STATUSES.has(status);
|
||||
}
|
||||
|
||||
/* `GET /api/rectification/cases/entry-summary` answers with the camelCase
|
||||
object `getRectificationEntrySummary` returns; only the RPC underneath speaks
|
||||
snake_case. This parser used to read the snake_case keys alone, so every real
|
||||
response parsed as "nothing on record" and the homepage never saw a resumable
|
||||
or finished case (BUG-1041). The route's camelCase shape wins; snake_case is
|
||||
still read so an RPC-shaped payload does not silently collapse either. */
|
||||
function field(row: Record<string, unknown>, camel: string, snake: string): unknown {
|
||||
return camel in row ? row[camel] : row[snake];
|
||||
}
|
||||
|
||||
function objectField(row: Record<string, unknown>, camel: string, snake: string): Record<string, unknown> | null {
|
||||
const value = field(row, camel, snake);
|
||||
return value && typeof value === "object" ? value as Record<string, unknown> : null;
|
||||
}
|
||||
|
||||
export function entrySummaryFromResponse(value: unknown): RectificationEntrySummary {
|
||||
if (!value || typeof value !== "object") {
|
||||
return { hasResumableCase: false, hasTerminalCaseWithTime: false, latestResumable: null, latestTerminal: null };
|
||||
}
|
||||
const row = value as Record<string, unknown>;
|
||||
const latestResumable = row.latest_resumable && typeof row.latest_resumable === "object"
|
||||
? row.latest_resumable as Record<string, unknown>
|
||||
: null;
|
||||
const latestTerminal = row.latest_terminal && typeof row.latest_terminal === "object"
|
||||
? row.latest_terminal as Record<string, unknown>
|
||||
: null;
|
||||
const latestResumable = objectField(row, "latestResumable", "latest_resumable");
|
||||
const latestTerminal = objectField(row, "latestTerminal", "latest_terminal");
|
||||
const resumableCaseId = latestResumable ? field(latestResumable, "caseId", "case_id") : null;
|
||||
const terminalCaseId = latestTerminal ? field(latestTerminal, "caseId", "case_id") : null;
|
||||
return {
|
||||
hasResumableCase: row.has_resumable_case === true,
|
||||
hasTerminalCaseWithTime: row.has_terminal_case_with_time === true,
|
||||
latestResumable: latestResumable && typeof latestResumable.case_id === "string"
|
||||
hasResumableCase: field(row, "hasResumableCase", "has_resumable_case") === true,
|
||||
hasTerminalCaseWithTime: field(row, "hasTerminalCaseWithTime", "has_terminal_case_with_time") === true,
|
||||
latestResumable: latestResumable && typeof resumableCaseId === "string"
|
||||
? {
|
||||
caseId: latestResumable.case_id,
|
||||
caseId: resumableCaseId,
|
||||
status: String(latestResumable.status ?? ""),
|
||||
lastActivityAt: String(latestResumable.last_activity_at ?? ""),
|
||||
lastActivityAt: String(field(latestResumable, "lastActivityAt", "last_activity_at") ?? ""),
|
||||
}
|
||||
: null,
|
||||
latestTerminal: latestTerminal && typeof latestTerminal.case_id === "string"
|
||||
latestTerminal: latestTerminal && typeof terminalCaseId === "string"
|
||||
? {
|
||||
caseId: latestTerminal.case_id,
|
||||
caseId: terminalCaseId,
|
||||
status: String(latestTerminal.status ?? ""),
|
||||
hasUsableTime: latestTerminal.has_usable_time === true,
|
||||
hasUsableTime: field(latestTerminal, "hasUsableTime", "has_usable_time") === true,
|
||||
}
|
||||
: null,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user