How safaasamir/tenniscourt works
Project type and purpose
• This is a single-page web application (SPA) built with React and Vite.
• It appears to be a court-booking or reservation UI (components like GridCourtCard, SliderCourt, PaymobCallback, ThanksPage, RejectPage, OrderDetailsPage).
File structure
Top-level build & config:
• package.json, vite.config.js, postcss.config.js, tailwind.config.js, eslint.config.js
• index.html (app shell)
• public/ (static assets)
Source tree under src/:
• src/main.jsx & src/index.css (entry point & global styles)
• src/Root.jsx (router & context providers)
• src/context/LanguageContext.jsx (global state management)
• src/Layouts/… (layout components: Header, Footer, Modal, Form, PaymobCallback page wrapper)
• src/Pages/… (views: LandingPage, OrderDetailsPage, RejectPage, ThanksPage, NotFound)
• src/Components/… (reusable UI widgets: Input, DateInput, CustomDatePicker, SliderCourt, SelectInput)
• src/utils/validation/FormSchema.js (form validation logic)
• src/assets & src/Css (images and CSS modules)
README
• Confirms minimal React + Vite setup, HMR, ESLint, official React plugin for Vite.
Main components
a. Build & Tooling
• Vite dev server / bundler
• PostCSS, Tailwind CSS, ESLint
• Babel or SWC plugin for fast refresh
b. Application Shell
• index.html
• main.jsx → Root.jsx → Context Providers → Layouts & Pages
c. UI Layer
• Pages (routing targets)
• Layouts (common wrappers: Header, Footer, Modal)
• Components (form inputs, date picker, court slider, cards)
d. State Management
• LanguageContext (React Context)
• Local component state & validation (FormSchema)
e. Data & API interactions
• External payment gateway (Paymob API callback endpoint)
• Possible backend REST / GraphQL endpoints for booking orders
f. Static assets
• public/ (served as-is)
• src/assets & CSS modules
Relationships & data flow
• Developer machine → (npm run dev) → Vite dev server → Serves index.html + HMR → Browser
• Browser loads React SPA → Root.jsx → React Router (Pages)
• Pages orchestrate Layouts & Components → invoke form validation → send booking/payment requests to backend or Paymob
• Paymob → redirects to PaymobCallback route → app shows success or failure page
• Context provides language settings across all components
Architectural patterns & design principles
• Component hierarchy: Pages → Layouts → Components
• Separation of concerns: UI vs. validation vs. state vs. assets
• Single source of truth: Context for global state (language)
• Build pipeline: Vite plugin system, PostCSS & Tailwind modular styling