Files
IGP-Fan-Reference/docs/AI Gen Docs/architecture.md
T
2026-05-31 14:33:58 -04:00

33 lines
1.9 KiB
Markdown

# Project Architecture
The IGP Fan Reference is structured as a modular .NET solution, separating concerns between data models, business logic, and UI components.
## Solution Structure
- **IGP**: The main Blazor WebAssembly project. Contains pages, portals, and application-specific logic.
- **Model**: Domain models and data structures. It is a shared library used by the Services and the main app.
- `Model.BuildOrders`: Logic for build order sequences.
- `Model.Entity`: Unit and building definitions.
- `Model.Website`: Models for UI state and navigation.
- **Services**: Contains the core business logic.
- `Services.Immortal`: Game-specific logic (Economy, Timings, Unit stats).
- `Services.Website`: Infrastructure services (Navigation, Storage, Search, Dialogs).
- **Components**: A shared library for reusable Razor components used across different pages.
- **TestAutomation**: E2E tests using Playwright to ensure feature stability.
## Dependency Injection
Services are registered in `Program.cs` and injected into components using `@inject`. Most services are registered as `Scoped`, which in Blazor WASM behaves like a singleton for the duration of the user session.
## State Management
- **Blazored.LocalStorage**: Used to persist user settings and data (e.g., custom build orders, preferences) across sessions.
- **In-Memory Services**: Services like `StorageService` and `ImmortalSelectionService` maintain the active state during the application's runtime.
## UI & Layout
The app uses **MudBlazor** for its component library, providing a consistent Material Design look and feel.
- `App.razor`: The entry point for the Blazor app, handles routing and global portals.
- `PageLayout.razor`: Defines the main layout, including the AppBar, Drawer (for mobile), and main content area.
- **Portals**: Components like `EntityDialogPortal` are placed at the root level to allow global access to common dialogs via services.