Fix mobile CodeEditor to get latest code on Run click
Mahdi Naser Moghadasi
ba19790
- Add codeMirrorViewRef to store CodeMirror view instance
- Update getCurrentCode() to read directly from view.state.doc (like Monaco)
- Add extensions to capture view instance on focus and update
- Keep codeMirrorRef as fallback for reliability
- This ensures mobile version always gets latest code, matching desktop behavior
Get latest code directly from editor on Run/Submit/Interview Helper clicks
Mahdi Naser Moghadasi
0d3f3be
- Add CodeEditorRef interface and forwardRef to CodeEditor component
- Expose getCurrentCode() method to read code directly from editor
- Update handleRun, handleSubmit, and openAIHelperPanel to get code from editor ref
- Update code state immediately so AIAssistantChat receives latest code
- Track CodeMirror value in ref for mobile editor
- Get Monaco editor value directly from editor instance for desktop
- Ensures LLM always receives the latest code from editor, not stale state
- Fixes issue where LLM wasn't getting the current code on button clicks
Fix mobile CodeMirror editor background color to match desktop dark theme
Mahdi Naser Moghadasi
d9de1bc
- Add !important flags to ensure dark background (#1e1e1e) is applied
- Add explicit background color to .cm-editor, .cm-content, .cm-scroller
- Add Tailwind classes to wrapper div to force dark background
- Ensure mobile editor has same dark background as desktop Monaco editor
- Fixes white background issue on mobile code editor
Fix TypeScript build error in CodeEditor syntax highlighting
Mahdi Naser Moghadasi
8590f07
- Remove invalid CodeMirror highlight tags (constant, regexp, escape, meta)
- Replace t.constant with t.literal (valid tag)
- Keep only valid @lezer/highlight tags
- Fixes build error: Type '(tag: Tag) => Tag' is not assignable to type 'Tag | readonly Tag[]'
- Build now compiles successfully
Match mobile CodeMirror syntax highlighting colors to desktop Monaco vs-dark theme
Mahdi Naser Moghadasi
16b584f
- Enhanced syntax highlighting with all Monaco vs-dark color mappings
- Added missing color tags (typeName, namespace, constant, regexp, escape, meta)
- Improved theme styling to match Monaco exactly (font, padding, line height)
- Mobile editor now has identical syntax coloring as desktop
- Ensures consistent code appearance across all devices
Remove final JavaScript and C++ references from dropdown and Monaco Editor
Mahdi Naser Moghadasi
94bc8a6
- Remove javascript and cpp options from language selector dropdown
- Remove cpp-specific language prop handling in Monaco Editor
Complete removal of JavaScript and C++ from CodeEditor
Mahdi Naser Moghadasi
1a2a28c
- Remove javascript and cpp from getCodeMirrorLanguage switch
- Remove javascript and cpp from getLanguageName
- Remove javascript and cpp from language selector dropdown
- Remove cpp-specific language prop handling in Monaco Editor
Remove remaining JavaScript and C++ references from CodeEditor
Mahdi Naser Moghadasi
b890cbb
- Remove javascript and cpp from languageMap
- Remove javascript and cpp from getCodeMirrorLanguage switch
- Remove javascript and cpp from getLanguageName
- Remove javascript and cpp from language selector dropdown
- Remove cpp-specific language prop handling
- Remove javascript and cpp cases from code-templates
- Remove javascript and cpp function name extraction from llmChecker
- Fixes build error: 'javascript' does not exist in type 'Record<SupportedLanguage, string>'
Simplify to support only Python and Java languages
Mahdi Naser Moghadasi
9d69b49
- Remove JavaScript and C++ from SupportedLanguage type
- Remove JavaScript and C++ from CodeEditor language selector
- Remove JavaScript and C++ code templates
- Remove JavaScript and C++ function name extraction patterns
- Remove JavaScript and C++ from execution endpoint routing
- Keep only Python and Java support for simplicity
Fix type declaration conflict: consolidate SupportedLanguage type definition
Mahdi Naser Moghadasi
ca10648
Fix TypeScript error: use type assertion for window.monaco
Mahdi Naser Moghadasi
aaf3aaf
Add multi-language support (Python, JavaScript, Java, C++)
Mahdi Naser Moghadasi
fe2a1b2
- Add language selector dropdown to CodeEditor
- Create execution API endpoints for JavaScript, Java, and C++
- Update Dockerfile to install Java (openjdk17) and C++ (g++) compilers
- Update code execution logic to route based on selected language
- Add syntax highlighting for all supported languages in Monaco and CodeMirror
- Update executeAndCheckWithLLM to support all languages
- Extract function names based on language syntax
- Update handleRun and handleSubmit to use language-aware execution
Add custom Monaco vs-dark theme for mobile CodeMirror editor
Mahdi Naser Moghadasi
7ccd9fb
- Created monacoDarkTheme to match Monaco Editor's vs-dark background and colors
- Created monacoHighlightStyle with colors matching Monaco Editor:
- Keywords (def, pass): #569cd6 (light blue)
- Function names: #dcdcaa (yellow/beige)
- Comments: #6a9955 (green)
- Strings: #ce9178 (orange/brown)
- Variables: #9cdcfe (light blue)
- Brackets: #ffd700 (yellow)
- Mobile editor now has same syntax highlighting colors as desktop
- Removed duplicate imports
Add flex container styling for desktop editor to fix sizing
Mahdi Naser Moghadasi
78bd015
Fix desktop Monaco Editor sizing: use 100% height and proper container layout
Mahdi Naser Moghadasi
323d95b
- Changed Monaco Editor height from fixed pixels to 100% to fill container
- Added flex container styling for desktop to ensure proper layout
- Added CSS to ensure Monaco Editor and scrollable element fill container height
- Added layout() call in onMount to force proper sizing
- This should fix the issue where typing area is smaller than editor layout
Fix: isolate mobile CSS changes from desktop Monaco Editor
Mahdi Naser Moghadasi
3dcfed4
The issue was CSS classes applied to the shared container affecting desktop:
- Moved Monaco-specific CSS (scroll-decoration fix) to desktop-only wrapper div
- Mobile CodeMirror wrapper remains separate with its own CSS
- Desktop Monaco Editor now has its own isolated container
- This ensures mobile changes don't affect desktop editor rendering
Add scrollbar options to Monaco Editor to fix scroll-decoration issue
Mahdi Naser Moghadasi
fd1829d
- Added scrollbar configuration to disable shadows
- This should prevent scroll-decoration from covering the code
- CSS class already hides scroll-decoration element
Fix desktop Monaco Editor: hide scroll-decoration element covering code
Mahdi Naser Moghadasi
e4506bf
- Added CSS to hide scroll-decoration element that was blocking code view
- Added scrollbar options to disable shadows that might cause issues
- This should fix the issue where scroll-decoration div was covering the code area
Restore desktop Monaco Editor to simple original configuration
Mahdi Naser Moghadasi
a51f27e
- Removed all complex scroll manipulation code that was breaking desktop
- Restored simple onMount that just stores editor reference
- Simplified useEffect to basic value update (Monaco's value prop handles display)
- Removed container styling changes that affected desktop
- Desktop editor now works exactly as before mobile changes
- Mobile CodeMirror remains unchanged and separate
- Added setScrollTop(0) and setScrollLeft(0) in useEffect
- Multiple scroll resets to ensure code is fully visible
- This should fix the issue where code is cut off at the top
Fix desktop Monaco Editor: fix code being cut off at top
Mahdi Naser Moghadasi
099e85a
- Added setScrollTop(0) and setScrollLeft(0) to reset scroll position
- Added revealLineInCenter for better initial positioning
- Enhanced container styling with proper overflow handling
- Multiple scroll reset calls to ensure code is fully visible
- This should fix the issue where code is vertically cut off
Remove key prop from Monaco Editor to prevent re-render issues
Mahdi Naser Moghadasi
1c941b0
- Key prop was causing editor to remount unnecessarily
- Value prop and useEffect should handle code updates
- This should fix the empty editor issue on desktop
Critical fixes:
- Always set code value in onMount (removed conditional check)
- Enhanced useEffect to update code even when editor is empty
- Added layout() call to force editor to render properly
- Removed key prop that might have been causing re-render issues
- Code should now always be visible on desktop
Fix desktop editor container layout to ensure code is visible
Mahdi Naser Moghadasi
3c5ee5f
- Added flex display to desktop editor container
- This ensures Monaco Editor renders correctly within the container
- Code should now be properly visible in the viewport
Fix desktop Monaco Editor: scroll to top and position cursor correctly
Mahdi Naser Moghadasi
419b324
- Added setPosition and revealLine to ensure editor scrolls to top on mount
- Cursor positioned at line 1, column 1 when editor initializes
- Code should now be visible in the editor viewport
Add key prop to Monaco Editor to force re-render when code changes
Mahdi Naser Moghadasi
8286756
- Added key prop based on code content to ensure editor updates
- This should fix the issue where code doesn't display on desktop
- Editor will now properly show starter code when question is selected
Fix desktop Monaco Editor: ensure code displays on mount
Mahdi Naser Moghadasi
51fee5f
- Added setValue call in onMount to ensure code is displayed when editor initializes
- This fixes the issue where editor appears empty on desktop
- Code should now properly display with syntax highlighting
Update useEffect to use nullish coalescing for consistency
Mahdi Naser Moghadasi
4629857
Fix desktop Monaco Editor: ensure code value is properly displayed
Mahdi Naser Moghadasi
1d780c4
- Changed value prop from 'code ||' to 'code ??' for better null handling
- Removed setValue call from onMount (value prop should handle it)
- Improved useEffect to use nullish coalescing for code updates
- Monaco Editor should now properly display starter code on desktop
Fix desktop editor: remove mobile-specific styling that affected desktop
Mahdi Naser Moghadasi
a6d6f01
- Removed mobile height constraint from main container (only applies to mobile now)
- Desktop editor (Monaco) now works exactly as before
- Mobile editor (CodeMirror) remains with syntax highlighting and autocomplete
- Desktop version is completely unaffected by mobile changes
Fix CodeMirror syntax highlighting on mobile
Mahdi Naser Moghadasi
5b2b0ac
- Moved theme from prop to extensions array (required for @uiw/react-codemirror)
- Added proper CSS classes for full height rendering
- Theme (oneDark) now properly applied in extensions
- Python syntax highlighting should now work correctly on mobile
Add CodeMirror editor for mobile with Python syntax highlighting and autocomplete
Mahdi Naser Moghadasi
f5cda12
Mobile Editor Enhancements:
- Replaced plain textarea with CodeMirror editor on mobile
- Added Python syntax highlighting using @codemirror/lang-python
- Enabled autocomplete with @codemirror/autocomplete
- Applied oneDark theme to match the dark UI
- CodeMirror has better mobile support than Monaco Editor
- Auto-suggestions activate on typing
- Proper code coloring for Python keywords, strings, functions, etc.
Features:
- Syntax highlighting for Python code
- Auto-completion for Python keywords and functions
- Better mobile keyboard interaction
- Maintains same height (400px) and styling
Update mobile editor container height to 450px to match editor size
Mahdi Naser Moghadasi
0b0d2be
Fix mobile editor container height to match increased editor size
Mahdi Naser Moghadasi
142c4ef
Improve mobile editor and enhance Reddit traffic tracking
Mahdi Naser Moghadasi
87d5cd8
Mobile Editor improvements:
- Increased editor height from 250px to 400px (keeping width same)
- Editor container now 450px total (400px editor + 50px toolbar)
- Textarea properly displays initial code (starterCode)
- Textarea is focusable and will open keyboard on click/tap
- Better mobile editing experience
Reddit Traffic Tracking:
- Enhanced categorizeReferrer to check UTM parameters first
- Reddit ads using utm_source=reddit will now be properly categorized
- Dashboard now highlights Reddit traffic with success message
- Reddit entries highlighted in orange (#FF4500) in charts
- Both referrer (reddit.com) and UTM source (reddit) are tracked
Replace Monaco Editor with textarea on mobile for better compatibility
Mahdi Naser Moghadasi
f25bf7c
Monaco Editor is not officially supported on mobile browsers and causes empty editor issues. This change:
- Uses a native textarea element on mobile devices (< 640px width)
- Keeps Monaco Editor for desktop for full feature support
- Textarea has proper styling to match the dark theme
- Code value is properly displayed and editable on mobile
- Fixes the empty editor issue on mobile devices
Add key prop to Monaco Editor on mobile to force re-render when code changes
Mahdi Naser Moghadasi
3e6ff1b
- Added key prop based on code content to ensure editor updates when code changes
- This should fix the issue where editor appears empty on mobile
- Editor will now properly display starter code when question is selected
Fix empty editor on mobile: ensure code value is properly displayed
Mahdi Naser Moghadasi
593dbbb
- Changed value prop from 'code ||' to 'code ??' for better null handling
- Removed key prop that might have been causing re-render issues
- Ensured Monaco Editor receives code value correctly on mobile
- Editor should now display starter code when question is selected
Fix mobile editor and button improvements
Mahdi Naser Moghadasi
dae6603
Button fixes:
- Changed 'New' to 'Next Q' on mobile to better reflect getting a new question
- Made Home button same size as Next Q button (both flex-1 on mobile)
- Both buttons now have equal width on mobile
Editor fixes for mobile:
- Separated mobile and desktop Monaco Editor configurations
- Added explicit value prop with fallback to empty string
- Added readOnly: false and domReadOnly: false to ensure editor is editable
- Set explicit height as string '250' for mobile
- Added position: relative and width: 100% to container
- Added loading component for better mobile initialization
- Ensured editor displays code and accepts input on mobile
Fix mobile layout: header buttons overflow and editor visibility
Mahdi Naser Moghadasi
a7e3e0f
Header fixes:
- Made header responsive with flex-col on mobile, flex-row on desktop
- Reduced padding on mobile (px-3 sm:px-4)
- Made buttons wrap properly on mobile
- 'New Problem' shows as 'New' on mobile to save space
- Progress bar hidden on very small screens
- Buttons now fit within screen width, no horizontal scroll
Editor fixes:
- Added explicit height constraints (min/max) on mobile
- Added overflow-hidden to prevent content from breaking layout
- Editor height set to 250px on mobile (300px container - 50px toolbar)
- Fixed editor visibility and typing capability on mobile
- Editor now properly displays code and accepts input
Fix code editor resizing on mobile when keyboard appears
Mahdi Naser Moghadasi
ba131d1
- Set fixed height (300px) for editor container on mobile
- Disable automaticLayout on mobile to prevent resize when keyboard appears
- Fixed height prevents editor from growing when focus changes
- Editor maintains consistent size regardless of keyboard state
- Desktop behavior unchanged (flexible height)
Fix Interview Helper for mobile and enable auto-complete
Mahdi Naser Moghadasi
b79760d
Mobile Interview Helper improvements:
- Position at bottom of page on mobile (50% from top, full width)
- Disable resizing on mobile for better UX
- Full width on mobile devices
- 50% screen height on mobile (bottom half)
Code Editor auto-complete:
- Enabled quickSuggestions
- Enabled suggestOnTriggerCharacters
- Enabled acceptSuggestionOnEnter
- Enabled tabCompletion
- Enabled wordBasedSuggestions
- Enabled parameterHints
- Configured snippetSuggestions
Make coding practice page mobile-responsive
Mahdi Naser Moghadasi
26704d7
- Reduced layout height on mobile (h-auto instead of fixed calc)
- Reduced padding and spacing throughout (p-4 sm:p-6, gap-4 sm:gap-6)
- Made question display more compact on mobile:
- Smaller font sizes (text-xl sm:text-2xl)
- Reduced padding (p-4 sm:p-6)
- Smaller badges and tags
- Flex-wrap for tags on mobile
- Made code editor more mobile-friendly:
- Smaller min-height on mobile (300px vs 400px)
- Smaller font size on mobile (12px vs 14px)
- Hide line numbers on very small screens
- Smaller toolbar buttons and icons
- Made Interview Helper button more compact on mobile (shows 'Helper' instead of full text)
- Reduced container padding on mobile (px-3 sm:px-4)
- All responsive breakpoints use sm: (640px) for better mobile experience
Add product tour for practice/coding page
Mahdi Naser Moghadasi
988d1ad
- Added practiceTourSteps with 6 steps covering all key elements
- Tour highlights: question display, code editor, run/submit buttons, ask question, deep discussion, new problem
- Added IDs to all tour target elements
- Tour button appears in header when on practice page
- Tour auto-starts once on first visit (after signup modal)
- Tour can be manually started via Tour button
- Uses separate localStorage key (practiceTourCompleted) from home page tour
- Prevents overlap with signup modal
- Same spotlight effect and tooltip styling as home page tour
Add CodePractice AI application with Docker support