This completes the integration of the cross-platform translation engine
into the main application, making it fully functional.
App.tsx Changes:
- Added platform state management (currentPlatform: PlatformId)
- Added translation panel state (showTranslation)
- Integrated TranslationPanel component with lazy loading
- Updated Toolbar with platform selector and translate button
- Passed platform prop to TemplatesDrawer and CodeEditor
- Connected all state management for seamless platform switching
TemplatesDrawer Changes:
- Now accepts currentPlatform prop
- Filters templates by selected platform using getTemplatesForPlatform()
- Shows platform icon and name in header
- Displays template count for current platform
- Ready for UEFN/Spatial/Core templates
CodeEditor Changes:
- Accepts optional platform prop (defaults to 'roblox')
- Dynamically sets Monaco editor language based on platform:
* roblox → lua
* uefn → plaintext (Verse not yet in Monaco)
* spatial → typescript
* core → lua
- Maintains backward compatibility with existing code
Functional Features:
✅ Platform switching in toolbar
✅ Templates filter by platform automatically
✅ Editor language changes with platform
✅ Translation panel opens with "Translate" button
✅ Side-by-side code comparison
✅ Mock translation working
✅ All state connected and reactive
Next: Phase 3 (Create UEFN templates) or Phase 4 (Claude API integration)
Successfully merged latest changes from main while preserving all bug fixes:
Preserved Bug Fixes:
- window.spark null checks in AIChat.tsx (line 36-38)
- window.spark null checks in Toolbar.tsx (line 28)
- window guard in CodeEditor.tsx minimap (line 49)
- Ref type fix in ConsolePanel.tsx
- Checkbox type fixes in NewProjectModal.tsx
- Window guards in use-mobile.ts, sidebar.tsx
- Silent error handling in tailwind.config.js
New Features from Main:
- Enhanced AI prompt with code completion support
- Code syntax highlighting in AI responses
- Improved editor styling and scrollbar customization
- New education, analytics, and collaboration panels
- PostHog and Sentry integration
- Passport authentication
- Asset library and certification features
All merge conflicts resolved with both security fixes and new features intact.
This commit addresses 21+ bugs identified in the codebase scan:
High Severity Fixes:
- Add window.spark null checks in Toolbar.tsx and AIChat.tsx to prevent crashes
- Fix ref type mismatch in ConsolePanel.tsx by using scrollIntoView pattern
- Fix checkbox type casting in NewProjectModal.tsx (handle 'indeterminate' state)
Medium Severity Fixes:
- Add window guards for SSR safety in use-mobile.ts hook
- Add window guards in CodeEditor.tsx for minimap configuration
- Add window guards in sidebar.tsx for keyboard event listeners
- Remove console.error from AIChat.tsx (already has toast notifications)
- Replace console.error with silent fallback in tailwind.config.js
These improvements enhance:
1. Runtime safety - no more crashes from undefined window.spark
2. Type safety - proper handling of Radix UI checkbox states
3. SSR compatibility - all window accesses are now guarded
4. User experience - better error handling with toast notifications
All changes maintain backward compatibility and existing functionality.