Spaces:
Runtime error
Runtime error
update sidebar resizing
Browse filesFiles changed (2)
125 unmodified lines126127128125 unmodified linesanimation: fade-in 0.3s ease-in-out;}125 unmodified lines126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192125 unmodified linesanimation: fade-in 0.3s ease-in-out;}/* Resize handle styles */.resize-handle {position: relative;width: 4px;cursor: col-resize;user-select: none;background: transparent;transition: background-color 0.2s ease, width 0.15s ease;flex-shrink: 0;display: flex;align-items: center;justify-content: center;}/* Clickable area (extends beyond visible width) */.resize-handle::before {content: '';position: absolute;inset: 0;left: -4px;right: -4px;}/* Visual indicator (three dots) */.resize-handle::after {content: '⋮';position: relative;z-index: 1;font-size: 16px;color: rgba(134, 134, 139, 0.4);transition: color 0.2s ease;pointer-events: none;line-height: 1;}.resize-handle:hover {background: rgba(0, 123, 255, 0.2);}.resize-handle:hover::after {color: rgba(0, 123, 255, 0.8);}.resize-handle:active,.resize-handle.resizing {background: rgba(0, 123, 255, 0.4);width: 4px;}.resize-handle:active::after,.resize-handle.resizing::after {color: rgba(0, 123, 255, 1);}/* Prevent text selection during resize */body.resizing {user-select: none !important;cursor: col-resize !important;}body.resizing * {cursor: col-resize !important;}
27 unmodified lines28293031323312 unmodified lines464748495051566 unmodified lines61861962062162262317 unmodified lines64164264364464564664764864965065165265310 unmodified lines66466566666766866967067167267367429 unmodified lines70470570670770870971071171271371471571671771827 unmodified lines// Mobile view state: 'chat', 'editor', or 'settings' - start on chat for mobileconst [mobileView, setMobileView] = useState<'chat' | 'editor' | 'settings'>('chat');// Load messages from localStorage on mount (client-side only to avoid hydration issues)useEffect(() => {12 unmodified linesconsole.error('[localStorage] Failed to parse saved messages:', e);}}}}, []); // Empty deps = run once on mount566 unmodified linesawait handleSendMessage(prompt, language, modelId);};// Show landing page if no messages and showLandingPage is trueif (showLandingPage && messages.length === 0) {return (17 unmodified lines{/* Apple-style layout - Responsive */}<main className="flex-1 flex overflow-hidden relative">{/* Left Sidebar - Chat Panel (Hidden on mobile, shown when mobileView='chat') */}<div className={`${mobileView === 'chat' ? 'flex' : 'hidden'} md:flexw-full md:w-80bg-[#000000] border-r border-[#424245]/30flex-colabsolute md:relative inset-0 md:inset-auto z-10 md:z-auto`}>{/* Panel Header */}<div className="flex items-center px-4 py-3 bg-[#000000] border-b border-[#424245]/30"><span className="text-sm font-medium text-[#f5f5f7]">Chat</span>10 unmodified lines</div></div>{/* Center - Editor Group (Always visible on mobile when mobileView='editor', always visible on desktop) */}<div className={`${mobileView === 'editor' ? 'flex' : 'hidden'} md:flexflex-1 flex-col bg-[#000000]absolute md:relative inset-0 md:inset-auto z-10 md:z-auto`}>{/* Tab Bar */}<div className="flex items-center px-4 h-10 bg-[#1d1d1f] border-b border-[#424245]/30">29 unmodified lines</div></div>{/* Right Sidebar - Configuration Panel (Hidden on mobile, shown when mobileView='settings') */}<div className={`${mobileView === 'settings' ? 'flex' : 'hidden'} md:flexw-full md:w-72bg-[#000000] border-l border-[#424245]/30overflow-y-autoabsolute md:relative inset-0 md:inset-auto z-10 md:z-autoflex-col`}><ControlPanelselectedLanguage={selectedLanguage}selectedModel={selectedModel}27 unmodified lines2829303132333435363738394012 unmodified lines5354555657585960616263646566676869707172737475767778566 unmodified lines64564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670717 unmodified lines72572672772872973073173273373473573673773873974074110 unmodified lines75275375475575675775875976076176276376476576676776876977077129 unmodified lines80180280380480580680780880981081181281381481581681781881982082182282382482582627 unmodified lines// Mobile view state: 'chat', 'editor', or 'settings' - start on chat for mobileconst [mobileView, setMobileView] = useState<'chat' | 'editor' | 'settings'>('chat');// Resizable sidebar widths (in pixels)const [chatSidebarWidth, setChatSidebarWidth] = useState(320);const [settingsSidebarWidth, setSettingsSidebarWidth] = useState(288);const [isResizingChat, setIsResizingChat] = useState(false);const [isResizingSettings, setIsResizingSettings] = useState(false);const [isDesktop, setIsDesktop] = useState(false);// Load messages from localStorage on mount (client-side only to avoid hydration issues)useEffect(() => {12 unmodified linesconsole.error('[localStorage] Failed to parse saved messages:', e);}}// Load sidebar widths from localStorageconst savedChatWidth = localStorage.getItem('anycoder_chat_sidebar_width');const savedSettingsWidth = localStorage.getItem('anycoder_settings_sidebar_width');if (savedChatWidth) {setChatSidebarWidth(parseInt(savedChatWidth, 10));}if (savedSettingsWidth) {setSettingsSidebarWidth(parseInt(savedSettingsWidth, 10));}// Check if desktop on mountconst checkDesktop = () => {setIsDesktop(window.innerWidth >= 768);};checkDesktop();// Listen for window resize to update desktop statuswindow.addEventListener('resize', checkDesktop);return () => window.removeEventListener('resize', checkDesktop);}}, []); // Empty deps = run once on mount566 unmodified linesawait handleSendMessage(prompt, language, modelId);};// Resize handlers for chat sidebar (desktop only)const startResizingChat = () => {if (isDesktop) {setIsResizingChat(true);}};const startResizingSettings = () => {if (isDesktop) {setIsResizingSettings(true);}};// Handle mouse move for resizing (desktop only)useEffect(() => {const handleMouseMove = (e: MouseEvent) => {if (!isDesktop) return; // Skip on mobileif (isResizingChat) {const newWidth = Math.min(Math.max(e.clientX, 250), 600); // Min 250px, max 600pxsetChatSidebarWidth(newWidth);}if (isResizingSettings) {const newWidth = Math.min(Math.max(window.innerWidth - e.clientX, 220), 500); // Min 220px, max 500pxsetSettingsSidebarWidth(newWidth);}};const handleMouseUp = () => {if (isResizingChat) {setIsResizingChat(false);// Save to localStoragelocalStorage.setItem('anycoder_chat_sidebar_width', chatSidebarWidth.toString());document.body.classList.remove('resizing');}if (isResizingSettings) {setIsResizingSettings(false);// Save to localStoragelocalStorage.setItem('anycoder_settings_sidebar_width', settingsSidebarWidth.toString());document.body.classList.remove('resizing');}};if (isResizingChat || isResizingSettings) {document.addEventListener('mousemove', handleMouseMove);document.addEventListener('mouseup', handleMouseUp);// Add resizing class to body for cursor and selection stylesdocument.body.classList.add('resizing');}return () => {document.removeEventListener('mousemove', handleMouseMove);document.removeEventListener('mouseup', handleMouseUp);document.body.classList.remove('resizing');};}, [isResizingChat, isResizingSettings, chatSidebarWidth, settingsSidebarWidth, isDesktop]);// Show landing page if no messages and showLandingPage is trueif (showLandingPage && messages.length === 0) {return (17 unmodified lines{/* Apple-style layout - Responsive */}<main className="flex-1 flex overflow-hidden relative">{/* Left Sidebar - Chat Panel (Hidden on mobile, shown when mobileView='chat') */}<divclassName={`${mobileView === 'chat' ? 'flex' : 'hidden'} md:flexw-fullbg-[#000000] border-r border-[#424245]/30flex-colabsolute md:relative inset-0 md:inset-auto z-10 md:z-automd:flex-shrink-0`}style={isDesktop ? { width: `${chatSidebarWidth}px` } : undefined}>{/* Panel Header */}<div className="flex items-center px-4 py-3 bg-[#000000] border-b border-[#424245]/30"><span className="text-sm font-medium text-[#f5f5f7]">Chat</span>10 unmodified lines</div></div>{/* Resize Handle for Chat Sidebar (Desktop only) */}<divclassName={`hidden md:block resize-handle ${isResizingChat ? 'resizing' : ''}`}onMouseDown={startResizingChat}title="Drag to resize chat panel"/>{/* Center - Editor Group (Always visible on mobile when mobileView='editor', always visible on desktop) */}<div className={`${mobileView === 'editor' ? 'flex' : 'hidden'} md:flexflex-1 flex-col bg-[#000000]absolute md:relative inset-0 md:inset-auto z-10 md:z-automd:min-w-0 overflow-hiddenw-full`}>{/* Tab Bar */}<div className="flex items-center px-4 h-10 bg-[#1d1d1f] border-b border-[#424245]/30">29 unmodified lines</div></div>{/* Resize Handle for Settings Sidebar (Desktop only) */}<divclassName={`hidden md:block resize-handle ${isResizingSettings ? 'resizing' : ''}`}onMouseDown={startResizingSettings}title="Drag to resize settings panel"/>{/* Right Sidebar - Configuration Panel (Hidden on mobile, shown when mobileView='settings') */}<divclassName={`${mobileView === 'settings' ? 'flex' : 'hidden'} md:flexw-fullbg-[#000000] border-l border-[#424245]/30overflow-y-autoabsolute md:relative inset-0 md:inset-auto z-10 md:z-autoflex-colmd:flex-shrink-0`}style={isDesktop ? { width: `${settingsSidebarWidth}px` } : undefined}><ControlPanelselectedLanguage={selectedLanguage}selectedModel={selectedModel}
frontend/src/app/globals.css+64
frontend/src/app/page.tsx+123-15