{/* 2. The Racquet Ecosystem */}
-
+
Multi-Sport Ecosystem
- Spanning the Ground, 1st, and 2nd floors, we offer a comprehensive racquet experience.
- From the high-speed action of Badminton and Table Tennis on the Mezzanine to the social atmosphere of Pickleball and the historic elegance of Real Tennis on the upper deck.
+ Spanning the Ground, 1st, and 2nd floors, we offer a comprehensive racquet
+ experience. From the high-speed action of Badminton and Table Tennis on the
+ Mezzanine to the social atmosphere of Pickleball and the historic elegance
+ of Real Tennis on the upper deck.
-
-
- Ground Floor
- 24 Tennis Courts (Hard, Clay, Grass, Wood)
-
-
- First Floor
- 16 Badminton, 4 Squash, 16 Table Tennis
-
-
- Second Floor
- 8 Pickleball Courts, 1 Real Tennis Court
-
-
+
+
+ Ground Floor
+
+ 24 Tennis Courts (Hard, Clay, Grass, Wood)
+
+
+
+ First Floor
+
+ 16 Badminton, 4 Squash, 16 Table Tennis
+
+
+
+ Second Floor
+
+ 8 Pickleball Courts, 1 Real Tennis Court
+
+
+
-

+
{/* 3. Autonomous Operations */}
-
+
Autonomous Operations
- The facility runs itself. A centralized Building Management System (BMS) optimizes HVAC and lighting using solar power.
- Robotic mowers maintain the courts while overhead drones constantly analyze surface quality.
- Entry is seamless with biometric scanning, removing the need for keys or cards.
+ The facility runs itself. A centralized Building Management System (BMS)
+ optimizes HVAC and lighting using solar power. Robotic mowers maintain the
+ courts while overhead drones constantly analyze surface quality. Entry is
+ seamless with biometric scanning, removing the need for keys or cards.
-
-
-
Smart HVAC
-
AI Climate Control
-
+
+
+
Smart HVAC
+
AI Climate Control
+
-
-
-
-
Biometric Entry
-
Secure & Seamless
-
+
+
+
+
Biometric Entry
+
Secure & Seamless
+
-

+
- {/* 4. Member Experience */}
+ {/* 4. Member Experience */}
-
+
Member Experience
- We prioritize comfort and recovery. Our Pro Shop is stocked with the latest gear.
- Locker rooms and waiting areas are managed by smart sensors to ensure cleanliness and supply availability.
- Automated emergency systems monitor the entire facility to instantly alert services if an incident occurs.
+ We prioritize comfort and recovery. Our Pro Shop is stocked with the latest
+ gear. Locker rooms and waiting areas are managed by smart sensors to ensure
+ cleanliness and supply availability. Automated emergency systems monitor the
+ entire facility to instantly alert services if an incident occurs.
-
- - Smart Bathroom Sanitation Monitoring
- - Automated Emergency Response
- - Mobile App Booking & Payments
+
+ -
+ Smart Bathroom
+ Sanitation Monitoring
+
+ -
+ Automated Emergency
+ Response
+
+ -
+ Mobile App Booking
+ & Payments
+
-

