This commit is contained in:
2026-06-04 17:19:08 +02:00
parent df9bce64f7
commit e634123904
6 changed files with 287 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
## Description
<!-- What does this PR do and why? -->
## Changes
<!-- Key changes made -->
-
-
## How to Test
1. Run the Blazor Web App: `dotnet run --project Fixiy.Web/Fixiy.Web.csproj`
2. <!-- Additional steps specific to this PR -->
## Checklist
- [ ] New interfaces defined in `Fixiy.Shared/Interfaces/` (not in platform projects)
- [ ] Platform-specific services implemented in both `Fixiy.Maui/Services/` and `Fixiy.Web/Services/`
- [ ] Both DI roots updated (`MauiProgram.cs` and `Fixiy.Web/Program.cs`)
- [ ] Render modes use `InteractiveRenderSettings.*` properties, not `RenderMode.*` constants
- [ ] No MAUI-specific APIs (`DeviceInfo`, `FileSystem`, etc.) introduced in `Fixiy.Shared`
- [ ] `_Imports.razor` updated if new shared namespaces are needed
- [ ] `InteractiveRenderSettings.ConfigureBlazorHybridRenderModes()` updated if new render mode properties added
+67
View File
@@ -0,0 +1,67 @@
# GitHub Copilot Instructions — Fixiy
## Language and Style
- **C# 12+** with `<Nullable>enable</Nullable>` and `<ImplicitUsings>enable</ImplicitUsings>` throughout. Never disable these per-file without strong justification.
- Use **file-scoped namespaces** (`namespace Fixiy.Shared.Services;`) not block-scoped.
- Prefer `record` types for immutable DTOs.
- Use `async`/`await` consistently — never `.Result` or `.Wait()` on Tasks.
- Remove unused `using` directives.
## Blazor Component Conventions
- All shared components live in `Fixiy.Shared/Components/`. Do not create components in `Fixiy.Maui` or `Fixiy.Web`.
- Pages go in `Fixiy.Shared/Components/Pages/`, layout in `Layout/`, reusable elements in `SingleElements/`.
- Scoped CSS goes in a matching `.razor.css` file alongside the component.
- Inject services via `@inject` in `.razor` files — Blazor components do not support constructor injection.
- Prefer `[Parameter]` for component inputs; avoid cascading parameters unless genuinely needed across deep trees.
## Render Mode Rules
- **Always use `InteractiveRenderSettings.*` properties** (`@InteractiveServer`, `@InteractiveAuto`, `@InteractiveWebAssembly`) in shared components — never hard-coded `RenderMode.*` constants.
- `Fixiy.Maui/MauiProgram.cs` calls `ConfigureBlazorHybridRenderModes()` which sets all three properties to `null`. This is intentional — MAUI Blazor Hybrid runs components statically.
- Do not work around the null render modes in shared code. Components that need interactivity must tolerate `null` render mode in MAUI context.
## IFormFactor Platform Abstraction
- Platform-specific device info must be accessed via `IFormFactor` injection (`Fixiy.Shared/Interfaces/IFormFactor.cs`).
- **Never call `DeviceInfo`, `Connectivity`, `FileSystem`, or any `Microsoft.Maui.*` API from `Fixiy.Shared`.**
- When adding new platform capabilities: define interface in `Fixiy.Shared/Interfaces/` → implement in both `Fixiy.Maui/Services/` and `Fixiy.Web/Services/` → register in both DI roots.
## IntegryApiClient Registration
- Register with the same `appToken` and `useLoginAzienda: true` in both hosts.
- MAUI: `.UseIntegry(appToken, useLoginAzienda: true)` on the `MauiAppBuilder` chain.
- Web: `builder.Services.UseIntegry(appToken, useLoginAzienda: true)` in `Program.cs`.
- One registration per DI root — do not call it twice.
## Service Registration Lifetimes
- `Fixiy.Maui` registers platform services as **`Singleton`** — the MAUI app has a single long-lived process.
- `Fixiy.Web` registers platform services as **`Scoped`** — ASP.NET Core server-side per-request scope.
- Interfaces must not assume a specific lifetime; implementations may.
## Maintenance Matrix
| Change | Cascades to |
|--------|-------------|
| Add/modify `Fixiy.Shared/Interfaces/*.cs` | Both `Fixiy.Maui/Services/` and `Fixiy.Web/Services/` implementations + DI registration in both hosts |
| Modify `InteractiveRenderSettings.cs` | `MauiProgram.ConfigureBlazorHybridRenderModes()` — must null every new property |
| Add a new shared page | `Fixiy.Shared/Components/Pages/` → nav link in `NavMenu.razor` if user-accessible |
| Add a NuGet package | Target `.csproj` file; check private NuGet feed has it |
| Change IntegryApiClient version | All three `.csproj` files (`Fixiy.Maui`, `Fixiy.Shared`, `Fixiy.Web`) |
| Modify `_Imports.razor` | Verify no MAUI-only or web-only namespaces are introduced |
| Update app token | `Fixiy.Maui/MauiProgram.cs` `AppToken` const + `Fixiy.Web/Program.cs` `appToken` const |
## Test Conventions
- No test projects are currently configured. When adding tests, use **xUnit** with **bUnit** for Razor component testing.
- Test projects should reference `Fixiy.Shared` and provide mock implementations of `IFormFactor`.
- Use `Moq` or `NSubstitute` for mocking; do not create manual stubs unless the interface is trivial.
## Code Style Notes
- Omit the `private` modifier on fields — it is the default in C#.
- Constants: `PascalCase` for class-level `const`, no Hungarian notation.
- One type per file; file name matches type name.
- Keep `@code` blocks in `.razor` files focused — extract complex logic to a `*.razor.cs` code-behind or a separate service class.
+33
View File
@@ -0,0 +1,33 @@
name: Copilot Setup Steps
on: workflow_dispatch
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Configure private NuGet source credentials
# NuGet.Config points to the private Integry feed; CI secrets provide auth.
# Set NUGET_USERNAME and NUGET_PASSWORD in repository secrets.
run: |
dotnet nuget update source integry \
--username "${{ secrets.NUGET_USERNAME }}" \
--password "${{ secrets.NUGET_PASSWORD }}" \
--store-password-in-clear-text
- name: Restore dependencies
run: dotnet restore Fixiy.sln
- name: Build Fixiy.Web
# MAUI builds require platform-specific workloads not available on ubuntu-latest.
# Fixiy.Web covers the shared Blazor component tree and validates the full build.
run: dotnet build Fixiy.Web/Fixiy.Web.csproj --no-restore -c Debug