How akassh9/my-canvas works
Project type and purpose
• This is a Next.js 15–based, client-only React “interactive foresight terminal” that simulates a macOS-style archive computer circa 2040.
• The server’s only role is to ship static assets (JS/CSS/images) and handle two routes: the home UI and a CSR‐only /history page embedding Issuu.
File structure
• Top level:
• components/ – reusable React widgets (DraggableWindow, MacMenuBar, PreviewWindow, TextEditWindow, MobileWarning)
• data/ – static TypeScript modules (healthContent.ts, educationContent.ts, entertainmentContent.ts) defining the ForesightContent domain model
• public/images – 300+ headline tiles and one “archive computer” video
• src/app/ – Next.js App Router structure:
– page.tsx (HomeClient orchestrator)
– history/page.tsx + HistoryClient.tsx
– api/simulate/route.ts (simulated API endpoint)
– globals.css + route‐scoped CSS
• hooks/, types/, styles/, config files (eslint.config.mjs, next.config.ts, postcss.config.mjs, tsconfig.json)
• Key patterns:
• Single‐page drag-and-drop window manager driven by top-level React state (no Redux)
• Pure static data look-up tables for headlines and scenario draggables
• CSR-only /history page with dynamic import + Suspense
• Animation via Framer Motion and manual text‐typing loops
Extract README insights
• Mission: build an interactive terminal with draggable macOS windows; all UI logic lives client-side.
• Domain model: one ForesightContent interface implemented in three data files; no business logic outside of TextEditWindow.
• Global state atoms: selectedCategory, selectedOption, happenedMode, hoveredHappened, happenedScenario, zCounter.
• Window registry: ~350 entries mapping keys to positions, sizes, types.
• Tech stack: Next.js 15, React 18, TypeScript, Tailwind v4, Framer Motion, react-draggable, Vercel analytics.
• Infrastructure Layer
– Vercel (hosting + analytics)
– Next.js Server (static file dispatcher)
• Frontend Shell (Next.js App)
– App Router → Layout.tsx → Nav/Menu bar → HomeClient or HistoryClient
• UI Component Layer
– MacMenuBar (menu gating, callbacks)
– DraggableWindow manager + global zIndex counter
– TextEditWindow (terminal state‐machine, typing, option/happened modes)
– PreviewWindow (image viewer stub)
– MobileWarning (fallback UI)
• Data Layer
– Static content modules (data/*.ts, src/data/windows.ts)
– Window/Headline registries and filtering matrices
• Assets & Styles
– public/images/**, video, fonts
– Tailwind CSS, mac-window.css
• External Integrations
– Issuu iframe (History page)
– @vercel/analytics, @vercel/speed-insights
• Vercel → Next.js Server → client browser
• Browser loads App Shell → Layout → renders MacMenuBar + HomeClient or HistoryClient
• HomeClient maintains global React state, reads static Data Layer → passes props into DraggableWindow/TextEditWindow
• User events (menu clicks, drags, keyboard nav) flow into component callbacks → update React state → re-render windows + content
• Animations triggered inside components via Framer Motion
• HistoryClient dynamically loads Issuu embed (Suspense)
c. Architectural patterns/design principles:
• Component‐centric UI with clearly separated “orchestrator” (page.tsx) vs. “leaf” components
• Single source of truth: top‐level React state atoms instead of global store
• Pure data modules: ForesightContent and window registries are immutable look-up tables
• CSR vs. SSG: Home is SSG/SSR, History is forced CSR (dynamic + Suspense)
d. Key technologies and libraries to annotate:
• Next.js App Router (app/layout.tsx, dynamic routing)
• React 18 + TypeScript types for ForesightContent & WindowConfig
• Tailwind CSS & custom mac-window.css
• Framer Motion <AnimatePresence> + motion.div
• react-draggable for window dragging