+
-
@@ -346,7 +555,7 @@ const App: React.FC = () => {
{/* INVEST VIEW */}
{currentView === View.INVEST && (
-
{
variants={pageVariants}
className="h-full overflow-y-auto custom-scrollbar pb-20 flex items-center justify-center px-6"
>
-
-
-
Join the Revolution
-
We are raising Series A funding to build the pilot facility in Austin, Texas.
+
+
+
Join the Revolution
+
+ We are raising Series A funding to build the pilot facility in Austin, Texas.
+
+
+
+
-
+
+
+
)}
-
{/* Global Elements */}
-
+
}>
+
+
);
};
diff --git a/CI_CD.md b/CI_CD.md
new file mode 100644
index 0000000..26c0a4d
--- /dev/null
+++ b/CI_CD.md
@@ -0,0 +1,604 @@
+# CI/CD Pipeline Documentation
+
+## Overview
+
+This project uses a comprehensive CI/CD pipeline built with GitHub Actions to ensure code quality, performance, and reliable deployments. The pipeline consists of three main workflows that work together to maintain high standards while enabling rapid development.
+
+## Pipeline Architecture
+
+```
+┌─────────────────────────────────────────────────────────────┐
+│ GitHub Actions Pipeline │
+├─────────────────────────────────────────────────────────────┤
+│ │
+│ ┌──────────────────┐ ┌──────────────────┐ ┌───────────┐ │
+│ │ Test & QA │ │ Quality Gates │ │ Deploy │ │
+│ │ (test.yml) │ │ (quality.yml) │ │(deploy.yml)│ │
+│ └──────────────────┘ └──────────────────┘ └───────────┘ │
+│ │ │ │ │
+│ ┌────────▼─────────┐ ┌───────▼────────┐ ┌────────▼────┐ │
+│ │ • Lint │ │ • Bundle Size │ │ • Build │ │
+│ │ • Format │ │ • Performance │ │ • Deploy │ │
+│ │ • Type Check │ │ • A11y Audit │ │ to Pages │ │
+│ │ • Unit Tests │ │ • Code Metrics │ │ │ │
+│ │ • E2E Tests │ └────────────────┘ └─────────────┘ │
+│ │ • Build Verify │ │
+│ └──────────────────┘ │
+│ │
+└─────────────────────────────────────────────────────────────┘
+```
+
+---
+
+## Workflows
+
+### 1. Test & Quality Checks (`test.yml`)
+
+**Purpose:** Ensure code quality, correctness, and functionality before merging
+
+**Triggers:**
+- Push to `main` or `dev` branches
+- Pull requests targeting `main` or `dev`
+
+**Jobs:**
+
+#### Lint Check
+- **Runtime:** ~2-3 minutes
+- **Tools:** ESLint with TypeScript, React, and accessibility plugins
+- **Checks:**
+ - TypeScript code quality
+ - React best practices
+ - Hook usage patterns
+ - Accessibility (jsx-a11y)
+ - Import organization
+- **Artifacts:** ESLint JSON report
+
+#### Format Check
+- **Runtime:** ~1-2 minutes
+- **Tools:** Prettier
+- **Checks:**
+ - Code formatting consistency
+ - Line endings (LF)
+ - Trailing commas
+ - Semicolons and quotes
+- **Config:** `.prettierrc`
+
+#### Type Check
+- **Runtime:** ~2-3 minutes
+- **Tools:** TypeScript Compiler (tsc)
+- **Checks:**
+ - Strict type safety
+ - No implicit any
+ - Strict null checks
+ - Function types
+- **Config:** `tsconfig.json`
+
+#### Unit Tests
+- **Runtime:** ~3-5 minutes
+- **Tools:** Vitest with React Testing Library
+- **Coverage Requirements:**
+ - Lines: 70%
+ - Functions: 70%
+ - Branches: 70%
+ - Statements: 70%
+- **Outputs:**
+ - Coverage report (HTML, LCOV, JSON)
+ - Codecov integration (if configured)
+- **Artifacts:** Coverage reports
+
+#### E2E Tests
+- **Runtime:** ~10-15 minutes per browser
+- **Tools:** Playwright
+- **Browsers Tested:**
+ - Chromium
+ - Firefox
+ - WebKit (Safari)
+- **Features:**
+ - Parallel execution across browsers
+ - Screenshot on failure
+ - Video recording on retry
+ - 2 retries on CI
+- **Artifacts:**
+ - Playwright reports
+ - Test results
+ - Screenshots/videos
+
+#### Build Verification
+- **Runtime:** ~3-5 minutes per environment
+- **Environments:**
+ - Production (`/ace/`)
+ - Development (`/ace/dev/`)
+- **Checks:**
+ - Successful build completion
+ - Output validation (dist/ directory)
+ - Entry point verification (index.html)
+ - Bundle analysis
+- **Artifacts:**
+ - Build output
+ - Bundle statistics
+
+**Status:** ✅ Must pass for PR merge
+
+---
+
+### 2. Quality Gates & Performance (`quality.yml`)
+
+**Purpose:** Monitor quality metrics, performance, and accessibility without blocking deployment
+
+**Triggers:**
+- Push to `main` or `dev` branches
+- Pull requests targeting `main` or `dev`
+
+**Jobs:**
+
+#### Bundle Size Analysis
+- **Runtime:** ~3-5 minutes
+- **Metrics:**
+ - Total bundle size
+ - Individual asset sizes
+ - Large file detection (>500KB threshold)
+- **Reporting:**
+ - GitHub Actions summary
+ - PR comment with breakdown
+ - Trend tracking
+- **Tools:** Custom analysis script
+- **Artifacts:** Bundle stats visualization
+
+#### Performance Budget Check
+- **Runtime:** ~5-10 minutes
+- **Tools:** Lighthouse CI
+- **Metrics Monitored:**
+ - **LCP (Largest Contentful Paint):** Target <2.5s, Threshold <4.0s
+ - **FID (First Input Delay):** Target <100ms, Threshold <300ms
+ - **CLS (Cumulative Layout Shift):** Target <0.1, Threshold <0.25
+ - **TTFB (Time to First Byte):** Target <800ms, Threshold <1.8s
+ - **INP (Interaction to Next Paint):** Target <200ms, Threshold <500ms
+- **Lighthouse Scores:**
+ - Performance: >90
+ - Accessibility: >90
+ - Best Practices: >90
+ - SEO: >90
+- **Configuration:** Dynamic `lighthouserc.json`
+- **Artifacts:** Lighthouse reports
+
+#### Accessibility Audit
+- **Runtime:** ~3-5 minutes
+- **Tools:**
+ - axe-core via axe-playwright
+ - ESLint jsx-a11y rules
+- **Checks:**
+ - WCAG 2.1 Level AA compliance
+ - Keyboard navigation
+ - ARIA labels and roles
+ - Color contrast ratios
+ - Alternative text
+ - Focus management
+- **Severity Levels:**
+ - Critical/Serious: Reported as warnings
+ - Moderate/Minor: Logged for review
+- **Artifacts:** Accessibility report
+
+#### Code Quality Metrics
+- **Runtime:** ~1-2 minutes
+- **Statistics:**
+ - Total TypeScript files
+ - Lines of code
+ - Component count
+ - Code health indicators
+- **Checks:**
+ - TypeScript strict mode enabled
+ - ESLint configuration
+ - Prettier integration
+ - Test coverage trends
+
+**Status:** ⚠️ Informational (warnings don't block deployment)
+
+---
+
+### 3. Build and Deploy (`deploy.yml`)
+
+**Purpose:** Automated deployment to GitHub Pages
+
+**Triggers:**
+- Push to `main` branch (production)
+- Push to `dev` branch (preview)
+
+**Process:**
+
+1. **Build Main Branch**
+ - Checkout `main`
+ - Install dependencies
+ - Build with base path `/ace/`
+ - Copy to deploy directory
+
+2. **Build Dev Branch**
+ - Checkout `dev`
+ - Install dependencies
+ - Build with base path `/ace/dev/`
+ - Copy to deploy/dev subdirectory
+
+3. **Deploy to GitHub Pages**
+ - Upload combined artifact
+ - Deploy to gh-pages branch
+ - Concurrent deployment protection
+
+**Deployment URLs:**
+- Production: https://kvnloo.github.io/ace/
+- Development: https://kvnloo.github.io/ace/dev/
+
+**Status:** ✅ Independent of test workflows
+
+---
+
+## How to View Results
+
+### GitHub Actions Dashboard
+
+1. **Navigate to Actions tab:**
+ ```
+ https://github.com/kvnloo/ace/actions
+ ```
+
+2. **Select a workflow:**
+ - "Test & Quality Checks" - View test results
+ - "Quality Gates & Performance" - View metrics
+ - "Build and Deploy to GitHub Pages" - View deployments
+
+3. **View workflow run:**
+ - Click on any run to see details
+ - Expand jobs to see individual steps
+ - Check job summaries for formatted reports
+
+### Status Badges
+
+The README displays real-time status badges:
+
+```markdown
+[](https://github.com/kvnloo/ace/actions/workflows/test.yml)
+[](https://github.com/kvnloo/ace/actions/workflows/quality.yml)
+[](https://github.com/kvnloo/ace/actions/workflows/deploy.yml)
+```
+
+### Pull Request Checks
+
+On pull requests, you'll see:
+
+1. **Required Checks:**
+ - All test jobs must pass
+ - Green checkmarks required for merge
+
+2. **Status Checks:**
+ - Lint Check ✅
+ - Format Check ✅
+ - Type Check ✅
+ - Unit Tests ✅
+ - E2E Tests ✅
+ - Build Verification ✅
+
+3. **PR Comments:**
+ - Bundle size analysis
+ - Coverage reports
+ - Performance metrics
+
+### Artifacts
+
+Download detailed reports from workflow runs:
+
+1. **Test Workflow Artifacts:**
+ - `eslint-report` - Detailed linting results
+ - `coverage-report` - Full coverage HTML report
+ - `playwright-report-{browser}` - E2E test reports
+ - `test-results-{browser}` - Raw test results
+ - `build-{environment}` - Build output
+ - `bundle-stats-{environment}` - Bundle analysis
+
+2. **Quality Workflow Artifacts:**
+ - `bundle-analysis` - Interactive bundle visualization
+ - `lighthouse-reports` - Lighthouse CI reports
+
+**Retention:** Artifacts are kept for 7-30 days depending on type
+
+---
+
+## Local Development Workflow
+
+### Run Checks Locally
+
+Before pushing, run the same checks locally:
+
+```bash
+# Lint check
+npm run lint
+
+# Format check
+npm run format:check
+
+# Fix formatting
+npm run format
+
+# Type check
+npx tsc --noEmit
+
+# Unit tests
+npm test
+
+# Unit tests with coverage
+npm run test:coverage
+
+# E2E tests (all browsers)
+npm run test:e2e
+
+# E2E tests (specific browser)
+npm run test:e2e:chromium
+npm run test:e2e:firefox
+npm run test:e2e:webkit
+
+# Build verification
+npm run build
+```
+
+### Pre-commit Checklist
+
+- [ ] Code is formatted (`npm run format`)
+- [ ] No linting errors (`npm run lint`)
+- [ ] Types are correct (`npx tsc --noEmit`)
+- [ ] Tests pass (`npm test`)
+- [ ] Build succeeds (`npm run build`)
+
+---
+
+## Performance Optimization
+
+### Fast Feedback
+
+The pipeline is optimized for quick feedback:
+
+1. **Parallel Execution:**
+ - All test jobs run simultaneously
+ - E2E tests run in parallel across browsers
+ - Independent job execution
+
+2. **Caching:**
+ - npm dependencies cached
+ - Playwright browsers cached
+ - Build artifacts cached
+
+3. **Early Termination:**
+ - Jobs fail fast on errors
+ - Cancel in-progress runs for updated PRs
+ - Timeouts prevent hanging jobs
+
+### Expected Runtimes
+
+| Job | Duration |
+|-----|----------|
+| Lint | 2-3 min |
+| Format | 1-2 min |
+| Type Check | 2-3 min |
+| Unit Tests | 3-5 min |
+| E2E Tests | 10-15 min/browser |
+| Build | 3-5 min |
+| Quality Gates | 10-15 min total |
+| **Total (parallel)** | **15-20 min** |
+
+---
+
+## Configuration Files
+
+### Workflow Configurations
+
+- `.github/workflows/test.yml` - Test and QA pipeline
+- `.github/workflows/quality.yml` - Quality gates and performance
+- `.github/workflows/deploy.yml` - Deployment pipeline
+
+### Tool Configurations
+
+- `eslint.config.js` - ESLint rules and plugins
+- `.prettierrc` - Prettier formatting rules
+- `tsconfig.json` - TypeScript compiler options
+- `vitest.config.ts` - Vitest test configuration
+- `playwright.config.ts` - Playwright E2E configuration
+- `package.json` - Performance budgets (performanceBudgets section)
+
+---
+
+## Troubleshooting
+
+### Common Issues
+
+#### 1. Lint Failures
+
+```bash
+# Check locally
+npm run lint
+
+# Auto-fix issues
+npm run lint:fix
+
+# View detailed report
+npm run lint:report
+```
+
+#### 2. Format Failures
+
+```bash
+# Check formatting
+npm run format:check
+
+# Fix formatting
+npm run format
+```
+
+#### 3. Type Errors
+
+```bash
+# Check types
+npx tsc --noEmit
+
+# Watch mode for development
+npx tsc --noEmit --watch
+```
+
+#### 4. Test Failures
+
+```bash
+# Run specific test file
+npm test -- path/to/test.test.ts
+
+# Run tests in watch mode
+npm run test:watch
+
+# Run with UI
+npm run test:ui
+```
+
+#### 5. E2E Test Failures
+
+```bash
+# Run in headed mode (see browser)
+npm run test:e2e:headed
+
+# Run in debug mode
+npm run test:e2e:debug
+
+# View test report
+npm run test:e2e:report
+```
+
+#### 6. Build Failures
+
+```bash
+# Build with verbose output
+npm run build -- --logLevel=info
+
+# Build with bundle analysis
+npm run build:analyze
+```
+
+### GitHub Actions Issues
+
+#### Workflow Not Running
+
+- Check branch name matches trigger conditions
+- Verify workflow file syntax (YAML)
+- Check repository settings → Actions → General
+
+#### Secrets Not Available
+
+- Configure secrets in repository settings
+- Secrets required:
+ - `CODECOV_TOKEN` (optional, for coverage reports)
+
+#### Artifact Upload Failures
+
+- Check artifact size limits (500MB max)
+- Verify path exists before upload
+- Check retention days setting
+
+---
+
+## Best Practices
+
+### For Developers
+
+1. **Run checks before pushing:**
+ ```bash
+ npm run format && npm run lint && npx tsc --noEmit && npm test
+ ```
+
+2. **Write tests for new features:**
+ - Unit tests for logic
+ - Integration tests for components
+ - E2E tests for critical user flows
+
+3. **Monitor bundle size:**
+ - Check bundle analysis reports
+ - Use code splitting for large dependencies
+ - Lazy load non-critical components
+
+4. **Keep coverage high:**
+ - Aim for >70% coverage
+ - Test edge cases
+ - Focus on critical paths
+
+### For Reviewers
+
+1. **Check CI status:**
+ - All checks must be green
+ - Review coverage reports
+ - Check bundle size changes
+
+2. **Review quality metrics:**
+ - Performance scores
+ - Accessibility issues
+ - Code complexity
+
+3. **Test locally:**
+ - Pull the PR branch
+ - Run tests locally
+ - Test in browser
+
+---
+
+## Continuous Improvement
+
+### Metrics to Monitor
+
+1. **Test Reliability:**
+ - Flaky test rate
+ - Test execution time
+ - Coverage trends
+
+2. **Performance:**
+ - Core Web Vitals
+ - Bundle size trends
+ - Build times
+
+3. **Quality:**
+ - Lint violations
+ - Type errors
+ - Accessibility issues
+
+### Future Enhancements
+
+- [ ] Visual regression testing
+- [ ] Automated dependency updates (Dependabot)
+- [ ] Performance regression detection
+- [ ] Automated changelog generation
+- [ ] Release automation
+- [ ] Canary deployments
+- [ ] A/B testing infrastructure
+
+---
+
+## Support
+
+### Resources
+
+- [GitHub Actions Documentation](https://docs.github.com/en/actions)
+- [Vitest Documentation](https://vitest.dev/)
+- [Playwright Documentation](https://playwright.dev/)
+- [Lighthouse CI Documentation](https://github.com/GoogleChrome/lighthouse-ci)
+- [ESLint Documentation](https://eslint.org/)
+
+### Getting Help
+
+1. Check workflow run logs for error details
+2. Review this documentation
+3. Search GitHub Issues
+4. Contact the team via repository issues
+
+---
+
+## Summary
+
+This CI/CD pipeline provides:
+
+✅ **Fast Feedback** - Parallel execution, <20 minute total runtime
+✅ **Comprehensive Testing** - Lint, format, type, unit, E2E, and build checks
+✅ **Quality Gates** - Bundle size, performance, and accessibility monitoring
+✅ **Clear Reporting** - Status badges, PR comments, detailed artifacts
+✅ **Non-Blocking** - Quality gates inform but don't block deployment
+✅ **Automated Deployment** - Push to main/dev automatically deploys
+
+The pipeline ensures high code quality while maintaining developer velocity and enabling rapid iteration.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..9aab16e
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,741 @@
+# Contributing to LawnTech Dynamics
+
+Thank you for your interest in contributing to LawnTech Dynamics! This document provides comprehensive guidelines and instructions for setting up your development environment, maintaining code quality, and contributing effectively to the project.
+
+## Table of Contents
+
+- [Getting Started](#getting-started)
+ - [Prerequisites](#prerequisites)
+ - [Development Environment Setup](#development-environment-setup)
+ - [Environment Configuration](#environment-configuration)
+- [Code Style Guidelines](#code-style-guidelines)
+ - [Code Formatting](#code-formatting)
+ - [Linting](#linting)
+ - [TypeScript Best Practices](#typescript-best-practices)
+- [Testing Requirements](#testing-requirements)
+ - [Unit Tests](#unit-tests)
+ - [End-to-End Tests](#end-to-end-tests)
+ - [Test Coverage](#test-coverage)
+- [Development Workflow](#development-workflow)
+ - [Branch Strategy](#branch-strategy)
+ - [Making Changes](#making-changes)
+ - [Pre-commit Checklist](#pre-commit-checklist)
+- [Pull Request Process](#pull-request-process)
+ - [Before Submitting](#before-submitting)
+ - [PR Guidelines](#pr-guidelines)
+ - [Review Process](#review-process)
+- [Issue Reporting Guidelines](#issue-reporting-guidelines)
+ - [Bug Reports](#bug-reports)
+ - [Feature Requests](#feature-requests)
+ - [Questions and Discussions](#questions-and-discussions)
+- [Commit Message Guidelines](#commit-message-guidelines)
+- [Additional Resources](#additional-resources)
+
+---
+
+## Getting Started
+
+### Prerequisites
+
+Before you begin, ensure you have the following installed on your system:
+
+- **Node.js**: v20 or higher
+ - Download from [nodejs.org](https://nodejs.org/)
+ - Or use [nvm](https://github.com/nvm-sh/nvm) for version management
+- **npm**: Comes bundled with Node.js (v9.0.0 or higher recommended)
+- **Git**: For version control
+ - Download from [git-scm.com](https://git-scm.com/)
+- **A modern code editor**: We recommend:
+ - [Visual Studio Code](https://code.visualstudio.com/)
+ - [WebStorm](https://www.jetbrains.com/webstorm/)
+ - [Cursor](https://cursor.sh/)
+
+### Development Environment Setup
+
+1. **Fork the repository** (if you're an external contributor)
+
+ Visit [https://github.com/kvnloo/ace](https://github.com/kvnloo/ace) and click "Fork"
+
+2. **Clone the repository:**
+
+ ```bash
+ # If you forked the repo
+ git clone https://github.com/YOUR-USERNAME/ace.git
+ cd ace
+
+ # Or clone the main repository directly
+ git clone https://github.com/kvnloo/ace.git
+ cd ace
+ ```
+
+3. **Install dependencies:**
+
+ ```bash
+ npm install
+ ```
+
+ This will install all required packages listed in `package.json`.
+
+4. **Verify installation:**
+
+ ```bash
+ npm run dev
+ ```
+
+ The development server should start at `http://localhost:3000`
+
+### Environment Configuration
+
+The application requires environment variables to function properly.
+
+1. **Copy the example environment file:**
+
+ ```bash
+ cp .env.example .env.local
+ ```
+
+2. **Configure required variables:**
+
+ Edit `.env.local` and set the following:
+
+ ```env
+ # Google Gemini AI API Key (required for AI chat feature)
+ # Get your key from: https://ai.google.dev/
+ VITE_GEMINI_API_KEY=your_gemini_api_key_here
+
+ # Optional: Debug mode
+ VITE_DEBUG_MODE=false
+
+ # Optional: Analytics
+ VITE_ANALYTICS_ENABLED=false
+ ```
+
+3. **For more details**, see [ENVIRONMENT.md](ENVIRONMENT.md)
+
+---
+
+## Code Style Guidelines
+
+We maintain strict code quality standards to ensure consistency and maintainability across the project.
+
+### Code Formatting
+
+We use **Prettier** for automatic code formatting.
+
+#### Prettier Configuration
+
+Our configuration (`.prettierrc`) enforces:
+
+- **2-space indentation**
+- **Single quotes** for strings
+- **Trailing commas** (ES5 compatible)
+- **100 character line width**
+- **Unix line endings (LF)**
+
+#### Commands
+
+```bash
+# Format all files
+npm run format
+
+# Check formatting without making changes
+npm run format:check
+```
+
+#### Editor Integration
+
+Install the appropriate extension for your editor:
+
+- **VS Code**: [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
+- **WebStorm**: Built-in support, enable in Settings > Languages & Frameworks > JavaScript > Prettier
+- **Sublime Text**: [JsPrettier](https://packagecontrol.io/packages/JsPrettier)
+
+**Recommended VS Code settings** (`.vscode/settings.json`):
+
+```json
+{
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "editor.formatOnSave": true,
+ "editor.codeActionsOnSave": {
+ "source.fixAll.eslint": "explicit"
+ }
+}
+```
+
+### Linting
+
+We use **ESLint** to catch code quality issues and enforce best practices.
+
+#### Running ESLint
+
+```bash
+# Check for linting issues
+npm run lint
+
+# Auto-fix issues where possible
+npm run lint:fix
+
+# Generate JSON report
+npm run lint:report
+```
+
+#### ESLint Rules
+
+Our configuration enforces:
+
+- Modern ES2021+ syntax
+- React best practices and hooks rules
+- TypeScript strict typing
+- Accessibility (a11y) standards
+- Import/export conventions
+- No unused variables or imports
+
+### TypeScript Best Practices
+
+- **Always define types** - Avoid using `any` type
+- **Use interfaces for object shapes** - Prefer interfaces over type aliases for objects
+- **Leverage type inference** - Don't over-specify types where TypeScript can infer
+- **Use strict mode** - The project uses strict TypeScript settings
+
+For more details, see [TYPESCRIPT.md](TYPESCRIPT.md)
+
+---
+
+## Testing Requirements
+
+All contributions must include appropriate tests and maintain or improve code coverage.
+
+### Unit Tests
+
+We use **Vitest** for unit and component testing.
+
+#### Running Tests
+
+```bash
+# Run all tests
+npm test
+
+# Watch mode (re-runs tests on file changes)
+npm run test:watch
+
+# Run with UI interface
+npm run test:ui
+
+# Generate coverage report
+npm run test:coverage
+```
+
+#### Writing Unit Tests
+
+- Place test files next to the code they test with `.test.tsx` or `.test.ts` extension
+- Test files are in the same directory as components:
+ ```
+ components/
+ NavBar.tsx
+ NavBar.test.tsx
+ ```
+
+**Example test structure:**
+
+```typescript
+import { describe, it, expect } from 'vitest';
+import { render, screen } from '@testing-library/react';
+import MyComponent from './MyComponent';
+
+describe('MyComponent', () => {
+ it('renders correctly', () => {
+ render();
+ expect(screen.getByText('Hello')).toBeInTheDocument();
+ });
+
+ it('handles user interaction', async () => {
+ const { user } = render();
+ await user.click(screen.getByRole('button'));
+ expect(screen.getByText('Clicked')).toBeInTheDocument();
+ });
+});
+```
+
+### End-to-End Tests
+
+We use **Playwright** for E2E testing.
+
+#### Running E2E Tests
+
+```bash
+# Run all E2E tests
+npm run test:e2e
+
+# Run with UI mode
+npm run test:e2e:ui
+
+# Run in headed mode (see browser)
+npm run test:e2e:headed
+
+# Run specific browser
+npm run test:e2e:chromium
+npm run test:e2e:firefox
+npm run test:e2e:webkit
+
+# Debug mode
+npm run test:e2e:debug
+
+# View test report
+npm run test:e2e:report
+```
+
+#### Writing E2E Tests
+
+E2E tests are in the `/e2e` directory.
+
+For more details, see [E2E_TESTING.md](E2E_TESTING.md)
+
+### Test Coverage
+
+**Minimum requirements:**
+
+- **80% coverage** for new code
+- **All critical paths** must be tested
+- **No regressions** - existing tests must pass
+
+Check coverage:
+
+```bash
+npm run test:coverage
+```
+
+Coverage reports are generated in the `/coverage` directory.
+
+---
+
+## Development Workflow
+
+### Branch Strategy
+
+We follow a simplified Git Flow:
+
+- **`main`**: Production-ready code, deployed to https://kvnloo.github.io/ace/
+- **`dev`**: Development branch, deployed to https://kvnloo.github.io/ace/dev/
+- **Feature branches**: Created from `dev` for new features
+- **Bugfix branches**: Created from `main` or `dev` for fixes
+
+### Making Changes
+
+1. **Create a feature branch:**
+
+ ```bash
+ # For new features
+ git checkout dev
+ git pull origin dev
+ git checkout -b feature/your-feature-name
+
+ # For bug fixes
+ git checkout -b fix/bug-description
+ ```
+
+2. **Make your changes**
+
+ - Write clean, well-documented code
+ - Follow the style guidelines
+ - Add tests for new functionality
+
+3. **Run quality checks:**
+
+ ```bash
+ # Format code
+ npm run format
+
+ # Check linting
+ npm run lint
+
+ # Run tests
+ npm test
+
+ # Build to verify
+ npm run build
+ ```
+
+4. **Commit your changes**
+
+ Follow our [commit message guidelines](#commit-message-guidelines)
+
+ ```bash
+ git add .
+ git commit -m "feat: add new feature description"
+ ```
+
+5. **Push to your fork:**
+
+ ```bash
+ git push origin feature/your-feature-name
+ ```
+
+### Pre-commit Checklist
+
+Before committing, ensure:
+
+- [ ] Code is formatted with Prettier (`npm run format`)
+- [ ] No linting errors (`npm run lint`)
+- [ ] All tests pass (`npm test`)
+- [ ] Build succeeds (`npm run build`)
+- [ ] No console errors or warnings in development
+- [ ] Documentation is updated (if applicable)
+- [ ] Types are properly defined (no `any` types)
+
+---
+
+## Pull Request Process
+
+### Before Submitting
+
+1. **Update your branch** with the latest changes:
+
+ ```bash
+ git checkout dev
+ git pull origin dev
+ git checkout your-branch-name
+ git merge dev
+ ```
+
+ Resolve any conflicts that arise.
+
+2. **Run the complete test suite:**
+
+ ```bash
+ npm run format
+ npm run lint
+ npm test
+ npm run test:e2e
+ npm run build
+ ```
+
+3. **Update documentation** if you've:
+ - Added new features
+ - Changed APIs or interfaces
+ - Modified configuration
+ - Changed build or deployment processes
+
+### PR Guidelines
+
+#### Title Format
+
+Use conventional commit format:
+
+```
+():
+
+Examples:
+feat(chat): add message history feature
+fix(navigation): resolve mobile menu overflow
+docs(readme): update installation instructions
+perf(3d): optimize Three.js scene rendering
+```
+
+#### Description Template
+
+```markdown
+## Description
+
+Brief description of what this PR does.
+
+## Type of Change
+
+- [ ] Bug fix (non-breaking change which fixes an issue)
+- [ ] New feature (non-breaking change which adds functionality)
+- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
+- [ ] Documentation update
+- [ ] Performance improvement
+- [ ] Code refactoring
+
+## Related Issues
+
+Closes #123
+Relates to #456
+
+## Changes Made
+
+- Bullet point list of changes
+- Be specific and detailed
+- Include any architectural decisions
+
+## Testing
+
+- [ ] Unit tests added/updated
+- [ ] E2E tests added/updated
+- [ ] All tests passing
+- [ ] Tested on Chrome
+- [ ] Tested on Firefox
+- [ ] Tested on Safari
+- [ ] Tested on mobile (if applicable)
+
+## Screenshots (if applicable)
+
+Add screenshots to demonstrate visual changes.
+
+## Performance Impact
+
+Describe any performance implications (bundle size, render time, etc.)
+
+## Checklist
+
+- [ ] Code follows style guidelines
+- [ ] Self-review completed
+- [ ] Comments added for complex logic
+- [ ] Documentation updated
+- [ ] No new warnings generated
+- [ ] Tests added and passing
+- [ ] Dependent changes merged
+```
+
+### Review Process
+
+1. **Automated Checks**
+
+ - GitHub Actions will run linting, tests, and build
+ - All checks must pass before merging
+
+2. **Code Review**
+
+ - At least one approving review required
+ - Address all review comments
+ - Re-request review after making changes
+
+3. **Merge**
+
+ - Squash and merge is preferred
+ - Delete branch after merging
+
+---
+
+## Issue Reporting Guidelines
+
+### Bug Reports
+
+When reporting bugs, please include:
+
+**Title:** Clear, descriptive summary of the bug
+
+**Description:**
+
+```markdown
+## Bug Description
+
+Clear and concise description of what the bug is.
+
+## Steps to Reproduce
+
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+## Expected Behavior
+
+What you expected to happen.
+
+## Actual Behavior
+
+What actually happened.
+
+## Screenshots
+
+If applicable, add screenshots to help explain the problem.
+
+## Environment
+
+- OS: [e.g. macOS 14.0, Windows 11, Ubuntu 22.04]
+- Browser: [e.g. Chrome 120, Firefox 121, Safari 17]
+- Node version: [e.g. v20.10.0]
+- npm version: [e.g. 10.2.0]
+
+## Additional Context
+
+Any other context about the problem.
+
+## Possible Solution (optional)
+
+Suggestions for fixing the bug.
+```
+
+**Labels:** Add appropriate labels (bug, critical, ui, etc.)
+
+### Feature Requests
+
+For new features:
+
+**Title:** Concise feature description
+
+**Description:**
+
+```markdown
+## Feature Description
+
+Clear description of the feature you'd like to see.
+
+## Problem it Solves
+
+What problem does this feature solve? Why is it needed?
+
+## Proposed Solution
+
+Detailed description of how you envision this feature working.
+
+## Alternatives Considered
+
+Other solutions you've considered and why this is better.
+
+## Additional Context
+
+Screenshots, mockups, or examples from other applications.
+
+## Acceptance Criteria
+
+- [ ] Criterion 1
+- [ ] Criterion 2
+- [ ] Criterion 3
+```
+
+**Labels:** Add appropriate labels (enhancement, feature, etc.)
+
+### Questions and Discussions
+
+For questions or general discussions:
+
+- Use [GitHub Discussions](https://github.com/kvnloo/ace/discussions) for:
+ - General questions
+ - Ideas and brainstorming
+ - Show and tell
+ - Community discussions
+- Use issues only for actionable bugs and feature requests
+
+---
+
+## Commit Message Guidelines
+
+We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification.
+
+### Format
+
+```
+():
+
+
+
+
@@ -15,6 +19,7 @@
LawnTech Dynamics is an innovative multi-floor racquet sports facility concept combining autonomous operations, sustainable grass cultivation, and AI-powered performance analytics. Located in Naperville, Illinois, this facility aims to revolutionize indoor sports through cutting-edge technology and sustainable practices.
### Core Innovation
+
- **🌱 Autonomous Grass Management**: Vertical farming system that grows and swaps court surfaces robotically
- **🤖 AI-Powered Operations**: Self-managing facility with minimal human oversight
- **📊 Performance Analytics**: Real-time biomechanics tracking and injury prevention
@@ -25,7 +30,9 @@ LawnTech Dynamics is an innovative multi-floor racquet sports facility concept c
## 🏗️ Facility Layout
### **Ground Floor** - Tennis Complex
+
24 premium tennis courts featuring:
+
- Grass courts (replaceable modular turf)
- Hard courts
- Clay courts
@@ -33,16 +40,20 @@ LawnTech Dynamics is an innovative multi-floor racquet sports facility concept c
- Pro shop and premium locker rooms
### **First Floor** - Mezzanine Sports
+
- 16 badminton courts
- 4 squash courts
- 16 table tennis stations
### **Second Floor** - Specialty Courts
+
- 8 pickleball courts
- 1 historic real tennis court
### **Third Floor** - Vertical Grass Lab
+
2,000 m² autonomous farming facility with:
+
- Hydroponics and climate control
- Robotic patch transport system
- 60-minute court surface replacement capability
@@ -52,6 +63,7 @@ LawnTech Dynamics is an innovative multi-floor racquet sports facility concept c
## 🚀 Technology Stack
### Frontend
+
- **React 19** with TypeScript
- **Framer Motion** for animations
- **Three.js** for 3D facility visualization
@@ -59,11 +71,13 @@ LawnTech Dynamics is an innovative multi-floor racquet sports facility concept c
- **Vite** for build tooling
### AI & Analytics
+
- **Google Gemini AI** for chat interface
- Computer vision for biomechanics analysis
- Predictive maintenance algorithms
### Autonomous Systems
+
- Building Management System (BMS)
- Robotic mowers and maintenance drones
- Biometric access control
@@ -74,6 +88,7 @@ LawnTech Dynamics is an innovative multi-floor racquet sports facility concept c
## 💻 Development
### Prerequisites
+
- Node.js (v20 or higher)
- npm or yarn
- Git
@@ -81,29 +96,52 @@ LawnTech Dynamics is an innovative multi-floor racquet sports facility concept c
### Local Setup
1. **Clone the repository**
+
```bash
git clone https://github.com/kvnloo/ace.git
cd ace
```
2. **Install dependencies**
+
```bash
npm install
```
-3. **Configure environment**
- Create a `.env.local` file:
+3. **Configure environment variables**
+
+ Copy the template file and add your configuration:
+
+ ```bash
+ cp .env.example .env.local
+ ```
+
+ Edit `.env.local` and set required variables:
+
```env
- GEMINI_API_KEY=your_api_key_here
+ # Google Gemini AI API Key (required for AI chat)
+ # Get key from: https://ai.google.dev/
+ VITE_GEMINI_API_KEY=your_gemini_api_key_here
+
+ # Optional: Debug mode
+ VITE_DEBUG_MODE=false
+
+ # Optional: Analytics
+ VITE_ANALYTICS_ENABLED=false
```
+ For detailed environment setup instructions, see [ENVIRONMENT.md](ENVIRONMENT.md).
+
4. **Start development server**
+
```bash
npm run dev
```
Open [http://localhost:3000](http://localhost:3000) in your browser
+ The application will validate environment variables at startup and show helpful error messages if anything is misconfigured.
+
### Build for Production
```bash
@@ -123,6 +161,7 @@ This project uses GitHub Actions for automated deployment to GitHub Pages:
See [Deployment Guide](.github/DEPLOYMENT.md) for detailed setup instructions.
### Deployment URLs
+
- Production: https://kvnloo.github.io/ace/
- Development: https://kvnloo.github.io/ace/dev/
@@ -131,26 +170,33 @@ See [Deployment Guide](.github/DEPLOYMENT.md) for detailed setup instructions.
## 🎨 Features
### Interactive 3D Facility Tour
+
Explore the entire facility complex with:
+
- Rotatable 3D visualization
- Interactive hotspots for each area
- Detailed feature information cards
### AI-Powered Chat Assistant
+
Get instant answers about:
+
- Facility features and amenities
- Membership options
- Technical specifications
- Court booking
### Real-Time Performance Analytics
+
- Biomechanics tracking at 60 FPS
- Serve speed analysis (225 km/h capability)
- Ground force measurement (1900 N torque)
- Pronation/supination tracking
### Autonomous Operations Dashboard
+
Monitor facility systems:
+
- Smart HVAC climate control
- Robotic maintenance status
- Court surface quality metrics
@@ -161,20 +207,25 @@ Monitor facility systems:
## 🏛️ Project Architecture
### Digital Twin Framework
+
Built on **OpenTwins** technology:
+
- **Eclipse Ditto**: Digital twin definitions
- **Eclipse Hono**: IoT device integration
- Real-time monitoring and control
- Predictive maintenance algorithms
### Agent-Based Automation
+
Inspired by Voyager and Eureka methodologies:
+
- **Automatic Curriculum**: Dynamic task progression
- **Skill Library**: Reusable action patterns
- **Reward Optimization**: Evolutionary performance tuning
- **Self-Verification**: Continuous improvement loops
### Feedback-Driven Learning
+
- Environment feedback integration
- Execution error analysis
- Iterative skill refinement
@@ -184,13 +235,13 @@ Inspired by Voyager and Eureka methodologies:
## 👥 Expert Roles
-| Role | Responsibility |
-|------|----------------|
-| **Architect** | Facility layout and safety compliance |
-| **Digital Twin Modeler** | Virtual replica and simulation systems |
-| **Automation Engineer** | Robotics and autonomous systems integration |
-| **Sports Surface Specialist** | Court maintenance and quality assurance |
-| **Building Systems Engineer** | BMS and energy optimization |
+| Role | Responsibility |
+| ----------------------------- | ------------------------------------------- |
+| **Architect** | Facility layout and safety compliance |
+| **Digital Twin Modeler** | Virtual replica and simulation systems |
+| **Automation Engineer** | Robotics and autonomous systems integration |
+| **Sports Surface Specialist** | Court maintenance and quality assurance |
+| **Building Systems Engineer** | BMS and energy optimization |
---
@@ -207,11 +258,13 @@ Inspired by Voyager and Eureka methodologies:
## 🤝 Partnerships & Funding
### Strategic Partnerships
+
- Local sports organizations for cost sharing
- Educational institutions for research collaboration
- Government agencies for sustainability grants
### Investment Opportunities
+
Currently raising Series A funding for Austin, Texas pilot facility.
Contact via the [Invest page](https://kvnloo.github.io/ace/) for more information.
@@ -220,18 +273,21 @@ Contact via the [Invest page](https://kvnloo.github.io/ace/) for more informatio
## 📊 Technical Specifications
### Data Collection
+
- Multi-sensor array for court conditions
- Environmental monitoring (temperature, humidity, air quality)
- Player movement tracking and analysis
- Real-time video analytics
### Simulation & Analysis
+
- Energy usage forecasting
- Maintenance schedule optimization
- Player traffic pattern analysis
- Resource allocation modeling
### System Integration
+
- Centralized control via BMS
- Real-time IoT device communication
- Cloud-based analytics platform
@@ -263,6 +319,7 @@ ace/
## 🔧 Configuration
### Base Path Configuration
+
The project supports dynamic base paths for multi-environment deployment:
```typescript
@@ -271,6 +328,7 @@ const base = process.env.VITE_BASE_PATH || '/';
```
Set via environment variable during build:
+
```bash
VITE_BASE_PATH=/dev/ npm run build
```
@@ -279,7 +337,24 @@ VITE_BASE_PATH=/dev/ npm run build
## 📖 Documentation
+### For Contributors
+
+- **[Contributing Guide](CONTRIBUTING.md)** - Complete guide for setting up your development environment, code style, testing, and pull requests
+- **[Architecture Documentation](ARCHITECTURE.md)** - Detailed project architecture, component hierarchy, data flow, and deployment pipeline
+
+### Project Documentation
+
- [Deployment Guide](.github/DEPLOYMENT.md) - GitHub Pages setup and troubleshooting
+- [CI/CD Pipeline](CI_CD.md) - Testing, quality gates, and automation
+- [Environment Setup](ENVIRONMENT.md) - Environment variable configuration
+- [TypeScript Guide](TYPESCRIPT.md) - TypeScript best practices and guidelines
+- [Testing Guide](E2E_TESTING.md) - End-to-end testing with Playwright
+- [Performance Guide](PERFORMANCE.md) - Performance optimization strategies
+- [Linting Guide](LINTING.md) - ESLint configuration and usage
+- [SEO Guide](SEO.md) - SEO implementation and best practices
+
+### Resources
+
- [AI Studio Link](https://ai.studio/apps/drive/1Fc7kvKrC_eN-FRp7CerebmQONPqJW6z2) - Original project workspace
---
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000..cc3f6ec
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,392 @@
+# Security Policy
+
+## Overview
+
+This document outlines the security measures implemented in the LawnTech Dynamics web application to protect against common web vulnerabilities and ensure data integrity.
+
+## Table of Contents
+
+- [Input Validation & Sanitization](#input-validation--sanitization)
+- [XSS Prevention](#xss-prevention)
+- [Rate Limiting](#rate-limiting)
+- [Form Security](#form-security)
+- [API Security](#api-security)
+- [Reporting Security Issues](#reporting-security-issues)
+- [Security Best Practices](#security-best-practices)
+
+## Input Validation & Sanitization
+
+### Validation Framework
+
+We use [Zod](https://github.com/colinhacks/zod) for runtime type checking and schema validation. All user inputs are validated before processing.
+
+**Location:** `/utils/validation.ts`
+
+### Validation Schemas
+
+#### 1. Invest Form Validation
+
+The investment inquiry form validates:
+
+- **Name Field**
+ - Minimum length: 2 characters
+ - Maximum length: 100 characters
+ - Allowed characters: Letters, spaces, hyphens, apostrophes
+ - Regex pattern: `/^[a-zA-Z\s'-]+$/`
+
+- **Email Field**
+ - Format: Valid email address
+ - Maximum length: 255 characters
+ - Automatically converted to lowercase
+ - Trimmed of whitespace
+
+- **Interest Level**
+ - Enum validation (Potential Investor, Founding Member, Technology Partner)
+
+- **Message Field**
+ - Minimum length: 10 characters
+ - Maximum length: 1000 characters
+ - HTML tags removed
+ - Script content sanitized
+
+#### 2. Chat Input Validation
+
+The AI chat input validates:
+
+- **Message Length**
+ - Minimum length: 1 character
+ - Maximum length: 500 characters
+
+- **Content Validation**
+ - Non-empty after trimming
+ - HTML tags removed
+ - Script content sanitized
+
+### Sanitization Functions
+
+```typescript
+// Remove HTML tags and potentially dangerous content
+sanitizeInput(input: string): string
+
+// Sanitize HTML for safe display
+sanitizeHTML(html: string): string
+
+// Validate and normalize email addresses
+sanitizeEmail(email: string): string
+
+// Check for malicious patterns
+containsMaliciousContent(input: string): boolean
+```
+
+## XSS Prevention
+
+### Protection Measures
+
+1. **Input Sanitization**
+ - All user inputs are sanitized before storage or display
+ - HTML tags are stripped from text inputs
+ - Script tags and event handlers are removed
+ - JavaScript protocol URLs are blocked
+
+2. **Dangerous Pattern Detection**
+
+ The following patterns are detected and blocked:
+ - `",
+ email: "test@test.com",
+ interestLevel: "Potential Investor",
+ message: "Normal message"
+};
+
+// This will fail validation and sanitize the name
+const result2 = validateInvestForm(maliciousData);
+// result2.success === false
+// Error: "Name can only contain letters, spaces, hyphens, and apostrophes"
+```
+
+### Testing Chat Validation
+
+```typescript
+// Valid message
+const validMessage = "What features does the facility have?";
+const result = validateChatInput(validMessage);
+// result.success === true
+// result.data === sanitized message
+
+// Invalid message (too long)
+const tooLongMessage = "a".repeat(501);
+const result2 = validateChatInput(tooLongMessage);
+// result2.success === false
+// result2.error === "Message must be less than 500 characters"
+
+// Invalid message (XSS attempt)
+const xssMessage = "

";
+const result3 = validateChatInput(xssMessage);
+// result3.success === true (passes validation)
+// result3.data === "" (sanitized to empty, which then fails validation)
+```
+
+## Security Updates
+
+### Version History
+
+- **v1.0.0** (Current)
+ - Initial security implementation
+ - Zod validation for all forms
+ - XSS prevention measures
+ - Rate limiting
+ - Input sanitization
+
+### Planned Security Enhancements
+
+- [ ] Server-side validation (when backend is implemented)
+- [ ] CSRF token protection
+- [ ] Content Security Policy (CSP) headers
+- [ ] Subresource Integrity (SRI) for CDN resources
+- [ ] Security headers (HSTS, X-Frame-Options, etc.)
+- [ ] Regular security audits
+- [ ] Automated vulnerability scanning in CI/CD
+
+## Additional Resources
+
+- [OWASP Top 10](https://owasp.org/www-project-top-ten/)
+- [Zod Documentation](https://zod.dev/)
+- [React Security Best Practices](https://react.dev/learn/writing-markup-with-jsx#xss)
+- [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)
+
+## Contact
+
+For security-related questions or concerns, contact: [Your Contact Information]
+
+---
+
+**Last Updated:** 2025-11-23
+**Version:** 1.0.0
diff --git a/SEO.md b/SEO.md
new file mode 100644
index 0000000..1bffed9
--- /dev/null
+++ b/SEO.md
@@ -0,0 +1,1013 @@
+# SEO Strategy & Implementation Guide - LawnTech Dynamics
+
+This document outlines the comprehensive SEO implementation for LawnTech Dynamics, including Open Graph support, structured data, and dynamic meta tag management.
+
+## Table of Contents
+
+1. [Overview](#overview)
+2. [Sitemap & Robots.txt](#sitemap--robotstxt)
+3. [Meta Tags Implementation](#meta-tags-implementation)
+4. [Open Graph Tags](#open-graph-tags)
+5. [Twitter Card Tags](#twitter-card-tags)
+6. [Structured Data (JSON-LD)](#structured-data)
+7. [Dynamic Meta Tags System](#dynamic-meta-tags-system)
+8. [Best Practices](#best-practices)
+9. [Testing & Validation](#testing--validation)
+10. [SEO Checklist](#seo-checklist)
+
+## Overview
+
+LawnTech Dynamics implements a comprehensive SEO strategy to maximize visibility and engagement across search engines and social media platforms. The implementation includes:
+
+- **Search Engine Discovery**: robots.txt and sitemap.xml for crawler guidance
+- **Site Indexing**: Dynamic sitemap generation for all routes
+- **Static SEO Tags**: Core meta tags in `index.html`
+- **Dynamic Tag Management**: React component system for updating tags on route changes
+- **Structured Data**: JSON-LD schemas for rich search results
+- **Social Media Optimization**: Open Graph and Twitter Card tags
+- **Mobile Optimization**: Mobile web app meta tags
+- **Performance**: Preconnect/preload directives for external resources
+
+## Sitemap & Robots.txt
+
+### Robots.txt
+
+**Location**: `/home/user/ace/public/robots.txt`
+
+The robots.txt file tells search engines which pages they can and cannot crawl on your website. It's placed in the root directory and is one of the first files search engines request.
+
+#### Key Directives
+
+- **User-agent**: Specifies which crawler the rules apply to (use `*` for all)
+- **Allow**: Permits crawling of specified paths
+- **Disallow**: Prevents crawling of specified paths
+- **Sitemap**: Directs crawlers to sitemap location
+- **Crawl-delay**: Specifies delay between requests (milliseconds)
+- **Request-rate**: Limits requests per time period
+
+#### Our Implementation
+
+```
+User-agent: *
+Allow: /
+Allow: /ace/
+Allow: /ace/dev/
+
+# Specify sitemap locations
+Sitemap: https://kvnloo.github.io/ace/sitemap.xml
+Sitemap: https://kvnloo.github.io/ace/dev/sitemap.xml
+
+# Allow major search engines
+User-agent: Googlebot
+Crawl-delay: 0
+
+User-agent: Bingbot
+Crawl-delay: 1
+
+# Block bad bots
+User-agent: MJ12bot
+Disallow: /
+
+User-agent: AhrefsBot
+Disallow: /
+
+# Allow social media crawlers
+User-agent: facebookexternalhit
+Allow: /
+
+User-agent: Twitterbot
+Allow: /
+```
+
+**Best Practices**:
+- Allow all search engines to crawl public content
+- Block known bad bots and aggressive crawlers
+- Include sitemap references
+- Use specific crawl-delay values for better resource management
+
+### Sitemap.xml
+
+**Location**: `/home/user/ace/public/sitemap.xml`
+
+The sitemap.xml file provides search engines with a complete list of all pages on your website, along with metadata about each page.
+
+#### Routes Included
+
+| Route | Priority | Change Frequency | Purpose |
+|-------|----------|-----------------|---------|
+| / | 1.0 | monthly | Home page - highest priority |
+| /#facility-demo | 0.9 | weekly | 3D interactive facility demo |
+| /#amenities | 0.85 | monthly | Facility amenities overview |
+| /#specifications | 0.9 | weekly | Technical specifications |
+| /#invest | 0.95 | weekly | Investment/funding information |
+
+#### XML Structure
+
+```xml
+
+
+
+ https://kvnloo.github.io/ace/
+ 2025-11-23
+ monthly
+ 1.0
+
+
+```
+
+#### Sitemap Generation
+
+The sitemap is automatically generated during the build process using the included script.
+
+**Scripts Available**:
+
+```bash
+# Generate sitemap for production (main branch)
+npm run generate:sitemap
+
+# Generate sitemap for dev branch
+npm run generate:sitemap:dev
+
+# Generate sitemap with custom parameters
+npm run generate:sitemap:custom
[outputPath]
+```
+
+**Example**:
+```bash
+node scripts/generate-sitemap.js https://lawntech-dynamics.com / ./public/sitemap.xml
+```
+
+**Script Location**: `/home/user/ace/scripts/generate-sitemap.js`
+
+**Features**:
+- Auto-generates sitemap based on defined routes
+- Updates `lastmod` timestamps automatically
+- Supports custom base URLs and paths
+- Mobile-friendly URLs marked with ``
+- Proper XML encoding and namespaces
+- Integrated into build pipeline
+
+#### Submitting to Search Engines
+
+After deployment, submit sitemaps to:
+
+1. **Google Search Console**: https://search.google.com/search-console
+ - Add your site property
+ - Go to Sitemaps section
+ - Add: `https://kvnloo.github.io/ace/sitemap.xml`
+
+2. **Bing Webmaster Tools**: https://www.bing.com/webmasters/
+ - Add your site
+ - Submit sitemap URL
+
+3. **Reference in robots.txt**:
+ - Already included: `Sitemap: https://kvnloo.github.io/ace/sitemap.xml`
+
+#### When to Regenerate
+
+The sitemap is automatically regenerated when:
+- You run `npm run build`
+- You add new routes to the application
+- The lastmod date updates automatically
+
+Manual regeneration:
+```bash
+npm run generate:sitemap
+```
+
+#### Sitemap Validation
+
+Validate your sitemap using:
+- **Google Search Console**: https://search.google.com/test/rich-results
+- **XML Sitemap Validator**: https://www.xml-sitemaps.com/validate-xml-sitemap.html
+- **Schema.org Validator**: https://schema.org/
+
+## Meta Tags Implementation
+
+### Core Meta Tags
+
+All core meta tags are defined in `/home/user/ace/index.html`:
+
+#### 1. Basic Meta Tags
+
+```html
+
+
+LawnTech Dynamics - Futuristic AI-Powered Indoor Tennis Facility
+
+
+
+```
+
+**Key Points:**
+
+- Title is optimized for search engines (50-60 characters, primary keyword first)
+- Description is compelling and action-oriented (150-160 characters)
+- Keywords target primary business terms
+- Author credit for brand recognition
+
+#### 2. Mobile & Theme Tags
+
+```html
+
+
+
+
+
+```
+
+**Benefits:**
+
+- Custom theme color appears in browser tabs (Chrome Mobile)
+- iOS recognition as web app
+- Consistent branding across mobile experiences
+- Better user experience on iOS devices
+
+#### 3. Favicon & Icons
+
+```html
+
+
+```
+
+**Implementation:**
+
+- SVG favicon with tennis ball emoji
+- Apple touch icon with brand colors (#2C5F2D, #DFFF4F)
+- Data URIs for zero additional HTTP requests
+
+#### 4. Canonical URL
+
+```html
+
+```
+
+**Purpose:**
+
+- Prevents duplicate content issues
+- Consolidates page authority
+- Essential for multi-version pages (mobile, desktop, international)
+- Should match og:url and twitter:url
+
+#### 5. Robots & Crawling
+
+```html
+
+
+
+
+```
+
+**Directives:**
+
+- `index, follow`: Allow indexing and link following
+- `max-image-preview:large`: Allow large image previews
+- `max-snippet:-1`: Allow unlimited text snippet length
+- `max-video-preview:-1`: Allow unlimited video preview length
+- `hreflang`: Declare language/region targeting for international SEO
+
+#### 6. Performance & Resource Hints
+
+```html
+
+
+
+
+```
+
+**Benefits:**
+
+- Reduces latency for critical external resources
+- Preconnect: Establishes early connection (DNS + TCP + TLS)
+- DNS-prefetch: Faster DNS lookups for non-critical resources
+- Improves Core Web Vitals (LCP, FID, CLS)
+
+## Open Graph Tags
+
+Open Graph tags enable rich preview cards when sharing on social media platforms.
+
+### Implementation
+
+```html
+
+
+
+
+
+
+
+
+
+
+```
+
+### Supported Platforms
+
+- **Facebook**: Uses og:title, og:description, og:image, og:url
+- **LinkedIn**: Uses og:title, og:description, og:image
+- **Pinterest**: Uses og:image, og:description (alt: og:title)
+- **Discord**: Uses og:title, og:description, og:image
+- **Slack**: Uses og:title, og:description, og:image
+- **WhatsApp**: Uses og:title, og:description, og:image
+
+### Image Specifications
+
+**Optimal Dimensions:**
+
+- **1200 x 630px** (1.91:1 ratio) - Standard
+- **1200 x 675px** - Alternative
+- **Minimum**: 600 x 314px
+- **Format**: JPG, PNG, or WebP
+- **Size**: Optimize for web (< 1MB recommended)
+
+**Image Content Best Practices:**
+
+- Include your logo or brand mark
+- Use high contrast colors
+- Show product/service in action
+- Avoid text-heavy designs
+- Ensure readable at thumbnail size
+
+### og:type Values
+
+Common types:
+
+- `website`: Default for general sites
+- `article`: Blog posts and news
+- `video.movie`: Video content
+- `music.song`: Music content
+- `product`: E-commerce products
+
+## Twitter Card Tags
+
+Twitter Cards provide enhanced sharing experience on Twitter (X).
+
+### Implementation
+
+```html
+
+
+
+
+
+
+
+
+```
+
+### Card Types
+
+1. **summary_large_image** (Recommended)
+ - Large image + title + description
+ - Best for rich media
+ - Image: 2:1 ratio recommended
+
+2. **summary**
+ - Small image + title + description
+ - Good for general pages
+
+3. **player**
+ - Video/audio player
+ - Requires additional player URL
+
+4. **app**
+ - Mobile app promotion
+ - Requires app store URLs
+
+### Image Specifications
+
+- **Minimum**: 300 x 157px
+- **Recommended**: 1200 x 630px
+- **Ratio**: 2:1 or 16:9
+- **Size**: Optimize for web
+
+### Attribution Tags
+
+- `twitter:creator`: Tweet author's Twitter handle
+- `twitter:site`: Website's Twitter handle
+- Both should be verified Twitter accounts
+
+## Structured Data
+
+Structured data (JSON-LD) provides semantic meaning to content, enabling rich snippets and knowledge panels.
+
+### 1. Organization Schema
+
+```json
+{
+ "@context": "https://schema.org",
+ "@type": "Organization",
+ "name": "LawnTech Dynamics",
+ "url": "https://lawntech-dynamics.com/",
+ "logo": "https://lawntech-dynamics.com/logo.svg",
+ "description": "An autonomous, AI-integrated indoor grass tennis facility...",
+ "sameAs": [
+ "https://twitter.com/lawntech_dynamics",
+ "https://linkedin.com/company/lawntech-dynamics",
+ "https://instagram.com/lawntech_dynamics"
+ ],
+ "contactPoint": {
+ "@type": "ContactPoint",
+ "contactType": "Customer Service",
+ "email": "info@lawntech-dynamics.com",
+ "availableLanguage": ["en"]
+ },
+ "address": {
+ "@type": "PostalAddress",
+ "streetAddress": "123 Innovation Drive",
+ "addressLocality": "Tech City",
+ "addressRegion": "ST",
+ "postalCode": "12345",
+ "addressCountry": "US"
+ }
+}
+```
+
+**Benefits:**
+
+- Enables knowledge panel in Google Search
+- Links social profiles for verification
+- Shows contact information
+- Adds credibility
+
+### 2. Website Schema
+
+```json
+{
+ "@context": "https://schema.org",
+ "@type": "WebSite",
+ "name": "LawnTech Dynamics",
+ "url": "https://lawntech-dynamics.com/",
+ "potentialAction": {
+ "@type": "SearchAction",
+ "target": {
+ "@type": "EntryPoint",
+ "urlTemplate": "https://lawntech-dynamics.com/search?q={search_term_string}"
+ },
+ "query-input": "required name=search_term_string"
+ }
+}
+```
+
+**Benefits:**
+
+- Enables sitelinks search box in Google Search
+- Improves CTR (Click-Through Rate)
+- Better site discoverability
+
+### 3. SportsActivityLocation Schema
+
+```json
+{
+ "@context": "https://schema.org",
+ "@type": "SportsActivityLocation",
+ "name": "LawnTech Dynamics",
+ "description": "AI-powered indoor grass tennis facility...",
+ "url": "https://lawntech-dynamics.com/",
+ "image": "https://lawntech-dynamics.com/facility-image.jpg",
+ "telephone": "+1-555-0123",
+ "email": "info@lawntech-dynamics.com",
+ "priceRange": "$$$$",
+ "sport": "Tennis",
+ "amenityFeature": [
+ { "@type": "Text", "text": "Indoor Grass Courts" },
+ { "@type": "Text", "text": "AI-Powered Analytics" },
+ { "@type": "Text", "text": "3D Visualization" },
+ { "@type": "Text", "text": "Real-time Coaching" }
+ ]
+}
+```
+
+**Benefits:**
+
+- Rich result formatting in search
+- Shows facility details and amenities
+- Contact information visible in results
+
+### Additional Recommended Schemas
+
+1. **BreadcrumbList**: For navigation hierarchy
+2. **Product**: For service/product pages
+3. **Review**: For testimonials and ratings
+4. **FAQPage**: For FAQ sections
+5. **VideoObject**: For embedded videos
+
+## Dynamic Meta Tags System
+
+### File Locations
+
+- **Service**: `/home/user/ace/services/seo.ts`
+- **React Component**: `/home/user/ace/components/SEOHelmet.tsx`
+
+### Basic Usage
+
+#### Method 1: SEOHelmet Component
+
+```tsx
+import { SEOHelmet } from './components/SEOHelmet';
+
+export function AboutPage() {
+ return (
+ <>
+
+ {/* Page content */}
+ >
+ );
+}
+```
+
+#### Method 2: useSEO Hook
+
+```tsx
+import { useSEO } from './components/SEOHelmet';
+
+export function ProductPage() {
+ const { setSEO } = useSEO();
+
+ useEffect(() => {
+ setSEO({
+ title: 'Premium Tennis Package - LawnTech',
+ description: 'Experience AI-powered tennis coaching with our premium package.',
+ canonical: 'https://lawntech-dynamics.com/products/premium',
+ ogType: 'product',
+ structuredData: {
+ '@context': 'https://schema.org',
+ '@type': 'Product',
+ name: 'Premium Tennis Package',
+ price: '99.99',
+ priceCurrency: 'USD',
+ },
+ });
+ }, [setSEO]);
+
+ return /* Page content */
;
+}
+```
+
+#### Method 3: Programmatic Updates
+
+```tsx
+import { updateSEO } from './services/seo';
+
+export function DynamicPage({ pageId }) {
+ useEffect(() => {
+ fetchPageData(pageId).then((data) => {
+ updateSEO({
+ title: data.title,
+ description: data.description,
+ canonical: `https://lawntech-dynamics.com/page/${pageId}`,
+ ogImage: data.imageUrl,
+ structuredData: {
+ '@context': 'https://schema.org',
+ '@type': 'Article',
+ headline: data.title,
+ description: data.description,
+ image: data.imageUrl,
+ author: data.author,
+ datePublished: data.publishedDate,
+ },
+ });
+ });
+ }, [pageId]);
+
+ return /* Page content */
;
+}
+```
+
+### Available Functions
+
+#### `updateSEO(config: SeoConfig)`
+
+Main function to update all SEO tags at once.
+
+#### `setPageTitle(title: string)`
+
+Update page title and title meta tags.
+
+#### `setDescription(description: string)`
+
+Update description meta tag across all platforms.
+
+#### `setOpenGraphTags(config: Partial)`
+
+Update Open Graph tags.
+
+#### `setTwitterCardTags(config: Partial)`
+
+Update Twitter Card tags.
+
+#### `setCanonicalUrl(url: string)`
+
+Set canonical URL for the page.
+
+#### `setRobots(robots: string)`
+
+Control search engine crawling behavior.
+
+#### `setStructuredData(data: Record)`
+
+Add or update JSON-LD structured data.
+
+#### Schema Generators
+
+```tsx
+import {
+ generateOrganizationSchema,
+ generateBreadcrumbSchema,
+ generateProductSchema,
+} from './services/seo';
+
+// Organization schema with overrides
+const orgSchema = generateOrganizationSchema({
+ address: {
+ '@type': 'PostalAddress',
+ streetAddress: 'New Address...',
+ },
+});
+
+// Breadcrumb schema for navigation
+const breadcrumb = generateBreadcrumbSchema([
+ { name: 'Home', url: 'https://lawntech-dynamics.com/' },
+ { name: 'Products', url: 'https://lawntech-dynamics.com/products' },
+ { name: 'Tennis Package', url: 'https://lawntech-dynamics.com/products/tennis' },
+]);
+
+// Product schema with pricing and ratings
+const productSchema = generateProductSchema({
+ name: 'Premium Tennis Package',
+ description: 'AI-powered tennis coaching',
+ image: 'https://lawntech-dynamics.com/product.jpg',
+ price: '99.99',
+ priceCurrency: 'USD',
+ ratingValue: 4.8,
+ ratingCount: 256,
+});
+
+// Use in your component
+updateSEO({
+ title: 'Product Page',
+ description: 'Check out our amazing product',
+ structuredData: productSchema,
+});
+```
+
+## Best Practices
+
+### 1. Title Tag Optimization
+
+```
+[Primary Keyword] - [Brand] | [Value Proposition]
+```
+
+**Good Examples:**
+
+- "Tennis Coaching AI - LawnTech | Real-time Performance Analysis"
+- "Indoor Grass Courts - LawnTech Dynamics | Book Now"
+
+**Best Practices:**
+
+- 50-60 characters (fits in SERP)
+- Include primary keyword early
+- Brand name at end
+- Unique per page
+- Front-load important keywords
+
+### 2. Meta Description Optimization
+
+**Structure:**
+
+```
+[Action-oriented verb] + [Value Proposition] + [CTA if applicable]
+```
+
+**Good Example:**
+"Discover AI-powered tennis coaching at LawnTech. Real-time analytics, performance tracking, and personalized coaching. Book your session today."
+
+**Best Practices:**
+
+- 150-160 characters
+- Include primary keyword naturally
+- Value proposition clear
+- CTA encourages clicks (optional)
+- Unique per page
+- No keyword stuffing
+
+### 3. Image Optimization for OG/Twitter
+
+1. **Design with Branding**
+ - Include logo/brand colors
+ - Use consistent visual style
+ - Maintain brand identity
+
+2. **Content Quality**
+ - Show product/service in action
+ - High contrast for readability
+ - Clear focal point
+ - Professional photography
+
+3. **Technical Optimization**
+ - 1200x630px for optimal display
+ - Compressed for web (< 500KB)
+ - Descriptive alt text
+ - Relevant to page content
+
+### 4. Structured Data Best Practices
+
+1. **Validate Schema**
+ - Use Google's Rich Results Test
+ - Validate at schema.org
+ - Check for warnings
+
+2. **Complete Information**
+ - Don't omit required properties
+ - Add optional recommended properties
+ - Keep data current
+
+3. **Multiple Schemas**
+ - Combine Organization + WebSite
+ - Add BreadcrumbList for navigation
+ - Include specific page type (Article, Product, etc.)
+
+### 5. URL Structure
+
+**Best Practices:**
+
+- Use descriptive, keyword-rich URLs
+- Keep URLs short and readable
+- Use hyphens to separate words (not underscores)
+- Lowercase only
+- No parameters if possible
+- HTTPS only
+- Consistent domain (www or no-www)
+
+**Examples:**
+
+- Good: `https://lawntech-dynamics.com/tennis-coaching`
+- Avoid: `https://lawntech-dynamics.com/page?id=123`
+
+### 6. Mobile-First Approach
+
+- Viewport meta tag configured
+- Mobile web app tags set
+- Touch icons optimized
+- Responsive design ensured
+- Mobile usability tested
+
+### 7. Social Media Optimization
+
+- Share-worthy content
+- High-quality OG images
+- Compelling descriptions
+- Brand-consistent messaging
+- Call-to-action buttons
+
+### 8. International SEO
+
+If expanding internationally:
+
+```html
+
+
+
+```
+
+## Testing & Validation
+
+### 1. Meta Tags Validation
+
+**Browser DevTools:**
+
+```javascript
+// Check all meta tags
+document.querySelectorAll('meta[property^="og:"]');
+document.querySelectorAll('meta[name^="twitter:"]');
+document.querySelectorAll('meta[name="description"]');
+```
+
+### 2. Rich Results Testing
+
+- **Google Rich Results Test**: https://search.google.com/test/rich-results
+- **Facebook Sharing Debugger**: https://developers.facebook.com/tools/debug/
+- **Twitter Card Validator**: https://cards-dev.twitter.com/validator
+- **LinkedIn Post Inspector**: https://www.linkedin.com/post-inspector/
+
+### 3. Structured Data Validation
+
+- **Google Structured Data Tester**: https://schema.org/
+- **JSON-LD Validator**: https://jsonld.com/validator/
+- **Schema.org Validator**: https://www.schema.org/
+
+### 4. SEO Audits
+
+- **Google PageSpeed Insights**: https://pagespeed.web.dev/
+- **Google Search Console**: https://search.google.com/search-console
+- **Lighthouse**: Built into Chrome DevTools
+- **SEMrush SEO Audit**: https://www.semrush.com/
+
+### 5. Testing Checklist
+
+```javascript
+// Verify SEO implementation
+const seoTests = {
+ hasTitle: () => document.title.length > 0,
+ hasDescription: () => document.querySelector('meta[name="description"]')?.content.length > 0,
+ hasCanonical: () => document.querySelector('link[rel="canonical"]') !== null,
+ hasOGTags: () => document.querySelectorAll('meta[property^="og:"]').length > 3,
+ hasTwitterTags: () => document.querySelectorAll('meta[name^="twitter:"]').length > 3,
+ hasStructuredData: () => document.querySelector('script[type="application/ld+json"]') !== null,
+ isHttps: () => location.protocol === 'https:',
+ hasMobileViewport: () => document.querySelector('meta[name="viewport"]') !== null,
+};
+
+Object.entries(seoTests).forEach(([test, fn]) => {
+ console.log(`${test}: ${fn() ? 'PASS' : 'FAIL'}`);
+});
+```
+
+## SEO Checklist
+
+### Pre-Launch Checklist
+
+- [ ] robots.txt created and properly configured
+ - [ ] All public content allowed
+ - [ ] Bad bots blocked appropriately
+ - [ ] Sitemap references included
+- [ ] sitemap.xml generated and validated
+ - [ ] All routes included
+ - [ ] Priority values set correctly
+ - [ ] Change frequency updated
+ - [ ] lastmod timestamps valid
+- [ ] All meta tags populated with relevant content
+- [ ] Title tags are unique and optimized
+- [ ] Meta descriptions are compelling
+- [ ] Open Graph images optimized and hosted
+- [ ] Twitter Card configuration verified
+- [ ] Canonical URLs set correctly
+- [ ] Robots meta tag configured
+- [ ] JSON-LD structured data validated
+- [ ] Mobile viewport meta tag present
+- [ ] Touch icons configured
+- [ ] Favicon configured
+- [ ] Theme color set
+- [ ] Preconnect/DNS-prefetch directives added
+- [ ] HTTPS enabled
+- [ ] sitemap.xml generation script integrated in build
+- [ ] Google Search Console connected
+ - [ ] Sitemap submitted
+ - [ ] robots.txt verified
+- [ ] Google Analytics configured
+- [ ] Rich results tested in Google Tool
+- [ ] Social sharing tested on all platforms
+
+### Ongoing Maintenance
+
+- [ ] Regenerate sitemap when new routes added
+ - [ ] Run: `npm run generate:sitemap`
+ - [ ] Verify all new pages included
+ - [ ] Update priorities as needed
+- [ ] Review and update robots.txt quarterly
+ - [ ] Check for new bot threats
+ - [ ] Adjust crawl delays if needed
+ - [ ] Verify sitemap references
+- [ ] Monitor Google Search Console for issues
+ - [ ] Review crawl errors
+ - [ ] Check sitemap crawl status
+ - [ ] Monitor robots.txt validity
+- [ ] Track keyword rankings monthly
+- [ ] Update meta tags for new pages
+- [ ] Refresh OG images periodically
+- [ ] Monitor Core Web Vitals
+- [ ] Check for broken internal links
+- [ ] Audit meta descriptions for CTR
+- [ ] Review and update structured data
+- [ ] Test social sharing regularly
+- [ ] Monitor mobile usability scores
+
+### Performance Metrics to Track
+
+- **Organic Traffic**: Monthly visitors from search
+- **Click-Through Rate (CTR)**: Percentage clicking from search results
+- **Average Position**: Average ranking for target keywords
+- **Impressions**: Number of times site appears in search results
+- **Conversion Rate**: Percentage completing desired action
+- **Bounce Rate**: Percentage leaving without interaction
+- **Session Duration**: Average time spent on site
+- **Core Web Vitals**: LCP, FID, CLS scores
+
+## Advanced Topics
+
+### Implementing Breadcrumb Schema
+
+```tsx
+import { generateBreadcrumbSchema, updateSEO } from './services/seo';
+import { useLocation } from 'react-router-dom';
+
+export function BreadcrumbNavigation() {
+ const location = useLocation();
+
+ useEffect(() => {
+ const segments = location.pathname.split('/').filter(Boolean);
+ const breadcrumbs = [
+ { name: 'Home', url: 'https://lawntech-dynamics.com/' },
+ ...segments.map((segment, index) => ({
+ name: segment.charAt(0).toUpperCase() + segment.slice(1).replace('-', ' '),
+ url: `https://lawntech-dynamics.com/${segments.slice(0, index + 1).join('/')}`,
+ })),
+ ];
+
+ updateSEO({
+ structuredData: generateBreadcrumbSchema(breadcrumbs),
+ });
+ }, [location]);
+
+ return ;
+}
+```
+
+### Article Schema for Blog Posts
+
+```tsx
+export function BlogPost({ article }) {
+ const { setSEO } = useSEO();
+
+ useEffect(() => {
+ setSEO({
+ title: article.title,
+ description: article.excerpt,
+ canonical: `https://lawntech-dynamics.com/blog/${article.slug}`,
+ ogType: 'article',
+ ogImage: article.featuredImage,
+ structuredData: {
+ '@context': 'https://schema.org',
+ '@type': 'NewsArticle',
+ headline: article.title,
+ description: article.excerpt,
+ image: [article.featuredImage],
+ datePublished: article.publishedDate,
+ dateModified: article.updatedDate,
+ author: {
+ '@type': 'Person',
+ name: article.author,
+ },
+ publisher: {
+ '@type': 'Organization',
+ name: 'LawnTech Dynamics',
+ logo: {
+ '@type': 'ImageObject',
+ url: 'https://lawntech-dynamics.com/logo.svg',
+ },
+ },
+ },
+ });
+ }, [article, setSEO]);
+
+ return {/* Article content */}
;
+}
+```
+
+## Resources
+
+- [Schema.org Documentation](https://schema.org/)
+- [Google Search Central Guide](https://developers.google.com/search/docs)
+- [Open Graph Protocol](https://ogp.me/)
+- [Twitter Cards Documentation](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/abouts-cards)
+- [MDN Web Docs - Meta Tags](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta)
+- [Web Accessibility Guidelines](https://www.w3.org/WAI/WCAG21/quickref/)
+
+## Conclusion
+
+This comprehensive SEO implementation ensures LawnTech Dynamics is fully optimized for:
+
+- Search engine visibility
+- Social media sharing
+- Rich snippets and knowledge panels
+- Mobile user experience
+- Accessibility and user engagement
+
+Regular monitoring and updates of these SEO elements will maintain and improve search visibility and user engagement metrics.
diff --git a/SEO_QUICK_START.md b/SEO_QUICK_START.md
new file mode 100644
index 0000000..27cfb03
--- /dev/null
+++ b/SEO_QUICK_START.md
@@ -0,0 +1,365 @@
+# SEO Quick Start Guide - LawnTech Dynamics
+
+## Overview
+
+This quick reference shows how to use the SEO system implemented in your project.
+
+## Files Created
+
+| File | Purpose |
+| ----------------------------------------- | ---------------------------------------- |
+| `/home/user/ace/index.html` | Updated with comprehensive SEO meta tags |
+| `/home/user/ace/services/seo.ts` | Core SEO utility service |
+| `/home/user/ace/components/SEOHelmet.tsx` | React component wrapper |
+| `/home/user/ace/SEO.md` | Comprehensive documentation (23KB) |
+
+## Quick Usage
+
+### Method 1: Component Approach (Recommended)
+
+```tsx
+import { SEOHelmet } from './components/SEOHelmet';
+
+export function HomePage() {
+ return (
+ <>
+
+ {/* Your page content */}
+ >
+ );
+}
+```
+
+### Method 2: Hook Approach
+
+```tsx
+import { useSEO } from './components/SEOHelmet';
+import { useEffect } from 'react';
+
+export function ProductPage({ product }) {
+ const { setSEO, setStructuredData } = useSEO();
+
+ useEffect(() => {
+ setSEO({
+ title: `${product.name} - LawnTech`,
+ description: product.shortDescription,
+ canonical: `https://lawntech-dynamics.com/products/${product.id}`,
+ ogImage: product.imageUrl,
+ ogType: 'product',
+ });
+
+ setStructuredData({
+ '@context': 'https://schema.org',
+ '@type': 'Product',
+ name: product.name,
+ description: product.description,
+ price: product.price,
+ priceCurrency: 'USD',
+ });
+ }, [product, setSEO, setStructuredData]);
+
+ return {/* Product content */}
;
+}
+```
+
+### Method 3: Direct Function Calls
+
+```tsx
+import { updateSEO, generateBreadcrumbSchema } from './services/seo';
+
+// Update all tags at once
+updateSEO({
+ title: 'About LawnTech',
+ description: 'Learn about our mission...',
+ keywords: 'tennis, AI, facility',
+ canonical: 'https://lawntech-dynamics.com/about',
+ ogImage: 'https://lawntech-dynamics.com/about-hero.jpg',
+});
+
+// Generate and set structured data
+const breadcrumbs = generateBreadcrumbSchema([
+ { name: 'Home', url: 'https://lawntech-dynamics.com/' },
+ { name: 'About', url: 'https://lawntech-dynamics.com/about' },
+]);
+updateSEO({ structuredData: breadcrumbs });
+```
+
+## Static Meta Tags in index.html
+
+The following meta tags are already configured in `index.html`:
+
+### Primary Tags
+
+- Title: Optimized for search engines
+- Meta Description: Compelling call-to-action
+- Keywords: Relevant search terms
+- Author: Brand name
+- Theme Color: #DFFF4F (Tennis yellow)
+
+### Open Graph Tags (11 tags)
+
+- og:type, og:url, og:title, og:description
+- og:image, og:image:alt, og:image:width, og:image:height
+- og:site_name, og:locale
+- Plus LinkedIn fallbacks
+
+### Twitter Card Tags (8 tags)
+
+- twitter:card (summary_large_image)
+- twitter:title, twitter:description, twitter:image
+- twitter:image:alt, twitter:creator, twitter:site
+- twitter:url
+
+### Mobile & Web App Tags
+
+- viewport meta tag
+- apple-mobile-web-app-capable
+- apple-mobile-web-app-status-bar-style
+- apple-mobile-web-app-title
+- mobile-web-app-capable
+
+### Performance Tags
+
+- Canonical URL
+- Favicon (SVG emoji)
+- Apple touch icon
+- Preconnect directives (fonts, CDN)
+- DNS-prefetch for external resources
+
+### Structured Data (3 schemas)
+
+1. Organization Schema - Knowledge panel data
+2. Website Schema - Sitelinks search box
+3. SportsActivityLocation Schema - Rich results
+
+### Robots & Indexing
+
+- robots meta tag with detailed directives
+- hreflang tags for international variants
+
+## API Reference
+
+### Main Functions
+
+```typescript
+// Update all tags at once
+updateSEO(config: SeoConfig): void
+
+// Update specific tags
+setPageTitle(title: string): void
+setDescription(description: string): void
+setOpenGraphTags(config: Partial): void
+setTwitterCardTags(config: Partial): void
+setCanonicalUrl(url: string): void
+setRobots(robots: string): void
+setKeywords(keywords: string): void
+setStructuredData(data: Record): void
+
+// Schema generators
+generateOrganizationSchema(overrides?: Record): Record
+generateBreadcrumbSchema(items: Array<{name: string; url: string}>): Record
+generateProductSchema(config: {...}): Record
+
+// Reset to defaults
+resetSEO(): void
+```
+
+### SeoConfig Interface
+
+```typescript
+interface SeoConfig {
+ title?: string;
+ description?: string;
+ keywords?: string;
+ canonical?: string;
+ author?: string;
+ robots?: string;
+
+ // Open Graph
+ ogType?: string;
+ ogTitle?: string;
+ ogDescription?: string;
+ ogImage?: string;
+ ogImageAlt?: string;
+ ogImageWidth?: string;
+ ogImageHeight?: string;
+ ogUrl?: string;
+ ogSiteName?: string;
+ ogLocale?: string;
+
+ // Twitter Card
+ twitterCard?: string;
+ twitterTitle?: string;
+ twitterDescription?: string;
+ twitterImage?: string;
+ twitterImageAlt?: string;
+ twitterCreator?: string;
+ twitterSite?: string;
+
+ // Structured Data
+ structuredData?: Record;
+}
+```
+
+## Best Practices
+
+### Title Tags
+
+- 50-60 characters
+- Include primary keyword
+- Brand at the end
+- Unique per page
+
+**Example:** `"AI Tennis Coaching - LawnTech | Real-time Analytics"`
+
+### Meta Descriptions
+
+- 150-160 characters
+- Include keyword naturally
+- Action-oriented
+- Compelling CTA
+
+**Example:** `"Discover AI-powered tennis coaching with real-time performance analysis. Book your session at LawnTech Dynamics today."`
+
+### Open Graph Images
+
+- 1200 x 630 pixels (1.91:1 ratio)
+- Include logo/branding
+- High contrast
+- < 500KB optimized
+
+### Canonical URLs
+
+- Use full URLs
+- Must match og:url
+- Set for every page
+- Prevent duplicate content issues
+
+### Structured Data
+
+- Validate with Google Rich Results Test
+- Include required properties
+- Use appropriate schema types
+- Update when content changes
+
+## Testing Your Implementation
+
+### Browser DevTools
+
+```javascript
+// Check all meta tags
+document.querySelectorAll('meta[property^="og:"]');
+document.querySelectorAll('meta[name^="twitter:"]');
+
+// Check structured data
+document.querySelector('script[type="application/ld+json"]');
+```
+
+### Tools
+
+- **Google Rich Results Test**: https://search.google.com/test/rich-results
+- **Facebook Sharing Debugger**: https://developers.facebook.com/tools/debug/
+- **Twitter Card Validator**: https://cards-dev.twitter.com/validator
+- **Google PageSpeed**: https://pagespeed.web.dev/
+
+## Common Patterns
+
+### Product/Service Page
+
+```tsx
+
+```
+
+### Blog Article
+
+```tsx
+
+```
+
+### Category/Listing Page
+
+```tsx
+
+```
+
+## SEO Checklist
+
+Before deploying any page:
+
+- [ ] Title tag (50-60 chars)
+- [ ] Meta description (150-160 chars)
+- [ ] Canonical URL set
+- [ ] Open Graph tags configured
+- [ ] Twitter Card tags configured
+- [ ] Structured data added
+- [ ] Mobile viewport verified
+- [ ] Internal links checked
+- [ ] Images optimized and have alt text
+- [ ] Page loads on HTTPS
+
+## Performance Impact
+
+- **Zero runtime overhead**: Meta tags are updated synchronously
+- **Lightweight**: ~9KB service code, ~2KB component code
+- **No dependencies**: Pure TypeScript/React (no external libraries)
+- **Efficient updates**: Only modified tags are updated in DOM
+- **SEO best practices**: Follows Google and Schema.org guidelines
+
+## Support
+
+For detailed documentation, see `/home/user/ace/SEO.md`
+
+For implementation help, refer to the examples in this file and the React component samples.
+
+## Next Steps
+
+1. Update og:image URL to point to actual image file
+2. Set up Twitter account handles
+3. Add Google Search Console tracking
+4. Configure Analytics tracking
+5. Test with Google Rich Results Tool
+6. Monitor performance in Google Search Console
diff --git a/TEST_SUMMARY.md b/TEST_SUMMARY.md
new file mode 100644
index 0000000..b1fc87d
--- /dev/null
+++ b/TEST_SUMMARY.md
@@ -0,0 +1,183 @@
+# Component Tests Summary
+
+## Overview
+Comprehensive component tests have been successfully written using React Testing Library and Vitest.
+
+## Test Coverage Achieved
+
+### Files Tested
+1. **types.ts** - 100% coverage (8 tests)
+2. **components/NavBar.tsx** - 100% coverage (20 tests)
+3. **components/Specifications.tsx** - 100% coverage (36 tests)
+
+### Overall Coverage: 100%
+- Statements: 100%
+- Branches: 100%
+- Functions: 100%
+- Lines: 100%
+
+**Total: 64 tests passing**
+
+## Test Details
+
+### types.ts Tests (8 tests)
+- View enum validation (3 tests)
+ - Verifies all 5 view types exist
+ - Validates unique values
+ - Tests enum structure
+- FeatureData interface (2 tests)
+ - Validates object structure
+ - Tests position tuple handling
+- ChatMessage interface (3 tests)
+ - Tests user and model messages
+ - Validates role types
+ - Tests text field handling
+
+### NavBar Component Tests (20 tests)
+
+#### Rendering (5 tests)
+- Logo and branding display
+- All navigation items render
+- JOIN WAITING LIST button
+- Active view highlighting
+- Mobile menu toggle button
+
+#### Navigation Interactions (7 tests)
+- Logo click navigates to home
+- All nav items trigger view changes (5 views)
+- Waiting list button navigation
+
+#### Mobile Menu (3 tests)
+- Initial state (hidden)
+- Toggle functionality
+- Menu closes on nav item click
+
+#### Accessibility (3 tests)
+- Semantic nav element
+- Proper button roles
+- Semantic button elements
+
+#### Visual States (2 tests)
+- Active view styling
+- Inactive view styling
+
+### Specifications Component Tests (36 tests)
+
+#### Rendering (3 tests)
+- Main heading display
+- Subtitle content
+- All 5 specification categories
+
+#### Ground Floor: Tennis Arena (5 tests)
+- Hard courts specification
+- Clay courts specification
+- Grass courts specification
+- Wood courts specification
+- Amenities display
+
+#### Level 1: Racquet Sports (4 tests)
+- Badminton courts
+- Squash courts
+- Table tennis
+- Flooring information
+
+#### Level 2: Social & Heritage (3 tests)
+- Pickleball courts
+- Real tennis court
+- Viewing decks
+
+#### Level 3: Vertical Farming (4 tests)
+- Farming area
+- Technology
+- Lighting information
+- Robot fleet
+
+#### Autonomous Systems (4 tests)
+- Access control
+- Monitoring system
+- Energy system
+- Irrigation system
+
+#### Visual Elements (3 tests)
+- Category icons
+- Check mark icons
+- Grid layout
+
+#### Data Structure (2 tests)
+- Specification cards count
+- Category headings hierarchy
+
+#### Content Completeness (2 tests)
+- Tennis arena items
+- Numeric values accuracy
+
+#### Accessibility (3 tests)
+- Main heading for screen readers
+- Semantic list structure
+- Proper heading hierarchy
+
+#### Layout and Styling (3 tests)
+- Max-width container
+- Responsive padding
+- Card styling classes
+
+## Best Practices Applied
+
+### React Testing Library
+- ✅ Tested user behavior, not implementation details
+- ✅ Used semantic queries (getByRole, getByText)
+- ✅ Avoided testing implementation details
+- ✅ Focused on accessibility
+
+### User Interactions
+- ✅ Tested click events with userEvent library
+- ✅ Validated state changes after interactions
+- ✅ Tested mobile menu toggle behavior
+
+### Accessibility Testing
+- ✅ Semantic HTML validation
+- ✅ Proper heading hierarchy
+- ✅ ARIA roles verification
+- ✅ Button accessibility
+
+### Code Quality
+- ✅ Well-organized test suites with descriptive names
+- ✅ Isolated test cases with proper setup/teardown
+- ✅ Mock functions for callbacks
+- ✅ Comprehensive edge case coverage
+
+## Testing Setup
+
+### Dependencies Installed
+- vitest: ^2.1.8
+- @testing-library/react: ^16.1.0
+- @testing-library/jest-dom: ^6.6.3
+- @testing-library/user-event: ^14.5.2
+- @vitest/ui: ^2.1.8
+- jsdom: ^25.0.1
+
+### Configuration Files
+- **vite.config.ts**: Added test configuration with jsdom environment
+- **test-setup.ts**: Global test setup with jest-dom matchers
+- **package.json**: Added test scripts (test, test:ui, test:coverage)
+
+## Running Tests
+
+```bash
+# Run all tests
+npm test
+
+# Run tests with UI
+npm run test:ui
+
+# Run tests with coverage
+npm run test:coverage
+```
+
+## Results
+✅ All 64 tests passing
+✅ 100% code coverage on tested files
+✅ Exceeds 70% coverage target
+✅ Zero test failures
+✅ Comprehensive user interaction testing
+✅ Full accessibility coverage
diff --git a/TYPESCRIPT.md b/TYPESCRIPT.md
new file mode 100644
index 0000000..6cb302b
--- /dev/null
+++ b/TYPESCRIPT.md
@@ -0,0 +1,266 @@
+# TypeScript Configuration & Type Safety Improvements
+
+## Overview
+
+This document outlines the TypeScript strict mode configuration and type safety improvements implemented in the LawnTech Dynamics project.
+
+## Strict Mode Configuration
+
+### Enabled Compiler Options
+
+The following strict type checking options have been enabled in `tsconfig.json`:
+
+#### Core Strict Flags
+
+- **`strict: true`** - Enables all strict type checking options
+- **`noUncheckedIndexedAccess: true`** - Ensures indexed access operations return potentially undefined types
+- **`noImplicitReturns: true`** - Ensures all code paths in a function return a value
+- **`noFallthroughCasesInSwitch: true`** - Reports errors for fallthrough cases in switch statements
+
+#### Individual Strict Checks (enabled by `strict: true`)
+
+- **`noImplicitAny: true`** - Raises error on expressions and declarations with an implied 'any' type
+- **`strictNullChecks: true`** - Enables strict null checking
+- **`strictFunctionTypes: true`** - Enables strict checking of function types
+- **`strictBindCallApply: true`** - Enables strict 'bind', 'call', and 'apply' methods on functions
+- **`strictPropertyInitialization: true`** - Ensures class properties are initialized
+- **`noImplicitThis: true`** - Raises error on 'this' expressions with an implied 'any' type
+- **`alwaysStrict: true`** - Parse files in strict mode and emit "use strict"
+
+## Type Improvements by File
+
+### 1. Environment Types (`/home/user/ace/types/environment.d.ts`)
+
+Created comprehensive type definitions for environment variables:
+
+```typescript
+declare global {
+ namespace NodeJS {
+ interface ProcessEnv {
+ API_KEY?: string;
+ GEMINI_API_KEY?: string;
+ VITE_BASE_PATH?: string;
+ NODE_ENV?: 'development' | 'production' | 'test';
+ }
+ }
+}
+```
+
+**Benefits:**
+- Type-safe access to `process.env` variables
+- Auto-completion in IDEs
+- Compile-time validation of environment variable usage
+
+### 2. Gemini Service (`/home/user/ace/services/geminiService.ts`)
+
+Added proper type definitions for the Gemini AI service:
+
+```typescript
+interface MessagePart {
+ text: string;
+}
+
+interface GeminiMessage {
+ role: string;
+ parts: MessagePart[];
+}
+
+interface GeminiConfig {
+ systemInstruction: string;
+ temperature: number;
+}
+
+interface GeminiResponse {
+ text?: string;
+}
+```
+
+**Improvements:**
+- Removed `any` type usage
+- Added proper typing for message history
+- Improved error handling with type guards
+- Added comprehensive JSDoc comments
+- Used nullish coalescing operator (`??`) for safer fallback values
+
+**Type Safety Enhancements:**
+```typescript
+// Before
+const response = await client.models.generateContent({
+ contents: history as any,
+ // ...
+});
+
+// After
+const response: GeminiResponse = await client.models.generateContent({
+ contents: history,
+ config: { /* ... */ } as GeminiConfig
+});
+```
+
+### 3. Web Vitals Analytics (`/home/user/ace/utils/analytics.ts`)
+
+Updated to use web-vitals v5 API:
+
+**Changes:**
+- Migrated from deprecated `getLCP`, `getFID`, `getCLS`, `getTTFB`, `getINP` to new `onLCP`, `onFCP`, `onCLS`, `onTTFB`, `onINP` functions
+- Removed deprecated FID metric (replaced by INP)
+- Added FCP (First Contentful Paint) metric
+- Properly typed all metric callbacks using the `Metric` type from web-vitals
+
+### 4. SEO Service (`/home/user/ace/services/seo.ts`)
+
+**Improvements:**
+- Exported `setStructuredData` as a named export for proper import
+- All functions properly typed with explicit parameter and return types
+- Maintained type safety across DOM manipulation
+
+### 5. Vite Configuration (`/home/user/ace/vite.config.ts`)
+
+Fixed potential undefined access errors:
+
+```typescript
+// Before
+assetFileNames: (assetInfo) => {
+ let extType = assetInfo.name.split('.').pop();
+ // ...
+}
+
+// After
+assetFileNames: (assetInfo) => {
+ const name = assetInfo.name;
+ if (!name) {
+ return `assets/[name]-[hash][extname]`;
+ }
+ const extType = name.split('.').pop() ?? '';
+ // ...
+}
+```
+
+### 6. Framer Motion Variants (`/home/user/ace/App.tsx`)
+
+Fixed type compatibility with Framer Motion's `Variants` type:
+
+```typescript
+// Before
+const pageVariants = {
+ enter: { opacity: 1, y: 0, transition: { duration: 0.6, ease: [0.22, 1, 0.36, 1] } }
+};
+
+// After
+const pageVariants = {
+ enter: {
+ opacity: 1,
+ y: 0,
+ transition: {
+ duration: 0.6,
+ ease: [0.22, 1, 0.36, 1] as const
+ }
+ }
+};
+```
+
+**Reason:** Added `as const` assertion to the easing array to satisfy Framer Motion's stricter type requirements.
+
+## Dependencies Added
+
+- **`@types/react-dom`** - Added to provide type definitions for react-dom/client
+
+## Testing Considerations
+
+### Test Files (Optional Fixes)
+
+The following test files have type errors that can be fixed if testing is enabled:
+
+- `components/NavBar.test.tsx` - Requires null checks for `querySelector` results
+- `e2e/homepage.spec.ts` - Requires `@playwright/test` types
+- `playwright.config.ts` - Requires `@playwright/test` types
+- `test/setup.ts` - Requires vitest and testing-library types
+
+**Note:** These errors only affect test files and do not impact the production build.
+
+## Best Practices Followed
+
+1. **No `any` Types** - Eliminated all unnecessary `any` types
+2. **Explicit Return Types** - All public functions have explicit return type annotations
+3. **Null Safety** - Proper handling of potentially null/undefined values
+4. **Type Guards** - Used type guards for error handling (`error instanceof Error`)
+5. **Const Assertions** - Used `as const` for literal types where appropriate
+6. **Nullish Coalescing** - Used `??` operator for safer fallback values
+
+## Build Validation
+
+To validate TypeScript compilation:
+
+```bash
+# Check for type errors
+npm run type-check
+
+# Or manually
+npx tsc --noEmit
+```
+
+## Benefits of Strict Mode
+
+1. **Catch Errors Earlier** - Type errors caught at compile-time instead of runtime
+2. **Better IDE Support** - Improved auto-completion and inline documentation
+3. **Safer Refactoring** - TypeScript catches breaking changes during refactoring
+4. **Self-Documenting Code** - Types serve as inline documentation
+5. **Reduced Bugs** - Null/undefined errors caught before deployment
+
+## Migration Notes
+
+All main source code files pass strict type checking. Test files may require additional type fixes if testing infrastructure is set up, but these do not affect production builds.
+
+## Future Improvements
+
+1. Consider enabling additional strict flags as they become available in TypeScript
+2. Add type definitions for any third-party libraries that lack them
+3. Create shared type utilities for common patterns
+4. Document component prop types for better reusability
+
+## Summary
+
+The codebase now has comprehensive type safety with:
+- ✅ Strict null checks enabled
+- ✅ No implicit any types
+- ✅ Proper return type checking
+- ✅ Environment variable typing
+- ✅ External library type compatibility
+- ✅ **Zero type errors in production code**
+
+### Files Modified
+
+#### Configuration
+- `/home/user/ace/tsconfig.json` - Enabled strict mode and additional checks
+
+#### Type Definitions
+- `/home/user/ace/types/environment.d.ts` - New file for process.env types
+
+#### Services
+- `/home/user/ace/services/geminiService.ts` - Added comprehensive type definitions
+- `/home/user/ace/services/seo.ts` - Exported setStructuredData function
+
+#### Utilities
+- `/home/user/ace/utils/analytics.ts` - Updated to web-vitals v5 API
+- `/home/user/ace/utils/focusTrap.ts` - Fixed undefined checks and React import
+- `/home/user/ace/vite.config.ts` - Fixed potential undefined access
+
+#### Components
+- `/home/user/ace/App.tsx` - Fixed Framer Motion variant types
+
+#### Dependencies
+- Added `@types/react-dom` for React DOM type definitions
+
+### Type Error Status
+
+**Production Code:** ✅ 0 errors
+**Test Files:** ⚠️ 10 errors (optional, do not affect builds)
+
+All test-related errors are in:
+- `components/NavBar.test.tsx`
+- `e2e/homepage.spec.ts`
+- `playwright.config.ts`
+
+These can be fixed if testing infrastructure is set up but do not impact production builds.
+
+All changes maintain backward compatibility and functionality while significantly improving type safety and developer experience.
diff --git a/components/AIChat.tsx b/components/AIChat.tsx
index 7e02a5e..a71cd84 100644
--- a/components/AIChat.tsx
+++ b/components/AIChat.tsx
@@ -1,51 +1,153 @@
import React, { useState, useRef, useEffect } from 'react';
import { motion, AnimatePresence } from 'framer-motion';
-import { MessageSquare, X, Send, Bot, Loader2 } from 'lucide-react';
+import { MessageSquare, X, Send, Bot, Loader2, AlertCircle } from 'lucide-react';
import { sendQueryToConcierge } from '../services/geminiService';
-import { ChatMessage } from '../types';
+import type { ChatMessage } from '../types';
+import { validateChatInput, RateLimiter } from '../utils/validation';
+/**
+ * AIChat Component - Intelligent conversational assistant for facility information
+ *
+ * A floating chat widget that provides an AI-powered concierge service to answer
+ * questions about the LawnTech Dynamics facility. Features include:
+ *
+ * - Toggleable chat window with smooth animations (Framer Motion)
+ * - Real-time message display with user/model message differentiation
+ * - Auto-scrolling to latest messages
+ * - Loading indicators for AI responses
+ * - Integration with Google Gemini API via geminiService
+ * - Responsive design for mobile and desktop
+ * - Enter key support for quick message sending
+ *
+ * The chat maintains conversation history and sends the full history to the API
+ * for context-aware responses about the facility.
+ *
+ * @component
+ * @example
+ * ```tsx
+ * // Simple usage - renders as a floating chat widget
+ *
+ * ```
+ *
+ * @example
+ * ```tsx
+ * // Typically placed in your main layout
+ * return (
+ *
+ *
+ *
+ *
+ * );
+ * ```
+ *
+ * @returns {React.ReactElement} A floating chat widget with toggle button
+ */
const AIChat: React.FC = () => {
+ /** Controls whether the chat window is open or closed */
const [isOpen, setIsOpen] = useState(false);
+
+ /** Current user input text in the chat input field */
const [input, setInput] = useState('');
+
+ /** Loading state while waiting for AI response */
const [isLoading, setIsLoading] = useState(false);
+
+ /** Input validation error message */
+ const [inputError, setInputError] = useState('');
+
+ /** Array of chat messages (user and model) in conversation history */
const [messages, setMessages] = useState([
- { role: 'model', text: "Welcome to LawnTech Dynamics. I'm your AI Concierge. Ask me about our autonomous grass courts or replacement modular grids." }
+ {
+ role: 'model',
+ text: "Welcome to LawnTech Dynamics. I'm your AI Concierge. Ask me about our autonomous grass courts or replacement modular grids.",
+ },
]);
+
+ /** Reference to messages container for auto-scroll functionality */
const scrollRef = useRef(null);
+ /** Rate limiter to prevent spam (1 second cooldown) */
+ const rateLimiterRef = useRef(new RateLimiter(1000));
+
+ /**
+ * Effect Hook: Auto-scroll to latest message
+ * Scrolls the message container to the bottom whenever new messages arrive
+ */
useEffect(() => {
if (scrollRef.current) {
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
}
}, [messages]);
+ /**
+ * Handler for sending messages to the AI
+ * - Validates and sanitizes input
+ * - Checks rate limiting to prevent spam
+ * - Adds user message to chat optimistically
+ * - Calls geminiService API with full conversation history
+ * - Updates UI with AI response
+ * - Handles loading states and errors for smooth UX
+ */
const handleSend = async () => {
- if (!input.trim()) return;
-
- const userMsgText = input;
+ // Clear any previous errors
+ setInputError('');
+
+ // Check rate limiting
+ if (!rateLimiterRef.current.canSubmit()) {
+ const remaining = Math.ceil(
+ rateLimiterRef.current.getRemainingCooldown() / 1000
+ );
+ setInputError(`Please wait ${remaining}s before sending another message`);
+ return;
+ }
+
+ // Validate and sanitize input
+ const validationResult = validateChatInput(input);
+
+ if (!validationResult.success) {
+ setInputError(validationResult.error);
+ return;
+ }
+
+ const sanitizedInput = validationResult.data;
setInput('');
-
- const newUserMsg: ChatMessage = { role: 'user', text: userMsgText };
-
- // Optimistic update of UI
+
+ const newUserMsg: ChatMessage = { role: 'user', text: sanitizedInput };
+
+ // Optimistic update of UI - show user message immediately
const newMessages = [...messages, newUserMsg];
setMessages(newMessages);
setIsLoading(true);
- // Prepare history for API (converting to SDK format)
- const history = newMessages.map(m => ({
- role: m.role,
- parts: [{ text: m.text }]
- }));
+ // Record submission for rate limiting
+ rateLimiterRef.current.recordSubmission();
+
+ try {
+ // Prepare history for API (converting to SDK format)
+ const history = newMessages.map((m) => ({
+ role: m.role,
+ parts: [{ text: m.text }],
+ }));
- const responseText = await sendQueryToConcierge(history);
-
- setMessages(prev => [...prev, { role: 'model', text: responseText }]);
- setIsLoading(false);
+ const responseText = await sendQueryToConcierge(history);
+
+ setMessages((prev) => [...prev, { role: 'model', text: responseText }]);
+ } catch (_error) {
+ // Handle API errors gracefully
+ setMessages((prev) => [
+ ...prev,
+ {
+ role: 'model',
+ text: 'Sorry, I encountered an error processing your request. Please try again.',
+ },
+ ]);
+ } finally {
+ setIsLoading(false);
+ }
};
return (
-
+