Skip to content

Feature/admin sidebar layout - #2

Merged
antosubash merged 113 commits into
mainfrom
feature/admin-sidebar-layout
Mar 19, 2026
Merged

antosubash merged 113 commits into
mainfrom
feature/admin-sidebar-layout

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Replace single MainLayout with auth-conditional layouts:

  • PublicLayout (top navbar) for anonymous visitors
  • AppLayout (sidebar) for authenticated users

Add AppSidebar menu section with items from all modules. Replace teal/emerald palette with forest green/deep evergreen. Remove React AdminLayout portal overlay — sidebar now handled by Blazor SSR. Remove AdminSidebarMiddleware and AOT references.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

antosubash and others added 30 commits March 17, 2026 23:17
….Tests

- Implement tests to verify HostDbContext generation for modules with and without DbContext.
- Ensure correct namespace, auto-generated header, and constructor parameters.
- Validate DbSet properties for single and multiple modules, including handling of duplicate entities.
- Test entity type configurations and schema isolation for different database providers.
- Include edge case handling for abstract DbContexts and duplicate table names.
- Created ProductConfiguration class for Entity Framework Core to define the Product entity's schema and seed data.
- Added initial migration files for the database, including the creation of user, order, and product schemas and tables.
- Seeded initial data for Orders and Products in the migration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move all record structs and mutable working classes from the nested
ModuleDiscovererGenerator partial class into a standalone file. Types
are now internal instead of private since they are no longer nested.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move GetModuleFieldName, MapCSharpTypeToTypeScript, and
GetModuleNameFromFqn into a dedicated static helper class. Update
all call sites in the emitters to use the new qualified names.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move ExtractDiscoveryData (renamed to Extract) and all Find*/helper
methods into a dedicated SymbolDiscovery static class. The generator
entry point now only contains the Initialize method.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add the IEmitter interface that will be implemented by individual
emitter classes in future refactoring steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move all 7 DiagnosticDescriptor fields and ReportDiscoveryDiagnostics
into dedicated DiagnosticEmitter class implementing IEmitter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move GenerateModuleExtensions into dedicated emitter class.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move GenerateEndpointExtensions into dedicated emitter class.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move GenerateMenuExtensions into dedicated emitter class.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move GenerateRazorComponentExtensions into dedicated emitter class.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move GenerateViewPages into dedicated emitter class.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move GenerateJsonResolver into dedicated emitter class with early
return when no DTO types exist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move GenerateTypeScriptDefinitions into dedicated emitter class with
early return when no DTO types exist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move EmitHostDbContext into dedicated emitter class with early return
when no DbContexts exist. The emitters partial class is now empty.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add 5 new test files covering each emitter's specific logic:
- EndpointExtensionsEmitterTests (9 tests)
- RazorComponentExtensionsEmitterTests (5 tests)
- TypeScriptDefinitionsEmitterTests (11 tests)
- ViewPagesEmitterTests (7 tests)
- JsonResolverEmitterTests (8 tests)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace orderFaker.Date.Recent(30) with a fixed date range to prevent
EF Core PendingModelChangesWarning on every build. Recreated migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Annotate DatabaseProvider, MenuSection, and CheckStatus enums with
[EnumExtensions] to generate fast ToStringFast(), IsDefined(), and
TryParse() methods. Replace Enum.TryParse in DatabaseProviderDetector
with the generated extension for better AOT compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ompile-time safety

Introduces Vogen 8.0.5 value objects that prevent mixing up raw int/string IDs
across module boundaries. Each ID type generates System.Text.Json converters and
EF Core value converters automatically.

Key changes:
- ProductId/OrderId (int-backed) and UserId (string-backed with validation)
- All contracts, services, endpoints, and tests updated to use typed IDs
- EF Core ConfigureConventions registers Vogen converters/comparers per DbContext
- Source generator emits HostDbContext as partial class for convention overrides
- TypeScript type mappings updated for Vogen ID types
- Test factory now replaces HostDbContext for proper integration test setup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… Orders validation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract common CRUD handler patterns (GetAll, GetById, Create, Update,
Delete) into reusable static methods in SimpleModule.Core.Endpoints.
Simplify all Products and Orders endpoint classes to delegate to these
helpers while preserving validation logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Detect Vogen value objects generically via [ValueObjectAttribute<T>] instead
of hardcoding module-specific type names in TypeMappingHelpers. The generator
now stores the underlying primitive type alongside the actual type, using it
only for TypeScript mapping while preserving the Vogen type for JSON/EF code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…alidationBuilder edge cases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
antosubash and others added 28 commits March 19, 2026 11:58
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…missionContracts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ct DbContext)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rrors

Delete stale migrations from before the OpenIddict/Permissions module split
and regenerate a fresh InitialCreate migration for HostDbContext. Switch
Program.cs from EnsureCreatedAsync to MigrateAsync so tables are properly
created when migrations exist. Wrap all seed service StartAsync methods in
try-catch so database errors during seeding log a warning instead of
crashing the host.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generator tests: expect .RequireAuthorization() in generated group chains.
Orders tests: use authenticated clients with proper permissions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ent UI

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…le prefixing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add Clients list, ClientsCreate, and ClientsEdit pages with tabbed
editing (Details, URIs, Permissions). Uses @simplemodule/ui components
and follows the Admin module patterns. Updated csproj to Razor SDK
with JsBuild target for Vite.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…resolution

The page resolver uses /_content/{AssemblyName}/{AssemblyName}.pages.js.
The assembly name "OpenIddict" conflicts with the OpenIddict NuGet package,
so we use "OpenIddictModule" instead. Updated page names, Vite config,
and migration accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Smoke tests: page loads, seeded client visible, navbar link, auth redirect.
CRUD flow: create, verify, edit display name, verify update, delete, verify removal.
Tab tests: URIs tab shows redirect URIs, Permissions tab shows permission groups.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Adjusted formatting in AdminRolesEndpoint, AdminUsersEndpoint, and RolesEndpoint for better readability.
- Simplified permission logging loops in AdminRolesEndpoint and AdminUsersEndpoint.
- Enhanced code clarity in OpenIddict ClientsActionEndpoint by streamlining foreach loops.
- Reformatted DbSet properties in OpenIddictAppDbContext for consistency.
- Updated IPermissionContracts and PermissionService to improve method signatures and readability.
- Refactored migration code in InitialCreate.cs for better formatting and clarity.
- Improved test assertions in ConnectEndpointTests for enhanced readability.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add InertiaSharedData scoped service for sharing props across all Inertia
responses. AdminSidebarMiddleware populates sidebar menu items for
authenticated users. InertiaResult.MergeProps merges shared data with
endpoint-specific props.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…AOT safety

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ayout

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…dmin nav

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…minLayout

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…for client package

The AdminLayout now renders via createPortal to document.body, escaping
the Blazor SSR DOM hierarchy. Combined with z-[60] (above Blazor nav's
z-50), the admin sidebar fully covers the shell chrome.

Also adds @source for @simplemodule/client to Tailwind CSS scan paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace single MainLayout with auth-conditional layouts:
- PublicLayout (top navbar) for anonymous visitors
- AppLayout (sidebar) for authenticated users

Add AppSidebar menu section with items from all modules.
Replace teal/emerald palette with forest green/deep evergreen.
Remove React AdminLayout portal overlay — sidebar now handled
by Blazor SSR. Remove AdminSidebarMiddleware and AOT references.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@antosubash
antosubash merged commit d02ad03 into main Mar 19, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant