refactor(app): Phase B.1 — extract pre-React bootstrap into src/app/ (#555)

main.tsx shrinks from 56 -> 17 LOC. New module surface:

  - src/app/windowKind.ts: cached getWindowKind() detector,
    replaces the global __PSY_WINDOW_LABEL__ string everywhere
  - src/app/bootstrap.ts: pushUserAgentToBackend +
    pushLoggingModeToBackend + runPreReactBootstrap orchestrator

App.tsx + playerStore.ts now read getWindowKind() instead of poking
window.__PSY_WINDOW_LABEL__ directly. Behaviour-preserving.
This commit is contained in:
Frank Stellmacher
2026-05-12 01:39:39 +02:00
committed by GitHub
parent d3a8160b37
commit 0cd8998dc9
8 changed files with 298 additions and 46 deletions
+2 -2
View File
@@ -24,6 +24,7 @@ import { resolveReplayGainDb } from '../utils/resolveReplayGainDb';
import { shuffleArray } from '../utils/shuffleArray';
import { songToTrack } from '../utils/songToTrack';
import { buildInfiniteQueueCandidates } from '../utils/buildInfiniteQueueCandidates';
import { getWindowKind } from '../app/windowKind';
// Re-export for backward compatibility with the ~30 call sites that still
// import these helpers from playerStore. Phase E (store splits) will migrate
@@ -3590,8 +3591,7 @@ export function installQueueUndoHotkey(): void {
if (typeof window === 'undefined') return;
const w = window as unknown as Record<string, unknown>;
if (w[QUEUE_UNDO_HOTKEY_FLAG]) return;
const label = w.__PSY_WINDOW_LABEL__;
if (label === 'mini') return;
if (getWindowKind() === 'mini') return;
w[QUEUE_UNDO_HOTKEY_FLAG] = true;
document.addEventListener(
'keydown',