Add Field canvas component and fix Firebase/env configuration#18
Open
DigitalBlueprint239 wants to merge 5 commits intomasterfrom
Open
Add Field canvas component and fix Firebase/env configuration#18DigitalBlueprint239 wants to merge 5 commits intomasterfrom
DigitalBlueprint239 wants to merge 5 commits intomasterfrom
Conversation
CRIT-001: Delete tailwind.config.js (react-scripts auto-detected it and
injected require('tailwindcss') as a PostCSS plugin; Tailwind v4 throws).
Update src/index.css from @tailwind directives to @import "tailwindcss".
CRIT-002/HIGH-002/HIGH-003: Create src/config/env.ts with centralized
REACT_APP_* env var access and validateFirebaseConfig(). Replace all
import.meta.env.VITE_* and NEXT_PUBLIC_* references across 7 active files.
CRIT-003: Add 11 orphaned/broken files to tsconfig.json exclude array
(legacy files with spaces in names, missing deps, or JSX in .ts files).
App renders without crashing when Firebase env vars are not set.
HIGH-004/Phase 4: Fix test setup (matchMedia mock, AuthProvider context
mismatch, multiple /Coach Core/ matches). Tests now pass.
https://claude.ai/code/session_01R7wcmQQLSC2pNoemAUJwwT
…match firebase.ts: rewrite with graceful null handling — app/auth/db are null when env vars are missing; app renders with console warning instead of crash. firestore.ts: guard getAuth() behind validateFirebaseConfig() to prevent auth/invalid-api-key in test environment; guard onAuthStateChanged call. AuthProvider.tsx: use auth from services/firebase instead of calling getAuth() unconditionally (prevented crash when no Firebase app exists). App.tsx: use AuthProvider from hooks/useAuth (Dashboard.tsx uses useAuth from hooks/useAuth — mismatched contexts caused 'useAuth must be used within AuthProvider' error). useAuth.tsx, TeamContext.tsx, useFirestore.ts: null-safe Firebase usage; fix import shadowing (firestoreAddPlay aliases); fix missing React import. PracticePlanner.tsx: map non-existent generateSmartPractice → generatePracticePlan. https://claude.ai/code/session_01R7wcmQQLSC2pNoemAUJwwT
…tions Add .d.ts stubs for all untyped JS components (Field, DebugPanel, PlayLibrary, PlayController, and 8 sub-components) so TypeScript strict mode accepts them without allowJs. Field.js: copy of colon-named ':components:SmartPlaybook:Field.js' to a valid filename that can be imported on all platforms. DebugPanel.js: fix React Hooks rules violation — move all useCallback/ useMemo hooks before early-return prop validation guards. SmartPlaybook.tsx: add type annotations to all useState calls and callback parameters; fix mode narrowing bug; fix TouchEvent/MouseEvent types. TouchOptimizedPlaybook.tsx: fix styled-jsx → <style>; fix typed updater. CanvasArea.tsx: fix import from colon-named file to '../Field'. https://claude.ai/code/session_01R7wcmQQLSC2pNoemAUJwwT
OnboardingModal.tsx, PWAInstallPrompt.tsx: replace Next.js <style jsx> with plain <style> (styled-jsx is not valid in CRA TypeScript projects). PWAInstallPrompt.tsx: fix Navigator.standalone type with intersection cast. package-lock.json: npm audit fix --legacy-peer-deps — reduced from 24 vulnerabilities (1 critical, 14 high) to 11 (8 high, 3 moderate). Remaining vulns are in webpack-dev-server, fixable only via --force (would install react-scripts@0.0.0 — deferred to next session). https://claude.ai/code/session_01R7wcmQQLSC2pNoemAUJwwT
react-scripts v5 auto-detects tailwind.config.js and injects
require('tailwindcss') as a PostCSS plugin. Tailwind v4 throws when
used directly as a plugin (v4 requires @tailwindcss/postcss).
Deleting this file removes the auto-detection trigger.
https://claude.ai/code/session_01R7wcmQQLSC2pNoemAUJwwT
❌ Deploy Preview for magical-starlight-0c1207 failed.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new stateless
Fieldcanvas component for the Smart Playbook and resolves critical Firebase configuration and environment variable issues across the codebase.Key Changes
New Components
src/components/SmartPlaybook/Field.js– Stateless, memoized canvas component for rendering football field, players, and routesReact.memoanduseCallbackfor performanceEnvironment & Configuration
src/config/env.ts(new) – Centralized environment variable validationREACT_APP_*prefixed variables (CRA standard)validateFirebaseConfig()function to check Firebase setupfirebaseConfigobject for Firebase initializationimport.meta.env.VITE_*calls throughout codebasesrc/services/firebase.ts– Refactored to use centralized env configsrc/config/envinstead of usingNEXT_PUBLIC_*prefixvalidateFirebaseConfig()checkauth/invalid-api-keycrashes in test environmentssrc/services/firestore.ts– Updated to use centralized env configfirebaseConfigandvalidateFirebaseConfigfromsrc/config/envonAuthStateChangedbehind null checkBug Fixes
Environment variable prefix corrections across multiple files:
src/ai-brain/AIContext.tsx– ChangedVITE_OPENAI_API_KEYtoREACT_APP_OPENAI_API_KEYsrc/services/ai-proxy.ts– Fixed AI proxy token env varsrc/services/push-notifications.ts– Fixed VAPID key env varsrc/components/ErrorBoundary.tsx– Fixed version env varsrc/components/FirebaseTest.tsx– Fixed environment detectionsrc/components/IntegrationTest.tsx– Fixed environment detectionTypeScript/React fixes:
src/components/SmartPlaybook/DebugPanel.js– Fixed Rules of Hooks violations (moved prop validation after hook calls)src/components/SmartPlaybook/SmartPlaybook.tsx– Added proper type annotations to state variablessrc/components/SmartPlaybook/TouchOptimizedPlaybook.tsx– Fixed type casting in setStatesrc/hooks/useAuth.tsx– Added missing React importsrc/contexts/TeamContext.tsx– Added null-safety guards for Firebase servicessrc/components/AuthProvider.tsx– Fixed to useauthfromservices/firebaseinstead of callinggetAuth()directlyTest configuration:
src/setupTests.ts– Addedwindow.matchMediamock for jsdom compatibilitysrc/App.test.tsx– Fixed to usegetAllByTextfor multiple matching elementsBuild configuration:
tailwind.config.js(removed Tailwind v4 + react-scripts auto-detection conflict)src/index.cssto use Tailwind v4@importsyntaxtsconfig.jsonto exclude 9+ legacy/orphaned files causing 166+ TS errorsType Definitions
Added
.d.tsdeclaration files for JavaScript components:src/components/SmartPlaybook/Field.d.tssrc/components/SmartPlaybook/DebugPanel.d.tshttps://claude.ai/code/session_01R7wcmQQLSC2pNoemAUJwwT