feat: garden review fixes — honest dose answer grows it, quiet after crisis, no-promise texts (ADR-015)
CI / ruff · pytest (pull_request) Successful in 2m21s
CI / ruff · pytest (pull_request) Successful in 2m21s
Refs #120 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -192,4 +192,6 @@ export interface Garden {
|
||||
points_in_step: number;
|
||||
plants: { stage: number }[];
|
||||
today: { activity: GardenActivity; title: string; done: boolean; detail: string | null }[];
|
||||
/** Recent acute/high alert (#120): growth stays, no toast or animation. */
|
||||
quiet: boolean;
|
||||
}
|
||||
|
||||
@@ -70,9 +70,10 @@ export function Garden({ refreshKey }: { refreshKey?: unknown }) {
|
||||
setGarden(g);
|
||||
const raw = window.localStorage.getItem(seenKey(session.token));
|
||||
const seen = raw === null ? null : Number(raw);
|
||||
// No celebration right after a crisis: growth stays, the toast and the animation do not.
|
||||
// No celebration right after a crisis: growth stays, the toast and the animation do not. The server knows
|
||||
// about alerts from scales and questionnaires too (`quiet`); the chat check covers a crisis reply just shown.
|
||||
const recentCrisis = dialog.entries.slice(-12).some((e) => e.from === "assistant" && e.reply.kind === "crisis");
|
||||
if (seen !== null && g.steps > seen && !recentCrisis) {
|
||||
if (seen !== null && g.steps > seen && !g.quiet && !recentCrisis) {
|
||||
setFreshFrom(seen);
|
||||
if (!announced.current) toast(ru.garden.grew);
|
||||
announced.current = true;
|
||||
|
||||
@@ -88,12 +88,12 @@ export const ru = {
|
||||
},
|
||||
garden: {
|
||||
eyebrow: "Ваш сад",
|
||||
lead: "Растёт вместе с вами",
|
||||
lead: "Растёт от ваших отметок",
|
||||
next: "Новый росток",
|
||||
of: (a: number, b: number) => `${a} из ${b}`,
|
||||
today: "Сегодня",
|
||||
noPressure: "Пропуск — не страшно, сад не вянет",
|
||||
grew: "Сад подрос — появился новый росток",
|
||||
noPressure: "Сад не вянет от пропусков. Честное «Пропущу» по лекарству тоже растит сад",
|
||||
grew: "Сад подрос",
|
||||
label: (title: string, bloom: number, growing: number) =>
|
||||
`${title}. Цветов: ${bloom}, растёт: ${growing}.`,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user