# hospitality-pos/property_ui architecture

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

- Interactive diagram: https://gitdiagram.com/hospitality-pos/property_ui
- Repository: https://github.com/hospitality-pos/property_ui

## Overview

##### Main Components
- Umi Configuration & Setup: At the top level, you have the Umi-specific configuration files such as .umirc.ts and package.json, which define the routing, plugins, and build/start options.
- Entry & Global Setup: The src/app.tsx along with other global files (global.less, tailwind.css, tailwind.config.js) set up styling, global state, and potentially error boundaries or layout wrappers.
- Pages (Routing & Views): The src/pages directory organizes the large set of view components for various application routes – for example, Login, Dashboard, Customer, Lead, Reports, Sales, etc. This indicates that your routing is managed by Umi, which maps URLs to these pages.
- Services (API & Logic): In src/services, you have API service files (auth.api.ts, customer.ts, lead.ts, etc.) which encapsulate the logic for communicating with the backend APIs. This abstracts network requests and error handling, allowing pages and components to call these services.
- Util & Constant Layers: The src/utils and src/constants directories contain helper functions (e.g., format, getToken, query utilities) and global constants that support the application logic.

##### Relationships and Interactions
- The Application Entry (src/app.tsx) initializes the Umi app and connects with the routing system defined in .umirc.ts.
- The Pages directory serves as the navigational layer. Each page leverages one or more components from src/components to construct the UI.
- Within these pages and components, the Services layer is used to fetch and send data to external backends. The direction is from UI interactions (e.g., clicking a button on a modal or table) to service calls that then update state / data.
- The Utils and Constants layers are integrated into both pages and services to ensure standard formatting, token handling, and query management.

##### Architectural Patterns and Design Principles
- Component-Based Architecture: A large number of reusable components in the components directory indicate that the project is modular and that UI concerns are separated from business logic.
- Separation of Concerns: There is a clear split across presentation (pages/components) and data fetching (services) layers.
- Routing and Global State: Umi’s conventions are used for routing, while state might be managed via Umi’s context, React hooks, or even the FiltersContext found within the Reports subdirectory.
- Clean Code Practices: With ESLint, Prettier, Stylelint and husky configurations present, there’s a commitment to code quality and consistency.

- Integration points (like the usage of FiltersContext in reports, the utilization of utilities for token handling) as annotations if needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Umi Configuration & Bootstrap"
        config1[".umirc.ts"]:::config
        config2["package.json"]:::config
    end

    subgraph "Entry Point & Global Setup"
        entry1["App Entry (src/app.tsx)"]:::entry
        entry2["Global Styles (global.less)"]:::entry
        entry3["Global Styles (tailwind.css)"]:::entry
        entry4["Global Config (tailwind.config.js)"]:::entry
    end

    subgraph "Pages (Routing & Views)"
        pages["Pages Directory (src/pages)"]:::pages
    end

    subgraph "UI Components"
        layout["Layout Components"]:::comp
        modals["Modal Components"]:::comp
        tables["Table Components"]:::comp
        charts["Chart Components"]:::comp
        drawers["Drawer Components"]:::comp
        filters["Filter Components"]:::comp
        phone["Phone Number Components"]:::comp
        statistics["Statistics Components"]:::comp
    end

    subgraph "Services (API & Logic)"
        services["API Services (src/services)"]:::services
    end

    subgraph "Util & Constant Layers"
        utils["Utils (src/utils)"]:::util
        consts["Constants (src/constants)"]:::util
    end

    external["External APIs/Backend"]:::external

    %% Relationships
    config1 --> entry1
    config2 --> entry1
    entry1 --> pages
    pages --> layout
    pages --> modals
    pages --> tables
    pages --> charts
    pages --> drawers
    pages --> filters
    pages --> phone
    pages --> statistics
    layout --> services
    modals --> services
    tables --> services
    charts --> services
    drawers --> services
    filters --> services
    phone --> services
    statistics --> services
    services --> external

    %% Utilities integration
    pages --- utils
    pages --- consts
    services --- utils
    services --- consts

    %% Click Events
    click config1 "https://github.com/hospitality-pos/property_ui/blob/master/.umirc.ts"
    click config2 "https://github.com/hospitality-pos/property_ui/blob/master/package.json"
    click entry1 "https://github.com/hospitality-pos/property_ui/blob/master/src/app.tsx"
    click entry2 "https://github.com/hospitality-pos/property_ui/blob/master/global.less"
    click entry3 "https://github.com/hospitality-pos/property_ui/blob/master/tailwind.css"
    click entry4 "https://github.com/hospitality-pos/property_ui/blob/master/tailwind.config.js"
    click pages "https://github.com/hospitality-pos/property_ui/tree/master/src/pages"
    click layout "https://github.com/hospitality-pos/property_ui/blob/master/src/components/Layout/index.tsx"
    click modals "https://github.com/hospitality-pos/property_ui/tree/master/src/components/Modals"
    click tables "https://github.com/hospitality-pos/property_ui/tree/master/src/components/Tables"
    click charts "https://github.com/hospitality-pos/property_ui/blob/master/src/components/charts/dashboardCharts.tsx"
    click drawers "https://github.com/hospitality-pos/property_ui/tree/master/src/components/drawers"
    click filters "https://github.com/hospitality-pos/property_ui/tree/master/src/components/filters"
    click phone "https://github.com/hospitality-pos/property_ui/tree/master/src/components/phonenumber"
    click statistics "https://github.com/hospitality-pos/property_ui/tree/master/src/components/statistics"
    click services "https://github.com/hospitality-pos/property_ui/tree/master/src/services"
    click utils "https://github.com/hospitality-pos/property_ui/tree/master/src/utils"
    click consts "https://github.com/hospitality-pos/property_ui/tree/master/src/constants"

    %% Styles
    classDef config fill:#f9ebea,stroke:#e74c3c,stroke-width:2px;
    classDef entry fill:#ebf5fb,stroke:#3498db,stroke-width:2px;
    classDef pages fill:#e8f8f5,stroke:#1abc9c,stroke-width:2px;
    classDef comp fill:#fcf3cf,stroke:#f1c40f,stroke-width:2px;
    classDef services fill:#f5eef8,stroke:#8e44ad,stroke-width:2px;
    classDef util fill:#e9f7ef,stroke:#27ae60,stroke-width:2px;
    classDef external fill:#f0f3f4,stroke:#7f8c8d,stroke-width:2px;
```
