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
+18 -1
View File
@@ -2,4 +2,21 @@
<MudDialogProvider/> <MudDialogProvider/>
<MudSnackbarProvider/> <MudSnackbarProvider/>
<HomePage/> <Router AppAssembly="@typeof(IGP.Pages.Home.HomePage).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
<FocusOnNavigate RouteData="@routeData" Selector="h1"/>
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
<EntityDialogPortal/>
<GlossaryDialogPortal/>
<ToastPortal/>
<SearchPortal/>
<ConfirmationDialogPortal/>
+13
View File
@@ -8,6 +8,19 @@
@using IGP.Pages @using IGP.Pages
@using IGP.Pages.Home @using IGP.Pages.Home
@using IGP.Pages.Home.Parts @using IGP.Pages.Home.Parts
@using IGP.Dialog
@using IGP.Pages.BuildCalculator
@using IGP.Pages.BuildCalculator.Parts
@using IGP.Pages.Database.Entity
@using IGP.Pages.Database.Entity.Parts
@using IGP.Pages.Database.Parts
@using IGP.Pages.EconomyComparison
@using IGP.Pages.EconomyComparison.Parts
@using IGP.Pages.MemoryTester.Parts
@using IGP.Pages.Notes
@using IGP.Pages.Notes.Parts
@using IGP.Portals
@using IGP.Utils
@using Components.Display @using Components.Display
@using Components.Feedback @using Components.Feedback
+1
View File
@@ -1,6 +1,7 @@
@inherits BasePage @inherits BasePage
@page "/"
@page "/immortal-home" @page "/immortal-home"
<LayoutMediumContentComponent> <LayoutMediumContentComponent>
+2
View File
@@ -53,4 +53,6 @@
@using IGP.Pages.MemoryTester.Parts @using IGP.Pages.MemoryTester.Parts
@using IGP.Pages.Notes @using IGP.Pages.Notes
@using IGP.Pages.Notes.Parts @using IGP.Pages.Notes.Parts
@using IGP.Dialog
@using IGP.Portals
@using IGP.Utils @using IGP.Utils
-5
View File
@@ -1,5 +0,0 @@
@page "/"
@layout PageLayout
<HomePage/>
+7 -20
View File
@@ -42,30 +42,16 @@
"state": { "state": {
"type": "markdown", "type": "markdown",
"state": { "state": {
"file": "Helper Tutorial Info Improvements.md", "file": "Device MAUI Pages Setup.md",
"mode": "source", "mode": "source",
"source": false "source": false
}, },
"icon": "lucide-file", "icon": "lucide-file",
"title": "Helper Tutorial Info Improvements" "title": "Device MAUI Pages Setup"
}
},
{
"id": "b98a69cefb529fc8",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Feature Proposals.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "Feature Proposals"
} }
} }
], ],
"currentTab": 3 "currentTab": 2
} }
], ],
"direction": "vertical" "direction": "vertical"
@@ -237,8 +223,11 @@
"bases:Create new base": false "bases:Create new base": false
} }
}, },
"active": "b98a69cefb529fc8", "active": "68e1ba2b54081b9a",
"lastOpenFiles": [ "lastOpenFiles": [
"Build Calculator CmdLine.md",
"Device MAUI Pages Setup.md",
"Feature Proposals.md",
"_Tasks Kanban.base", "_Tasks Kanban.base",
"Tasks/Worker Income UI and Tests.md", "Tasks/Worker Income UI and Tests.md",
"Tasks/Update the Reference Tables with Telerik.md", "Tasks/Update the Reference Tables with Telerik.md",
@@ -263,8 +252,6 @@
"Tasks/Get AI to Add easy Test Tasks.md", "Tasks/Get AI to Add easy Test Tasks.md",
"Tasks/Helper Tutorial Info Improvements.md", "Tasks/Helper Tutorial Info Improvements.md",
"Tasks/Fix Entity Recursion Error - Parent.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", "Tasks",
"Images/Pasted image 20260601093510.png", "Images/Pasted image 20260601093510.png",
"Images/Pasted image 20260601083333.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.