# safaasamir/tenniscourt architecture

> Architecture diagram of the GitHub repository safaasamir/tenniscourt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/safaasamir/tenniscourt
- Repository: https://github.com/safaasamir/tenniscourt

## Overview

##### 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

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build & Deployment Layer
    subgraph "Build & Deployment" 
        direction TB
        VITE["Vite Dev Server / Bundler"]:::build
        POSTCSS["PostCSS Configuration"]:::build
        TAILWIND["Tailwind CSS Configuration"]:::build
        ESLINT["ESLint Configuration"]:::build
        PACKAGE["package.json & package-lock.json"]:::build
    end

    %% Runtime Layer
    subgraph "Runtime: Browser & React SPA"
        direction TB

        %% Entry & Shell
        subgraph "Entry & Bootstrapping"
            direction TB
            HTML["index.html"]:::entry
            MAIN["src/main.jsx"]:::entry
            ROOT["src/Root.jsx"]:::entry
        end

        %% Context Providers
        subgraph "Context Providers"
            direction TB
            LANGCTX["LanguageContext"]:::context
        end

        %% Validation Logic
        VALID["FormSchema.js"]:::validation

        %% UI Layer
        subgraph "UI Layer"
            direction TB

            subgraph "Pages" 
                direction TB
                LANDING["LandingPage.jsx"]:::pages
                ORDER["OrderDetailsPage.jsx"]:::pages
                REJECT["RejectPage.jsx"]:::pages
                THANKS["ThanksPage.jsx"]:::pages
                NOTFOUND["NotFound.jsx"]:::pages
            end

            subgraph "Layouts"
                direction TB
                HEADER["Header.jsx"]:::layouts
                FOOTER["Footer.jsx"]:::layouts
                MODAL["Modal.jsx"]:::layouts
                FORM["Form.jsx"]:::layouts
                PAYCALL["PaymobCallback.jsx"]:::layouts
                SLIDERIMG["SliderImage.jsx"]:::layouts
                COURTCARDLAY["CourtCard.jsx"]:::layouts
                ABOUTUS["AboutUs.jsx"]:::layouts
            end

            subgraph "Components"
                direction TB
                INPUT["Input.jsx"]:::components
                DATEIN["DateInput.jsx"]:::components
                CDP["CustomDatePicker.jsx"]:::components
                SELECT["SelectInput.jsx"]:::components
                SLIDERCRT["SliderCourt.jsx"]:::components
                GRIDCRT["GridCourtCard.jsx"]:::components
            end
        end

        %% Static Assets
        subgraph "Static Assets"
            direction TB
            PUBLIC["public/"]:::assets
            ASSETS["src/assets/"]:::assets
            CSSMOD["src/Css/"]:::assets
        end
    end

    %% External Services Layer
    subgraph "External Services"
        direction TB
        BACKEND["Backend API"]:::services
        PAYMOB["Paymob API"]:::services
    end

    %% Connections
    Developer["Developer Machine"]:::developer -->|npm run dev| VITE
    VITE -->|"serves + HMR"| HTML
    HTML --> MAIN
    MAIN --> ROOT
    ROOT --> LANGCTX
    ROOT --> LANDING & ORDER & REJECT & THANKS & NOTFOUND
    LANDING & ORDER & REJECT & THANKS & NOTFOUND --> HEADER & FOOTER & MODAL & FORM & SLIDERIMG & COURTCARDLAY & ABOUTUS
    FORM --> INPUT & DATEIN & CDP & SELECT
    SLIDERIMG --> SLIDERCRT
    COURTCARDLAY --> GRIDCRT
    FORM & LANDING & ORDER --> VALID
    LANDING & ORDER -->|HTTP Requests| BACKEND
    ORDER -->|Payment Redirect| PAYMOB
    PAYMOB -->|Callback| PAYCALL
    PAYCALL --> THANKS & REJECT

    %% Click Events
    click VITE "https://github.com/safaasamir/tenniscourt/blob/main/vite.config.js"
    click POSTCSS "https://github.com/safaasamir/tenniscourt/blob/main/postcss.config.js"
    click TAILWIND "https://github.com/safaasamir/tenniscourt/blob/main/tailwind.config.js"
    click ESLINT "https://github.com/safaasamir/tenniscourt/blob/main/eslint.config.js"
    click PACKAGE "https://github.com/safaasamir/tenniscourt/blob/main/package.json"
    click HTML "https://github.com/safaasamir/tenniscourt/blob/main/index.html"
    click MAIN "https://github.com/safaasamir/tenniscourt/blob/main/src/main.jsx"
    click ROOT "https://github.com/safaasamir/tenniscourt/blob/main/src/Root.jsx"
    click LANGCTX "https://github.com/safaasamir/tenniscourt/blob/main/src/context/LanguageContext.jsx"
    click HEADER "https://github.com/safaasamir/tenniscourt/blob/main/src/Layouts/Header.jsx"
    click FOOTER "https://github.com/safaasamir/tenniscourt/blob/main/src/Layouts/Footer.jsx"
    click MODAL "https://github.com/safaasamir/tenniscourt/blob/main/src/Layouts/Modal.jsx"
    click FORM "https://github.com/safaasamir/tenniscourt/blob/main/src/Layouts/Form.jsx"
    click PAYCALL "https://github.com/safaasamir/tenniscourt/blob/main/src/Layouts/PaymobCallback.jsx"
    click SLIDERIMG "https://github.com/safaasamir/tenniscourt/blob/main/src/Layouts/SliderImage.jsx"
    click COURTCARDLAY "https://github.com/safaasamir/tenniscourt/blob/main/src/Layouts/CourtCard.jsx"
    click ABOUTUS "https://github.com/safaasamir/tenniscourt/blob/main/src/Layouts/AboutUs.jsx"
    click LANDING "https://github.com/safaasamir/tenniscourt/blob/main/src/Pages/LandingPage.jsx"
    click ORDER "https://github.com/safaasamir/tenniscourt/blob/main/src/Pages/OrderDetailsPage.jsx"
    click REJECT "https://github.com/safaasamir/tenniscourt/blob/main/src/Pages/RejectPage.jsx"
    click THANKS "https://github.com/safaasamir/tenniscourt/blob/main/src/Pages/ThanksPage.jsx"
    click NOTFOUND "https://github.com/safaasamir/tenniscourt/blob/main/src/Pages/NotFound.jsx"
    click INPUT "https://github.com/safaasamir/tenniscourt/blob/main/src/Components/Input.jsx"
    click DATEIN "https://github.com/safaasamir/tenniscourt/blob/main/src/Components/DateInput.jsx"
    click CDP "https://github.com/safaasamir/tenniscourt/blob/main/src/Components/CustomDatePicker.jsx"
    click SELECT "https://github.com/safaasamir/tenniscourt/blob/main/src/Components/SelectInput.jsx"
    click SLIDERCRT "https://github.com/safaasamir/tenniscourt/blob/main/src/Components/SliderCourt.jsx"
    click GRIDCRT "https://github.com/safaasamir/tenniscourt/blob/main/src/Components/GridCourtCard.jsx"
    click VALID "https://github.com/safaasamir/tenniscourt/blob/main/src/utils/validation/FormSchema.js"
    click PUBLIC "https://github.com/safaasamir/tenniscourt/tree/main/public/"
    click ASSETS "https://github.com/safaasamir/tenniscourt/tree/main/src/assets/"
    click CSSMOD "https://github.com/safaasamir/tenniscourt/tree/main/src/Css/"

    %% Styles
    classDef build fill:#fefbd8,stroke:#b59f3b,stroke-width:1px
    classDef entry fill:#d0e1f9,stroke:#1e50a2,stroke-width:1px
    classDef context fill:#e6f7e6,stroke:#2f8f2f,stroke-width:1px
    classDef pages fill:#fde2e2,stroke:#d9381e,stroke-width:1px
    classDef layouts fill:#f3e8ff,stroke:#8a2be2,stroke-width:1px
    classDef components fill:#fff0e1,stroke:#d35400,stroke-width:1px
    classDef validation fill:#ffe6f2,stroke:#c71585,stroke-width:1px
    classDef assets fill:#e0e0e0,stroke:#707070,stroke-width:1px
    classDef services fill:#e0f7fa,stroke:#007c91,stroke-width:1px
    classDef developer fill:#cccccc,stroke:#888888,stroke-width:1px,stroke-dasharray: 5 5
```
