frontend: life events + retirement goals sections on scenario detail
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Two new nested CRUD sections on /scenarios/:id, each list + add form
in one card:

- Life events: name, kind (free-text with datalist suggestions —
  retirement, kid_born, mortgage_payoff, sabbatical, inheritance...),
  year_start, optional year_end (one-time vs ranged), £/year delta.
  One-line summary per row; Delete button per item.

- Goals: name, kind (target_nw, never_run_out, inheritance,
  spending_floor), comparator (>= < etc), target amount, target year,
  success threshold (probability bar). Same list+add+delete layout.

Both wire through the existing FastAPI endpoints (POST/GET on
nested paths, DELETE on flat /life-events/{id} and /goals/{id})
already shipped in Phase 0c. Mutations invalidate per-scenario
queries so the list refreshes immediately.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Viktor Barzin 2026-05-09 22:17:04 +00:00
parent b2af5c5893
commit 18981459b3
4 changed files with 501 additions and 0 deletions

View file

@ -10,6 +10,8 @@ import { Link, useNavigate, useParams } from 'react-router-dom';
import { api } from '@/api/client';
import { ApiError } from '@/api/client';
import { FanChart } from '@/components/FanChart';
import { GoalsSection } from '@/components/GoalsSection';
import { LifeEventsSection } from '@/components/LifeEventsSection';
import { gbp, pct } from '@/lib/format';
export function ScenarioDetail() {
@ -141,6 +143,9 @@ export function ScenarioDetail() {
{String((proj.error as Error)?.message ?? proj.error)}
</div>
)}
<LifeEventsSection scenarioId={id} />
<GoalsSection scenarioId={id} />
</section>
);
}