How shivambonde/parental_engagement works
Project Type and Purpose
• This is a single-page application (SPA) front-end built with React and Vite.
• It provides parent/teacher dashboards, attendance tracking, scheduling, offline support, and an AI Bot.
• It communicates with a back-end REST API (via src/utils/api.jsx), supports multiple languages, and offers offline sync.
File Structure
• Presentation Layer:
• src/pages (Home, Login, Signup, Dashboard, AiBot)
• src/components (organized into subfolders: Dashboard, Attendance, Teacher, LanguageSettings, OfflineSupport)
• State & Business Logic:
• src/context (AuthContext, LanguageContext)
• src/hooks (useAuth, useOfflineMode)
• Data & Integration Layer:
• src/utils/api.jsx (HTTP client/REST calls)
• src/utils/helpers.jsx (shared helper functions)
• Assets & Public Files:
• public/assets (videos, static media)
• index.html, public/index.html
• Build & Config:
• vite.config.js (Vite config)
• postcss.config.js, tailwind.config.js (styling pipeline)
• .eslintrc.cjs (lint rules)
README Insights
• Confirms React + Vite stack with fast refresh via Babel or SWC plugin.
• No explicit back-end in this repo—assume it calls external API endpoints.
Main Components & Their Interactions
a. Presentation Layer (UI):
• Top: src/pages render route containers.
• Nested: src/components provide reusable widgets (Dashboard panels, forms, lists).
b. State Management:
• AuthContext & LanguageContext provide global state.
• Hooks (useAuth, useOfflineMode) abstract auth logic and offline detection.
c. Data Layer:
• api.jsx exposes functions to call backend REST endpoints (e.g., getAttendance, postNotice).
• OfflineSync component caches requests and syncs when online.
d. External Services:
• REST API server (authentication, data CRUD).
• CDN or storage for public assets.
• (Optional) Third-party translation or AI services for AiBot page.
e. Build Tooling & Dev Server:
• Vite dev server handles HMR, ESLint plugin enforces code style, TailwindCSS for styling.
Architectural Patterns & Design Principles
• Component-Based Architecture: Clear separation between pages (routes) and reusable components.
• Context API for cross-cutting state (auth, locale).
• Custom Hooks to encapsulate side-effects and reusability.
• Single Responsibility for each folder/module.
• Offline-first considerations with service-worker style sync.