How hospitality-pos/property_ui works
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.