2026-08-23 20:15:41 +02:00
|
|
|
// In-memory handoff for the user's table choice between the landing page
|
2026-08-23 05:25:15 +02:00
|
|
|
// and /play — a File can't survive a URL-based navigation, and this is a
|
|
|
|
|
// single-shot value read once on mount, so module-level state is sufficient
|
|
|
|
|
// (no need for anything heavier than a plain variable).
|
2026-08-23 20:15:41 +02:00
|
|
|
export type PendingSelection =
|
|
|
|
|
| { kind: "upload"; vpxFile: File; romFile?: File; saveToLibrary: boolean }
|
|
|
|
|
| { kind: "library"; id: string };
|
2026-08-23 05:25:15 +02:00
|
|
|
|
2026-08-23 20:15:41 +02:00
|
|
|
let pendingSelection: PendingSelection | null = null;
|
|
|
|
|
|
|
|
|
|
export function setPendingTable(selection: PendingSelection): void {
|
|
|
|
|
pendingSelection = selection;
|
2026-08-23 05:25:15 +02:00
|
|
|
}
|
|
|
|
|
|
2026-08-23 20:15:41 +02:00
|
|
|
export function takePendingTable(): PendingSelection | null {
|
|
|
|
|
const selection = pendingSelection;
|
|
|
|
|
pendingSelection = null;
|
|
|
|
|
return selection;
|
2026-08-23 05:25:15 +02:00
|
|
|
}
|