{/* Background Wallpaper image */}
@@ -331,12 +336,16 @@ export default function App() { openWindow('companion')} /> {/* Expedition Onboarding & Fast-Track Checklist Modal */} - setIsOnboardingOpen(false)} - onCompleted={triggerRefreshExplorer} - userId={user?.id || 'sandbox'} - /> + {isOnboardingOpen && ( + + setIsOnboardingOpen(false)} + onCompleted={triggerRefreshExplorer} + userId={user?.id || 'sandbox'} + /> + + )} {/* Retro Desktop Context Menu */} handleWallpaperChange(e, closeContextMenu)} className="hidden" /> -
+ ); } diff --git a/algospaced-ui/src/assets/hero.webp b/algospaced-ui/src/assets/hero.webp new file mode 100644 index 0000000000000000000000000000000000000000..74d13a254f2622e5bfbe1b7d424033f8ac8f3f49 --- /dev/null +++ b/algospaced-ui/src/assets/hero.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06bcb6c371a580abacfbd9dd7d1464bcf753d6845d1555b3f037115f2fd60bce +size 12872 diff --git a/algospaced-ui/src/components/Auth.tsx b/algospaced-ui/src/components/Auth.tsx index 2236ffc7ca603011580fda9f17f29077c2aecddd..6c63c696e97197e94f43fae2ce082c906703ffff 100644 --- a/algospaced-ui/src/components/Auth.tsx +++ b/algospaced-ui/src/components/Auth.tsx @@ -66,13 +66,14 @@ export default function Auth() { setIsSignUp(false); setPassword(''); setConfirmPassword(''); - } catch (err: any) { - let errMsg = err.message || 'An error occurred during registration.'; - if (err.code === 'auth/email-already-in-use') { + } catch (err: unknown) { + const error = err as { code?: string; message?: string }; + let errMsg = error.message || 'An error occurred during registration.'; + if (error.code === 'auth/email-already-in-use') { errMsg = 'This email address is already registered. Please sign in instead.'; - } else if (err.code === 'auth/invalid-email') { + } else if (error.code === 'auth/invalid-email') { errMsg = 'The email address format is invalid.'; - } else if (err.code === 'auth/weak-password') { + } else if (error.code === 'auth/weak-password') { errMsg = 'Firebase requires a stronger password.'; } setMessage({ type: 'error', text: errMsg }); @@ -83,17 +84,18 @@ export default function Auth() { // Sign In try { await authService.signInWithEmail(trimmedEmail, password); - } catch (err: any) { - if (err.code === 'auth/email-not-verified') { + } catch (err: unknown) { + const error = err as { code?: string; message?: string }; + if (error.code === 'auth/email-not-verified') { setMessage({ type: 'unverified', text: 'Your email address is not verified yet. Please check your inbox for the activation link.', }); } else { - let errMsg = err.message || 'An error occurred during sign in.'; - if (err.code === 'auth/invalid-credential' || err.code === 'auth/user-not-found' || err.code === 'auth/wrong-password') { + let errMsg = error.message || 'An error occurred during sign in.'; + if (error.code === 'auth/invalid-credential' || error.code === 'auth/user-not-found' || error.code === 'auth/wrong-password') { errMsg = 'Invalid email or password. Please check your credentials.'; - } else if (err.code === 'auth/too-many-requests') { + } else if (error.code === 'auth/too-many-requests') { errMsg = 'Access temporarily locked due to many failed attempts. Try again later or reset password.'; } setMessage({ type: 'error', text: errMsg }); @@ -120,10 +122,11 @@ export default function Auth() { type: 'success', text: `Verification email resent to ${email.trim()}! Please check your inbox and spam folder.`, }); - } catch (err: any) { + } catch (err: unknown) { + const error = err as { message?: string }; setMessage({ type: 'error', - text: err.message || 'Failed to resend verification email. Check your credentials.', + text: error.message || 'Failed to resend verification email. Check your credentials.', }); } finally { setResendingVerification(false); @@ -135,8 +138,9 @@ export default function Auth() { setLoading(true); setMessage(null); await authService.signInWithGoogle(); - } catch (err: any) { - setMessage({ type: 'error', text: err.message || 'Google Sign-In failed to initialize' }); + } catch (err: unknown) { + const error = err as { message?: string }; + setMessage({ type: 'error', text: error.message || 'Google Sign-In failed to initialize' }); setLoading(false); } }; @@ -146,20 +150,19 @@ export default function Auth() { }; return ( -
+
{/* Background Wallpaper image */}
{/* OS System Setup Dialog Box */}
{/* Title Bar */} -
+
sports_esports @@ -206,7 +209,7 @@ export default function Auth() { }} className={`flex-1 py-2 sm:py-2.5 border-[3px] border-ink-black cursor-pointer font-bold tracking-wider outline-none transition-all shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none active:translate-y-0.5 ${!isSignUp ? 'bg-secondary-container text-ink-black translate-y-0.5 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]' - : 'bg-white text-trash-gray hover:bg-surface-container' + : 'bg-white text-slate-700 hover:bg-surface-container' }`} > SIGN IN @@ -218,7 +221,7 @@ export default function Auth() { }} className={`flex-1 py-2 sm:py-2.5 border-[3px] border-ink-black cursor-pointer font-bold tracking-wider outline-none transition-all shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none active:translate-y-0.5 ${isSignUp ? 'bg-secondary-container text-ink-black translate-y-0.5 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]' - : 'bg-white text-trash-gray hover:bg-surface-container' + : 'bg-white text-slate-700 hover:bg-surface-container' }`} > CREATE ACCOUNT @@ -252,30 +255,34 @@ export default function Auth() {
- +
setEmail(e.target.value)} placeholder="name@arcade.com" + aria-label="Email Address" className="w-full bg-white border-[3px] border-ink-black rounded-lg py-2 sm:py-2.5 pl-9 sm:pl-10 pr-3 sm:pr-4 text-ink-black placeholder-trash-gray focus:outline-none focus:bg-white text-xs sm:text-sm font-code-mono shadow-[inset_2px_2px_0px_rgba(0,0,0,0.1)]" />
- +
setPassword(e.target.value)} placeholder="••••••••" + aria-label="Password" className="w-full bg-white border-[3px] border-ink-black rounded-lg py-2 sm:py-2.5 pl-9 sm:pl-10 pr-3 sm:pr-4 text-ink-black placeholder-trash-gray focus:outline-none focus:bg-white text-xs sm:text-sm font-code-mono shadow-[inset_2px_2px_0px_rgba(0,0,0,0.1)]" />
@@ -284,15 +291,17 @@ export default function Auth() { {isSignUp && ( <>
- +
setConfirmPassword(e.target.value)} placeholder="••••••••" + aria-label="Confirm Password" className="w-full bg-white border-[3px] border-ink-black rounded-lg py-2 sm:py-2.5 pl-9 sm:pl-10 pr-3 sm:pr-4 text-ink-black placeholder-trash-gray focus:outline-none focus:bg-white text-xs sm:text-sm font-code-mono shadow-[inset_2px_2px_0px_rgba(0,0,0,0.1)]" />
diff --git a/algospaced-ui/src/components/FileExplorer.tsx b/algospaced-ui/src/components/FileExplorer.tsx index d4aa6f564abe2760ba36579aedce15da714b303f..8c9d457e75626a21b4f9c8699f061260a3a4f548 100644 --- a/algospaced-ui/src/components/FileExplorer.tsx +++ b/algospaced-ui/src/components/FileExplorer.tsx @@ -27,17 +27,17 @@ interface FileExplorerProps { const WALLPAPER_PRESETS = [ { name: 'Retro Arcade Grid.img', - url: 'https://lh3.googleusercontent.com/aida-public/AB6AXuAMJHVhhK8_G7F8sbhn8F7w4AZWXb1O_-HLKvrZ_fJlbUVMcVuxxEOO_LlOh8qIwtAn2KvzvCwzmtNLLEZ5uYkCEsx8ZWXJR609qgSMRSX8LBBeskk4VzVXnyzsgIKCedeV2PvGxJlUNnledcWKCXqG9egQi8dgTcA7C2z82QyM73KZ4s7ZRzZHNupuQt1ocfcMl9E_x1PWFRridl751LIpyGZgednS5CmVw2rZvFc_tbp2QTxgVHJ_59myEBmy6aajbO06AhkKmCvI', + url: '/wallpapers/default.webp', desc: 'Default AlgoSpaced purple grid and pixel theme background.' }, { name: 'Classic Board Logo.img', - url: 'https://lh3.googleusercontent.com/aida-public/AB6AXuD2tUGA2d7QiNyajDAWYK183zhNTgtAZpOXK3E9wRvHGs-t6ykWt9uPScYe_fziWzQI0pREcY_ThI341WvGMusyYmnAkagfuwx6wubIs1ES68DO8CCNAlcHcb2zOUU4MJeYuhWDy1uYRqyGYjIaDUqfgNWk2vm4WzwRqoorn2dxtZ6QdJhEKbXjG8fG9chkkvr68qJf0fLUL6bIqBXZg2FJ30S7zS3oZ4IZsug-wLyRYuJ4Gu_86snNUo1whNrBdZm5OMREfc9sLbwJ', + url: '/icons/computer.webp', desc: 'System info and arcade machine diagram wallpaper.' }, { name: 'Terminal Console Icon.img', - url: 'https://lh3.googleusercontent.com/aida-public/AB6AXuA2AvcQ2oKWP8AJ8yR5nF82LLDEH1FKySUK-npnqEjvJ6Cs9xp8joCwH7x43oTCAC5xhO2rQdYzka3B6u72FNbdxMnsv3WJLye3bKochu8AnnRlS3szfYSaj724sYsiZo4n8G-oWqvl7C0rOGaDaU2nRH1xXmW2PBi6L2NryTsUaTCVZQKTKBBNNEOig5kh7B52e-iIuj2PTzaSjF9ebp6gMuCnBtJT8Sxo5Qsmvfm-t2U5r_qQpRiYj--Ut41T7NTh-tHgs4S4kBvz', + url: '/icons/terminal.webp', desc: 'Dark retro CRT terminal screen layout.' }, { diff --git a/algospaced-ui/src/components/KatexRenderer.tsx b/algospaced-ui/src/components/KatexRenderer.tsx new file mode 100644 index 0000000000000000000000000000000000000000..1e1e122450ef64ce28003ef3e347340b1b005b8a --- /dev/null +++ b/algospaced-ui/src/components/KatexRenderer.tsx @@ -0,0 +1,39 @@ +import React from 'react'; +import katex from 'katex'; +import 'katex/dist/katex.min.css'; + +export interface KatexRendererProps { + math: string; + displayMode?: boolean; + className?: string; +} + +export const KatexRenderer: React.FC = ({ + math, + displayMode = false, + className = '', +}) => { + let html = ''; + try { + html = katex.renderToString(math.trim(), { + displayMode, + throwOnError: false, + output: 'html', + }); + } catch { + const escaped = math + .replace(/&/g, '&') + .replace(//g, '>'); + html = `${escaped}`; + } + + return ( + + ); +}; + +export default KatexRenderer; diff --git a/algospaced-ui/src/components/MarkdownRenderer.tsx b/algospaced-ui/src/components/MarkdownRenderer.tsx index ac06467fd7d81225088af38922d13a63da172fbb..84c2a31fd3638ee14b95408f68547cdccf1e3611 100644 --- a/algospaced-ui/src/components/MarkdownRenderer.tsx +++ b/algospaced-ui/src/components/MarkdownRenderer.tsx @@ -1,5 +1,7 @@ -import React from 'react'; -import { renderKatex, renderInlineMarkdown } from '../utils/markdownUtils'; +import React, { lazy, Suspense } from 'react'; +import { renderInlineMarkdown } from '../utils/markdownUtils'; + +const KatexRenderer = lazy(() => import('./KatexRenderer')); interface MarkdownRendererProps { content: string; @@ -56,13 +58,15 @@ export const MarkdownRenderer: React.FC = ({ content, cla (trimmedBlock.startsWith('\\[') && trimmedBlock.endsWith('\\]') && trimmedBlock.length >= 4) ) { const math = trimmedBlock.slice(2, -2); - const html = renderKatex(math, true); return (
+ > + {math}}> + + +
); } diff --git a/algospaced-ui/src/components/OnboardingModal.tsx b/algospaced-ui/src/components/OnboardingModal.tsx index 3a6ad060fdf2b02814ec734da87ca03df0a39c70..89f1e608d37c07691023d43c0df1e1f7d4bca04e 100644 --- a/algospaced-ui/src/components/OnboardingModal.tsx +++ b/algospaced-ui/src/components/OnboardingModal.tsx @@ -363,12 +363,14 @@ export default function OnboardingModal({ value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} placeholder="Search by title, number, or pattern..." + aria-label="Search problems by title, number, or pattern" className="w-full pl-8 pr-3 py-1.5 bg-paper-white border-2 border-ink-black font-sans text-xs text-ink-black font-medium outline-none focus:bg-amber-50" /> {searchQuery && ( diff --git a/algospaced-ui/src/components/PrincessDialoguePopup.tsx b/algospaced-ui/src/components/PrincessDialoguePopup.tsx index e67c32bbc42eb95ea6bff561b79bc958108bfde8..04b237c20b1e1ee13c4c0d5dd8f53039334d71ec 100644 --- a/algospaced-ui/src/components/PrincessDialoguePopup.tsx +++ b/algospaced-ui/src/components/PrincessDialoguePopup.tsx @@ -182,8 +182,8 @@ export default function PrincessDialoguePopup({ className="w-full h-full object-cover object-top transition-transform duration-300 group-hover:scale-105 relative z-10" onError={(e) => { const target = e.currentTarget; - if (!target.src.endsWith('/sprites/princess/neutral.png')) { - target.src = '/sprites/princess/neutral.png'; + if (!target.src.endsWith('/sprites/princess/neutral.webp')) { + target.src = '/sprites/princess/neutral.webp'; } else { target.style.display = 'none'; } diff --git a/algospaced-ui/src/components/ReviewQueue.tsx b/algospaced-ui/src/components/ReviewQueue.tsx index d3a55a256a48e366abc3c51a6ae053e39b4fa0b1..384bc705533002dbe0f9b22041545b5968c08703 100644 --- a/algospaced-ui/src/components/ReviewQueue.tsx +++ b/algospaced-ui/src/components/ReviewQueue.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, useCallback, useRef } from 'react'; +import { useState, useEffect, useCallback, useRef, lazy, Suspense } from 'react'; import { RefreshCw, FileText, Code, BookOpen } from 'lucide-react'; import OnboardingModal from './OnboardingModal'; import { findCatalogProblem } from '../services/catalogService'; @@ -8,7 +8,9 @@ import { useReviewQueue } from '../hooks/useReviewQueue'; import { useSandboxRunner } from '../hooks/useSandboxRunner'; import { useAiReviewer } from '../hooks/useAiReviewer'; import { ReviewHeader } from './review/ReviewHeader'; -import { ProblemSpecPanel } from './review/ProblemSpecPanel'; +const ProblemSpecPanel = lazy(() => + import('./review/ProblemSpecPanel').then((m) => ({ default: m.ProblemSpecPanel })) +); import { CodeStudioPanel } from './review/CodeStudioPanel'; import { RatingBar } from './review/RatingBar'; import { EmptyQueueCelebration } from './review/EmptyQueueCelebration'; @@ -423,56 +425,71 @@ export default function ReviewQueue({ {/* 2. MAIN TWO-PANE WORKSTATION */}
- { - setLeftTab(tab); - if (tab === 'ref') setMobileView('ref'); - else if (tab === 'spec') setMobileView('spec'); - }} - mobileView={mobileView} - isNarrow={isNarrow} - problem={effectiveProblem} - parsed={parsed} - userSolution={userSolution} - officialSolution={officialSolution} - effectiveReferenceCode={effectiveReferenceCode} - copiedSnippet={copiedSnippet} - onCopyText={handleCopyText} - saveRefError={saveRefError} - aiSolutionLoading={aiSolutionLoading} - aiSolutionError={aiSolutionError} - onFetchAiSolution={() => - handleFetchAiSolution(activeReview, (newRef) => { - setReviews((prev) => - prev.map((r, idx) => - idx === 0 - ? { - ...r, - problems: { - ...(effectiveProblem || {}), - ...(r.problems || {}), - reference_code: newRef, - } as ProblemItem, - } - : r - ) - ); - }) - } - explainLoading={explainLoading} - explainError={explainError} - explanationText={explanationText} - onExplainCode={(overrideCode, overridePattern, overrideTime, overrideSpace) => - handleExplainCode(activeReview, overrideCode, overridePattern, overrideTime, overrideSpace) + +
+ + Loading Problem Spec... +
+
} - activeReview={activeReview} - onUpdateSolutions={handleUpdateSolutions} - onEditProblem={() => { - if (onOpenEditProblem) onOpenEditProblem(effectiveProblem); - else onOpenWindow?.('editProblem'); - }} - /> + > + { + setLeftTab(tab); + if (tab === 'ref') setMobileView('ref'); + else if (tab === 'spec') setMobileView('spec'); + }} + mobileView={mobileView} + isNarrow={isNarrow} + problem={effectiveProblem} + parsed={parsed} + userSolution={userSolution} + officialSolution={officialSolution} + effectiveReferenceCode={effectiveReferenceCode} + copiedSnippet={copiedSnippet} + onCopyText={handleCopyText} + saveRefError={saveRefError} + aiSolutionLoading={aiSolutionLoading} + aiSolutionError={aiSolutionError} + onFetchAiSolution={() => + handleFetchAiSolution(activeReview, (newRef) => { + setReviews((prev) => + prev.map((r, idx) => + idx === 0 + ? { + ...r, + problems: { + ...(effectiveProblem || {}), + ...(r.problems || {}), + reference_code: newRef, + } as ProblemItem, + } + : r + ) + ); + }) + } + explainLoading={explainLoading} + explainError={explainError} + explanationText={explanationText} + onExplainCode={(overrideCode, overridePattern, overrideTime, overrideSpace) => + handleExplainCode(activeReview, overrideCode, overridePattern, overrideTime, overrideSpace) + } + activeReview={activeReview} + onUpdateSolutions={handleUpdateSolutions} + onEditProblem={() => { + if (onOpenEditProblem) onOpenEditProblem(effectiveProblem); + else onOpenWindow?.('editProblem'); + }} + /> + { + if (!hex || !hex.startsWith('#')) return false; + if (hex.toLowerCase() === '#0ea5e9') return true; + const cleanHex = hex.replace('#', ''); + if (cleanHex.length === 3) { + const r = parseInt(cleanHex[0] + cleanHex[0], 16); + const g = parseInt(cleanHex[1] + cleanHex[1], 16); + const b = parseInt(cleanHex[2] + cleanHex[2], 16); + return (0.299 * r + 0.587 * g + 0.114 * b) > 135; + } + if (cleanHex.length === 6) { + const r = parseInt(cleanHex.slice(0, 2), 16); + const g = parseInt(cleanHex.slice(2, 4), 16); + const b = parseInt(cleanHex.slice(4, 6), 16); + return (0.299 * r + 0.587 * g + 0.114 * b) > 135; + } + return false; +}; + export default function WindowShell({ id, title, @@ -255,7 +274,9 @@ export default function WindowShell({ {...bindDrag()} onDoubleClick={isMobile ? undefined : handleToggleMaximize} style={{ backgroundColor: titleBarColor }} - className={`border-b-[4px] border-ink-black px-4 py-2 flex justify-between items-center text-white shrink-0 select-none touch-none ${ + className={`border-b-[4px] border-ink-black px-4 py-2 flex justify-between items-center ${ + isLightColor(titleBarColor) ? 'text-ink-black' : 'text-white' + } shrink-0 select-none touch-none ${ isMobile || isMaximized ? 'cursor-default' : isDragging ? 'cursor-grabbing' : 'cursor-grab' }`} > @@ -277,6 +298,7 @@ export default function WindowShell({ }} className="window-control-btn w-7 h-7 bg-white text-ink-black border-[3px] border-ink-black flex items-center justify-center hover:bg-yellow-300 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer" title="Minimize" + aria-label="Minimize" > minimize @@ -287,6 +309,7 @@ export default function WindowShell({ }} className="window-control-btn w-7 h-7 bg-white text-ink-black border-[3px] border-ink-black flex items-center justify-center hover:bg-yellow-300 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer" title={isMaximized ? 'Restore' : 'Maximize'} + aria-label={isMaximized ? 'Restore' : 'Maximize'} > {isMaximized ? 'filter_none' : 'crop_square'} @@ -299,8 +322,9 @@ export default function WindowShell({ e.stopPropagation(); handleClose(); }} - className="window-control-btn w-7 h-7 bg-highlight-pink text-white border-[3px] border-ink-black flex items-center justify-center hover:bg-rose-600 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer" + className="window-control-btn w-7 h-7 bg-rose-600 text-white border-[3px] border-ink-black flex items-center justify-center hover:bg-rose-700 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer" title="Close" + aria-label="Close" > close diff --git a/algospaced-ui/src/components/desktop/DesktopGadget.tsx b/algospaced-ui/src/components/desktop/DesktopGadget.tsx index 905b1ec3f6bd3f849f0a312770da1ec3032d91af..1c8b6e0b2d6a32136f613bf38d9ebafd368ceb32 100644 --- a/algospaced-ui/src/components/desktop/DesktopGadget.tsx +++ b/algospaced-ui/src/components/desktop/DesktopGadget.tsx @@ -18,7 +18,7 @@ export const DesktopGadget: React.FC = ({ <> {/* System Gadget Widget (Top Right) */}
-
+
Profile.sys
@@ -26,12 +26,12 @@ export const DesktopGadget: React.FC = ({ Profile Avatar
{username}
-
+
local_fire_department diff --git a/algospaced-ui/src/components/desktop/DesktopTaskbar.tsx b/algospaced-ui/src/components/desktop/DesktopTaskbar.tsx index da6e9c17d5135b4a2fc65668b124251eefa4054b..2e99e1ae9d858d57513c3070e60d03c6d2256f58 100644 --- a/algospaced-ui/src/components/desktop/DesktopTaskbar.tsx +++ b/algospaced-ui/src/components/desktop/DesktopTaskbar.tsx @@ -145,6 +145,7 @@ export const DesktopTaskbar: React.FC = ({ isMobile ? 'px-3' : 'px-6' } flex items-center gap-2 border-r-[4px] border-ink-black bg-[#39ff14] text-ink-black hover:bg-[#28e007] active:bg-[#1fb304] transition-colors shadow-[inset_-3px_-3px_0px_rgba(0,0,0,0.2),inset_3px_3px_0px_rgba(255,255,255,0.5)] font-bold cursor-pointer`} title="Start Menu" + aria-label="Start Menu" > sports_esports @@ -204,7 +205,7 @@ export const DesktopTaskbar: React.FC = ({
{/* System tray (process status, wifi, clock, volume) */} -
+
{/* Process Monitor badge with @floating-ui flyout */} = ({ return (
{/* Metro Header */} -
-
+
+
AlgoSpaced OS v1.0 @@ -32,7 +32,7 @@ export const MobileMetroScreen: React.FC = ({ BETA
-

+

start

@@ -44,13 +44,15 @@ export const MobileMetroScreen: React.FC = ({
Profile Avatar
{username}
-
+
local_fire_department @@ -75,7 +77,7 @@ export const MobileMetroScreen: React.FC = ({ {/* Journey Path Tile */}