This commit is contained in:
2026-06-04 11:29:24 -04:00
parent 377a041afa
commit 2625992014
16 changed files with 125 additions and 26 deletions
+7 -20
View File
@@ -42,30 +42,16 @@
"state": {
"type": "markdown",
"state": {
"file": "Helper Tutorial Info Improvements.md",
"file": "Device MAUI Pages Setup.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "Helper Tutorial Info Improvements"
}
},
{
"id": "b98a69cefb529fc8",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Feature Proposals.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "Feature Proposals"
"title": "Device MAUI Pages Setup"
}
}
],
"currentTab": 3
"currentTab": 2
}
],
"direction": "vertical"
@@ -237,8 +223,11 @@
"bases:Create new base": false
}
},
"active": "b98a69cefb529fc8",
"active": "68e1ba2b54081b9a",
"lastOpenFiles": [
"Build Calculator CmdLine.md",
"Device MAUI Pages Setup.md",
"Feature Proposals.md",
"_Tasks Kanban.base",
"Tasks/Worker Income UI and Tests.md",
"Tasks/Update the Reference Tables with Telerik.md",
@@ -263,8 +252,6 @@
"Tasks/Get AI to Add easy Test Tasks.md",
"Tasks/Helper Tutorial Info Improvements.md",
"Tasks/Fix Entity Recursion Error - Parent.md",
"Tasks/Fully Test the Build Calculator.md",
"Tasks/Ensure build order gets greyed out past the attack time. Clicking the cancel button will wipe the entire greyed out timeline..md",
"Tasks",
"Images/Pasted image 20260601093510.png",
"Images/Pasted image 20260601083333.png",
+84
View File
@@ -0,0 +1,84 @@
# Device MAUI Pages Setup
Changes needed to get all shared pages rendering in the Device (MAUI Blazor) project.
## How pages render
`MainRazor.razor` has a `Router` pointing at the Pages assembly. When the URL matches a `@page` directive (e.g. `/database`), the Router renders that page component with `MainLayout`. All component references resolve from the Components or Pages project. All DI services are already registered in `MauiProgram.cs`.
Only two things block pages from rendering currently:
## 1. No route for `/`
The MAUI app starts at `/`, but `HomePage` only has `@page "/immortal-home"`. Nothing matches → NotFound.
**Fix:** Add `@page "/"` to `Pages/Pages/Home/HomePage.razor`:
```razor
@page "/"
@page "/immortal-home"
```
Then remove `Web/Index.razor` — its `@page "/"` wrapper is redundant since the Pages project now provides the route directly, and `App.razor` already uses `PageLayout` as the default layout.
## 2. Move dialog portals from Web to Pages
Pages like `BuildCalculatorPage` and `DatabasePage` trigger dialogs via `IEntityDialogService` etc. The portal components that render the dialog UI (`EntityDialogPortal`, `GlossaryDialogPortal`, `ToastPortal`, `SearchPortal`, `ConfirmationDialogPortal`) live in `Web/Portals/`. The dialog components themselves live in `Web/Dialog/`.
Since the Device project can't reference the Web project, these need to be moved into the Pages project so both Web and Device can use them:
- `Web/Portals/*``Pages/Portals/`
- `Web/Dialog/*``Pages/Dialog/`
Then add them to `Device/MainRazor.razor`:
```razor
<MudThemeProvider IsDarkMode="true"/>
<MudDialogProvider/>
<MudSnackbarProvider/>
<EntityDialogPortal/>
<GlossaryDialogPortal/>
<ToastPortal/>
<SearchPortal/>
<ConfirmationDialogPortal/>
<Router AppAssembly="@typeof(IGP.Pages.Home.HomePage).Assembly">
...
</Router>
```
And add the same portal rendering to `Web/App.razor` (already present, but the types now come from Pages instead of Web).
## 3. Add storage loading gate (optional)
The Web project's `App.razor` gates rendering behind `isLoaded` (waits for `IStorageService.Load()`). Some pages may depend on stored data. Add to `MainRazor.razor`:
```razor
@inject IStorageService StorageService
@if (isLoaded)
{
<Router ...>
...
</Router>
}
@code {
private bool isLoaded;
protected override async Task OnInitializedAsync()
{
await StorageService.Load();
isLoaded = true;
}
}
```
## 4. Static assets
Images referenced by pages (e.g. `image/hero/Build.png`) are served from `wwwroot/`. These are already copied from `Web/wwwroot/image/hero/` to `Device/wwwroot/image/hero/`. Check for additional asset references as more pages are used.
## 5. HttpClient base address
`MauiProgram.cs` line 73 sets `BaseAddress = new Uri("https://0.0.0.0")`. Won't resolve real API calls (e.g. markdown content loading). Needs a valid API URL for the MAUI environment.