This is a substantial project. Let me start by exploring the current structure, then build it systematically.
Let me build this entire desktop environment. I'll start with the foundation files and work up.
Now let me create the definitions and store files.
Now let me create the SVG icons and the main components:
Now let me create the CSS with custom styles, then the main components:
Now let me create all the components. I'll start with the foundation ones:
Now let me create the Window component with drag, resize, minimize, maximize, and snapping:
Let me fix all the unused variables and clean up the Window component:
Let me create the app files first, then fix the Window.tsx unused variables:
Now let me create the remaining app files and fix Window.tsx:
Now let me create ImageViewer and Settings apps:
Now let me completely rewrite Window.tsx to fix all unused variables:
Now let me create the remaining components:
Now let me create the wallpaper and the main Desktop component:
Now let me create the main App.tsx:
Now let me update the index.html title and build:
The build succeeded. Let me review the ContextMenu component to ensure it handles divider items with optional labels properly:
Let me add a few critical fixes. First, ensure windows can't go off-screen to the right/bottom:
The build succeeded. Let me verify the full file structure:
Everything is in place. Let me verify the generated output is self-contained:
The project builds successfully. Here's a summary of everything built:
Complete Desktop Environment - Summary
Architecture
- 22 source files in a single-page React + TypeScript + Vite + Tailwind app
- No external libraries for window management, drag-and-drop, or animation
- State management via React Context + useReducer with localStorage persistence
- Lazy-loaded app components via
React.lazy() and Suspense
Core Components
Desktop (Desktop.tsx) - Full-screen OS container with wallpaper, windows, menu bar, dock, and all overlays. Handles right-click context menus and global keyboard shortcuts.
MenuBar (MenuBar.tsx) - Top bar with Apple menu, app name, status icons (WiFi, battery), clock, theme toggle, Mission Control button, and notification center button.
Dock (Dock.tsx) - Animated dock with hover magnification (CSS transform scaling), running-app indicators (dots), minimized app detection, tooltips, and a trash icon. Clicking a running app focuses its most recent window; clicking a minimized app restores it.
Window (Window.tsx) - Full-featured window with:
- Title bar with traffic-light controls (close/minimize/maximize)
- Drag from title bar (constrained to screen bounds)
- Double-click title bar to maximize/restore
- Drag a maximized window to restore it
- 8-direction resizing from edges and corners
- Left/right snap on drag to screen edges
- Top-edge snap to maximize
- Focus management (z-index)
- Dimmed inactive windows
- Resize cursor handles
DesktopIcons (DesktopIcons.tsx) - Icons on the desktop with:
- Single-click selection
- Shift-click for multi-select
- Drag-selection rectangle
- Drag-move multiple selected icons
- Double-click folders to open in Finder
ContextMenu (ContextMenu.tsx) - Right-click desktop context menu with New Folder, New Note, Change Wallpaper, Open Settings. Auto-positions to stay on-screen. Closes on click outside or Escape.
Spotlight (Spotlight.tsx) - Ctrl/Cmd+Space global search that searches apps, files, folders, notes, and settings. Keyboard navigation (arrows/enter/escape), highlighted matches, result type indicators.
MissionControl (MissionControl.tsx) - Window overview with scaled window previews, organized layout, minimized windows section, and the ability to close windows from the overview.
NotificationCenter (NotificationCenter.tsx) - Slide-down panel showing all notifications with read/unread states, mark-all-read button, and dismiss buttons.
NotificationBanner (NotificationBanner.tsx) - Auto-dismissing toast notifications that slide in from the top-right.
Wallpaper (Wallpaper.tsx) - 6 gradient wallpaper options with an animated particle overlay on some variants.
Applications
FileExplorer - Full file browser with sidebar (favorites + locations), folder navigation, breadcrumbs, grid/list views, search, file selection, double-click to open folders/images, drag-and-drop between folders, size/date display.
Notes - Note-taking app with sidebar list, search, create/rename/delete, autosave to localStorage (500ms debounce), last-edited timestamp, multiple windows support.
ImageViewer - Image viewer with zoom (20%-500%), rotation (90° increments), fit-to-window toggle, previous/next navigation between images in a folder, smooth transitions between images. Generates abstract SVG art for the mock images.
Settings - Settings panel with working controls for light/dark theme, 6 accent colors, 6 wallpapers, dock size slider (36-72px), dock magnification toggle, and reduced motion toggle. All updates apply immediately and persist.
Technical Details
- State persistence: Desktop state, preferences, notes, file system, window positions all save to localStorage
- Reduced motion: Respects both system
prefers-reduced-motion and in-app setting
- Keyboard accessibility: Focus-visible outlines on all interactive elements
- No text selection: Prevented during desktop interactions via CSS
user-select: none
- Custom SVG icons: All icons are original inline SVGs - no Apple or third-party assets
- 359KB single-file output
Files built: src/types.ts, src/definitions.ts, src/store.tsx, src/icons.tsx, src/index.css, src/components/MenuBar.tsx, src/components/Dock.tsx, src/components/Window.tsx, src/apps/FileExplorer.tsx, src/apps/Notes.tsx, src/apps/ImageViewer.tsx, src/apps/Settings.tsx, src/components/DesktopIcons.tsx, src/components/ContextMenu.tsx, src/components/Spotlight.tsx, src/components/MissionControl.tsx, src/components/NotificationCenter.tsx, src/components/Wallpaper.tsx, src/components/NotificationBanner.tsx, src/components/Desktop.tsx, src/App.tsx, index.html