Skip to main content

Toast Catalog — Phase 2 Implementation Plan

Branch: feat/toast-catalog-phase2 off origin/dev (has #1040 catalog + #1058). Goal: Finish the betting-toast catalog sweep — (A) remove the dead legacy slip chain, (B) migrate the remaining LIVE betting toasts onto the catalog, aligning copy/tone with the inline flow.

Scope decisions (from the user)

  • Betting-domain only. Admin/ops CRUD toasts (~180) are OUT — one-off strings, no catalog value.
  • Remove dead code in this PR (verified unmounted; superseded by the inline flow).
  • Align live slip copy with the inline flow's newer copy (UX change on desktop, product-approved).

Global Constraints

  • No fabricated/defaulted financial/domain values (§1). Preserve money/identity fields.
  • Catalog modules stay pure (type-only imports). Dispatch via toast.show(descriptor).
  • Deletion: before removing each file, re-confirm zero LIVE importers. NEVER delete a shared helper (LimitsLine, OpenBetsTab, BetSlipCard, SwipeToConfirm are shared — keep).
  • Verify: npm test + npx tsc --noEmit clean after each task.

Task A — Remove the dead legacy slip chain

Verified dead (closed subgraph — the only importers of each are other dead files; roots BetPanelMobile + StrykrBetPanelMobile have zero mounts):

  • Delete: strykr-fe/src/components/betting/StrykrBetPanelMobile.tsx
  • Delete: strykr-fe/src/components/betting/BetPanelMobile.tsx
  • Delete: strykr-fe/src/components/betting/StrykrBetSlipTab.tsx
  • Delete: strykr-fe/src/components/betting/StrykrBetSlipFooter.tsx
  • Delete: strykr-fe/src/components/betting/StrykrBetSlipCard.tsx (orphaned — imported only by StrykrBetSlipTab)

Keep (shared / live): BetPanel (live, MainLayout), BetSlipTab + BetSlipFooter (live via BetPanel — Task B migrates them), OpenBetsTab, BetSlipCard, LimitsLine, SwipeToConfirm (used by admin/transfers).

  • Confirm each of the 5 has zero live importers (grep), delete them.
  • npx tsc --noEmit clean (no dangling imports); npm test green.
  • Commit: chore(betting): remove dead legacy slip chain (StrykrBetSlip*/*PanelMobile, superseded by inline)

Task B — Migrate live betting toasts to the catalog (align with inline flow)

Live targets: BetSlipFooter.tsx (9), BetSlipTab.tsx (1), InlineBetSlip.tsx (6 leftover non-Excel).

Alignment conventions (from #1040 inline decisions):

  • Success, exchange/BF (rests) → yellow tick "Bet Accepted - Awaiting Match" (messages.placement.betAccepted).
  • Success, bookmaker/BM (instant) → green tick "Bet Placed Successfully!" (messages.placement.betPlacedFancy).
  • Placement failure → red "Unexpected Error" (messages.placement.failure).
  • Stake-validation → inline caption, not a toast, where the surface supports it.
  • Reuse existing catalog entries where semantics match; add new messages.placement.* entries (with tests) for batch-specific cases, preserving the batch count and matching the tone/color above.

Steps:

  • Read BetSlipFooter.tsx fully; map each of its 9 toasts → an existing catalog entry or a new one. Batch cases (multi-bet "N placed", "X placed, Y failed") get new messages.placement.* entries following the conventions; single-bet cases reuse the inline entries. Propose the mapping in the report for review.
  • Migrate BetSlipTab.tsx "Cleared N bets" → a catalog entry (e.g. messages.placement.cleared(n)).
  • Migrate the 6 InlineBetSlip leftovers (odds-unavailable / invalid-odds / unable-to-place) → catalog entries (new messages.placement.oddsUnavailable / invalidOdds / unavailable), dispatched via toast.show.
  • Add .test.mjs coverage for every new catalog entry.
  • Replace all raw toast.success/error/warning/info in these three files with toast.show(messages.placement.*). Confirm zero raw toast.* betting call sites remain (grep).
  • Verify: node --test (catalog), npm test full, npx tsc --noEmit clean.
  • Commit: feat(messages): migrate live betslip-footer/tab + inline leftovers onto the catalog

Verification (whole PR)

  • npm test + tsc clean; git grep -nE "toast\.(success|error|warning|info)\(" src/components/betting returns nothing (all betting toasts now go through the catalog).
  • Manual/desktop: BetPanel placement toasts render with the aligned copy.

Out of scope / follow-ups

  • Admin/ops CRUD toasts (~180) — not catalog-migrated; the repeated err?.response?.data...||'Failed' pattern could get a shared helper in a separate cleanup.