2.7 KiB
2.7 KiB
Copilot Instructions for in-car-system-fe
Project Overview
- Type: React + TypeScript SPA using Vite
- Purpose: In-car system frontend for camera management, sighting history, and system settings
- Key Directories:
src/components/: UI components grouped by feature (Camera, Sighting, Settings, etc.)src/context/: React context for global state (e.g., AlertHit, NPEDUser, SightingFeed)src/hooks/: Custom React hooks for data fetching, config, and UI logicsrc/pages/: Top-level route views (Dashboard, Camera, Session, SystemSettings)src/types/: Shared TypeScript typessrc/utils/: Utility functions and config helpers
Architecture & Patterns
- Component Structure:
- Feature-based folders (e.g.,
CameraSettings,SightingOverview) - Components are mostly functional, using hooks and context for state
- Feature-based folders (e.g.,
- State Management:
- Uses React Context for cross-component state (see
src/context/providers/) - Reducers in
src/context/reducers/for complex state updates
- Uses React Context for cross-component state (see
- Data Flow:
- Data is fetched and managed via custom hooks (see
src/hooks/) - Context providers wrap the app in
main.tsx
- Data is fetched and managed via custom hooks (see
- Styling:
- CSS modules (e.g.,
App.css,index.css) - No CSS-in-JS or styled-components
- CSS modules (e.g.,
Developer Workflows
- Install:
npm install - Start Dev Server:
npm run dev - Build:
npm run build - Preview Build:
npm run preview - Lint:
npm run lint(uses ESLint, seeeslint.config.js) - Type Check:
tsc --noEmit - Test: No test framework configured by default
Project Conventions
- TypeScript:
- All components and hooks are typed; shared types in
src/types/types.ts
- All components and hooks are typed; shared types in
- Component Naming:
- Use PascalCase for components and folders
- Suffix with
Container,Card, orModalfor UI roles
- Assets:
- Images in
public/orsrc/assets/ - Sounds in
src/assets/sounds/
- Images in
- No Redux, MobX, or external state libraries
- No backend API code in this repo
Integration Points
- External:
- No direct backend integration code; data is assumed to come from context/hooks
- Sound assets for UI feedback in
src/assets/sounds/ui/
Examples
- Add a new camera setting:
- Create a new component in
src/components/CameraSettings/ - Add state via context or a custom hook if needed
- Create a new component in
- Add a new page:
- Add a file to
src/pages/and update routing in the main app (seemain.tsx)
- Add a file to
References
- See
README.mdfor Vite/ESLint setup details - See
src/context/andsrc/hooks/for app-specific state/data patterns
If any conventions or workflows are unclear, please ask for clarification or examples from the codebase.