diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..393dd85 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,1248 @@ +# MASH Landing Page - AI Agent Instructions + +## Project Overview +Next.js 16 landing page for MASH (Mushroom Automation System Hub) - a professional mushroom cultivation automation platform. Built with React 19, TypeScript, Tailwind CSS 4, and integrated with Sanity CMS and Cal.com scheduling. + +## Architecture & Structure + +### Main Application (`/app`) +- **App Router**: Next.js App Router with file-based routing +- **Layout**: Root layout at [app/layout.tsx](app/layout.tsx) includes ThemeProvider with dark mode as default +- **Homepage**: [app/page.tsx](app/page.tsx) is a single-page landing with section components +- **Standalone Pages**: `/download`, `/faq`, `/schedule`, `/documentation`, `/support`, `/terms`, `/privacy`, `/license`, `/status` + +### Components Organization (`/components`) +**Section Components** (main landing page sections): +- `HeroSection.tsx` - Video background with Sanity CMS integration +- `FeaturesSection.tsx`, `DemoSection.tsx`, `DocumentationSection.tsx`, `ScopeSection.tsx`, `BookingSection.tsx`, `SupportSection.tsx`, `DownloadSection.tsx` +- `MobileAppShowcase.tsx` - Interactive phone mockup with 4 app screen previews (Dashboard, Growth Analytics, Environmental Control, Alerts) +- `IoTDeviceSection.tsx` - Three.js 3D IoT device model (Chamber.glb) with CSS fallback, interactive spec panels +- `ChamberModel3D.tsx` - Three.js GLB model viewer using @react-three/fiber and drei +- `Navigation.tsx`, `Footer.tsx` - Shared across pages + +**UI Components** (`/components/ui`): +- shadcn/ui pattern: Individual component files like `button.tsx`, `card.tsx`, `theme-toggle.tsx` +- `parallax-section.tsx` - Scroll-driven parallax wrapper using framer-motion +- `scroll-reveal.tsx` - Scroll-triggered entrance animations +- `status-badge.tsx` - Status indicator badges (operational, degraded, outage, maintenance) +- Variants defined using `class-variance-authority` (CVA) +- All use `cn()` utility from `@/lib/utils` for className merging + +**Provider Components** (`/components/providers`): +- `theme-provider.tsx` - next-themes ThemeProvider wrapper +- `smooth-scroll-provider.tsx` - CSS smooth scroll with prefers-reduced-motion support + +**Layout Components** (`/components/layout`): +- `PageLayout.tsx` - Wrapper for standalone pages + +### Sanity Studio (`/studio`) +Separate Sanity CMS workspace for content management (e-commerce focused): +- **Project ID**: `gerattrr`, **Dataset**: `production` +- **Schema**: 25+ document types in `/studio/src/schemaTypes/documents/` (products, orders, reviews, blog, etc.) +- **Sample Data**: `/studio/sample-data/` with import scripts +- **Commands**: Run from `/studio` directory: `npm run dev` (port 3333), `npm run build`, `npm run deploy` +- **Note**: Integrated with main Next.js app via `lib/sanity.ts` for landing page content and media + +## Critical Integrations + +### Sanity CMS (Content & Media Management) +**Configuration**: [lib/sanity.ts](lib/sanity.ts) +- Project ID from `NEXT_PUBLIC_SANITY_PROJECT_ID` env var +- Helper functions: `getSanityImageUrl()`, `getSanityFileUrl()`, `getSanityVideoUrl()`, `getLandingPageData()` +- Cached data fetching with `getLandingPageDataCached()` +- Automatic optimization for images + +**Usage Pattern**: +```tsx +import { getSanityFileUrl, getLandingPageData } from "@/lib/sanity"; + +const data = await getLandingPageData(); +const videoUrl = getSanityFileUrl(data.heroVideo.asset); + +``` + +**Asset Management**: Upload via `scripts/upload-assets.js`, content via `scripts/import-landing-page.js` + +### Cal.com Scheduling +**Configuration**: [lib/cal-config.ts](lib/cal-config.ts) +- `calConfig` object with username, event types (15min, 30min, 1-hour-meeting) +- Helper functions: `getCalLink()`, `getCalUrl()` - use these instead of hardcoding URLs +- `CalendarScheduler.tsx` component embeds Cal.com with theme sync + +**Usage Pattern**: +```tsx +import { getCalUrl } from '@/lib/cal-config'; + + +// Or direct link: getCalUrl('30min') +``` + +## Styling & Theming + +### Tailwind CSS 4 Approach +- **Custom CSS Variables**: Defined in [app/globals.css](app/globals.css) with light/dark mode variants +- **Semantic Tokens**: Use `bg-background`, `text-primary`, `text-secondary`, not raw colors +- **Brand Color**: Green (`--color-primary: 22 163 74`) - use `bg-green-600`, `text-green-600` +- **Theme Toggle**: `next-themes` with `ThemeProvider` in layout - access via `useTheme()` hook + +### Dark Mode (Default) +- Default theme: `dark` (set in [app/layout.tsx](app/layout.tsx)) +- Classes: `dark:bg-gray-900`, `dark:text-gray-100` patterns throughout +- Video backgrounds: Lower opacity in dark mode (`dark:opacity-10`) + +## Development Workflow + +### Commands +```bash +npm run dev # Start dev server (http://localhost:3000) +npm run build # Production build +npm run lint # ESLint check +npm test # Run all tests +npm run test:coverage # Generate coverage report +``` + +### Working with Standalone Pages +1. Create page in `/app/[page-name]/page.tsx` +2. Wrap with `PageLayout` component for consistent styling +3. Add metadata export for SEO +4. Link from Navigation or relevant sections + +### Adding New Components +1. Section components: `/components/[Name]Section.tsx` - use `"use client"` if interactive +2. UI components: `/components/ui/[name].tsx` - follow shadcn/ui pattern with CVA variants +3. Import path: Use `@/` alias (e.g., `@/components/ui/button`) + +## Key Conventions + +### Client vs Server Components +- **Default**: Server Components (no `"use client"`) +- **Use `"use client"`** when: useState, useEffect, event handlers, browser APIs, theme hooks +- Examples: `HeroSection.tsx`, `CalendarScheduler.tsx`, `theme-toggle.tsx` + +### File Naming +- Components: PascalCase (`HeroSection.tsx`) +- Utils/configs: kebab-case (`cal-config.ts`, `sanity.ts`) +- Pages: lowercase (`page.tsx` in directories) + +### Import Organization +Standard order: React → Next.js → External → Internal → Types +```tsx +import { useState } from "react"; +import type { Metadata } from "next"; +import { Button } from "@/components/ui/button"; +``` + +### Accessibility +- All videos: Include `aria-hidden="true"` for decorative backgrounds +- Check `prefers-reduced-motion` for animations (see [components/HeroSection.tsx](components/HeroSection.tsx#L7-L23)) +- Semantic HTML: `
`, `