PlanImport
app/features/map-planner/core/PlanImport.tsCross-tab handoff of a plan into the planner: the source tab stashes the plan in localStorage under a fresh key, then opens the planner with ?import=<key> (plus the stage and mode its header shows). Claimed plans are removed; unclaimed leftovers (blocked popup) are swept by key age next time.
- Imports
- no other modules
- Used by
- 2 components
Types
export interface ImportedPlan { /** the canvas background, as a data URL so the saved plan outlives the page */ background: string; /** main weapons placed beside the background */ allies: MainWeaponId[]; /** main weapons placed beside the background, outlined */ enemies: MainWeaponId[]; }
Componentsmap-planner/Planner.tsx
Functions & values
Opens the planner in a new tab with the plan set up on its canvas, replacing what was there. Call from a user gesture. Rejects, opening nothing, when the plan can't be stashed (e.g. storage full).
export async function openInNewTab({ background, allies, enemies, stageId, mode, }: Omit<ImportedPlan, "background"> & { background: Blob; /** shown in the planner's header, null when unknown */ stageId: StageId | null; mode: ModeShort | null; }): Promise<void>
Unit tests (2)
Componentsscanner/CoachView.tsx
Takes (and removes) the plan stashed under key. Null when there's none.
export function claim(key: string): ImportedPlan | null
Unit tests (4)
Componentsmap-planner/Planner.tsx