style: complete Light Sepia theme overrides for user dashboard (#78)
Resolves #79 This Pull Request completes the visual implementation of the premium **"Warm Paper / Soft Sepia"** light theme across all user dashboard sub-modules and components. ### 🎨 Styling Refactoring & Light Sepia Layout We refactored isolated component styles (`.razor.css`) to ensure proper contrast, remove hardcoded dark tokens, and fix text visibility under the `.theme-light` environment: 1. **Dashboard & Sidebar Layouts:** * **MainHubLayout.razor.css** & **Dashboard.razor.css**: Replaced hardcoded dark backgrounds with `var(--bg-surface)` and `var(--bg-base)`. Overrode user name brackets, progress bar elements, active quiz cards, graph nodes, and buttons. 2. **Catalog & Library Pages:** * **Catalog.razor.css** & **MyBooks.razor.css**: Adjusted cover hover actions, overlay transparency, and progress tracks. Fixed course tile background gradients to use a warm, elegant `#e4e1d9` layer and `var(--text-main)` code text. 3. **Profile & Settings Views:** * **Profile.razor.css** & **Settings.razor.css**: Overrode token usage progress tracks, page title gradient transparency, section descriptions, and diagnostic button styling. 4. **Concepts Dashboard & Interactive Widgets:** * **ConceptsDashboard.razor.css** & **ConceptsMap.razor.css**: Transitioned node headers, unlocked/locked badges, warning blocks, and term pills to semantic colors. Removed neon glow animations for locked nodes. 5. **Intelligence Workspace & AI Responses:** * **Intelligence.razor.css** & **AiResponseRenderer.razor.css**: Refactored empty state welcome messages, placeholder styles, input fields, and robot avatar borders. Refined the linear-gradient mask fade effect to blend correctly into the light sepia surface environment rather than dropping into dark transparent channels. 6. **Dashboard Sidebar Widgets:** * **CurrentReadingWidget.razor.css** & **ContextualRecommendationsWidget.razor.css**: Replaced hardcoded `#1a1a1e` card containers and light text colors with semantic variables (`var(--bg-surface)`, `var(--border)`, `var(--text-main)`, and `var(--text-muted)`). ### 🛠️ Blazor CSS Isolation Compiler Compliance * Avoided the use of `:global(.theme-light)` selector overrides within isolated CSS rules because they are unsupported by Blazor's CSS isolation compiler and cause the compiled stylesheet to ignore them. * Replaced them with the correct standard selector format `.theme-light .some-class` which properly compiles to `.theme-light .some-class[b-xxxx]`, applying correct theme styles recursively to child scoped markup. ### 🧪 Verification * Checked that the solution builds cleanly with 0 compiler errors: `dotnet build NexusReader.slnx --no-restore` * Ran all unit tests successfully: `dotnet test NexusReader.slnx --no-restore` --------- Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Reviewed-on: #78 Co-authored-by: Antigravity <antigravity@google.com> Co-committed-by: Antigravity <antigravity@google.com>
This commit was merged in pull request #78.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
using FluentResults;
|
||||
using NexusReader.Domain.Enums;
|
||||
|
||||
namespace NexusReader.Application.Abstractions.Services;
|
||||
|
||||
public interface IUserPreferenceStore
|
||||
{
|
||||
Task<Result> SaveThemePreferenceAsync(ThemeMode mode);
|
||||
Task<Result<ThemeMode>> GetThemePreferenceAsync();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
using NexusReader.Domain.Enums;
|
||||
|
||||
namespace NexusReader.Application.Commands.User;
|
||||
|
||||
public record UpdateThemeCommand(string UserId, ThemeMode Mode) : ICommand;
|
||||
@@ -0,0 +1,41 @@
|
||||
using FluentResults;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NexusReader.Application.Abstractions.Messaging;
|
||||
using NexusReader.Data.Persistence;
|
||||
|
||||
namespace NexusReader.Application.Commands.User;
|
||||
|
||||
public class UpdateThemeCommandHandler : ICommandHandler<UpdateThemeCommand>
|
||||
{
|
||||
private readonly IDbContextFactory<AppDbContext> _dbContextFactory;
|
||||
|
||||
public UpdateThemeCommandHandler(IDbContextFactory<AppDbContext> dbContextFactory)
|
||||
{
|
||||
_dbContextFactory = dbContextFactory;
|
||||
}
|
||||
|
||||
public async Task<Result> Handle(UpdateThemeCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken);
|
||||
var user = await dbContext.Users
|
||||
.AsTracking()
|
||||
.FirstOrDefaultAsync(u => u.Id == request.UserId, cancellationToken);
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
return Result.Fail("User not found.");
|
||||
}
|
||||
|
||||
user.ThemePreference = request.Mode;
|
||||
await dbContext.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return Result.Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Result.Fail(new Error("Failed to save theme preference in database.").CausedBy(ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ namespace NexusReader.Application.Common;
|
||||
[JsonSerializable(typeof(NexusReader.Application.Queries.Recommendations.ContextualRecommendationResponse))]
|
||||
[JsonSerializable(typeof(NexusReader.Application.Queries.Recommendations.RecommendationDto))]
|
||||
[JsonSerializable(typeof(List<NexusReader.Application.Queries.Recommendations.RecommendationDto>))]
|
||||
[JsonSerializable(typeof(NexusReader.Application.DTOs.User.UpdateThemeRequest))]
|
||||
[JsonSerializable(typeof(NexusReader.Domain.Enums.ThemeMode))]
|
||||
public partial class AppJsonContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
using NexusReader.Domain.Enums;
|
||||
|
||||
namespace NexusReader.Application.DTOs.User;
|
||||
|
||||
public record UpdateThemeRequest(ThemeMode Mode);
|
||||
@@ -1,4 +1,5 @@
|
||||
using NexusReader.Application.Constants;
|
||||
using NexusReader.Domain.Enums;
|
||||
|
||||
namespace NexusReader.Application.DTOs.User;
|
||||
|
||||
@@ -8,6 +9,7 @@ public record UserProfileDto
|
||||
public string UserId { get; init; } = string.Empty;
|
||||
public int AITokensUsed { get; init; }
|
||||
public Guid TenantId { get; init; }
|
||||
public ThemeMode ThemePreference { get; init; } = ThemeMode.System;
|
||||
|
||||
/// <summary>
|
||||
/// Relational data for the current subscription plan.
|
||||
|
||||
@@ -27,6 +27,7 @@ public class GetUserProfileQueryHandler : IRequestHandler<GetUserProfileQuery, R
|
||||
UserId = u.Id,
|
||||
AITokensUsed = u.AITokensUsed,
|
||||
TenantIdString = u.TenantId,
|
||||
ThemePreference = u.ThemePreference,
|
||||
Plan = u.SubscriptionPlan != null ? new SubscriptionPlanDto
|
||||
{
|
||||
Id = u.SubscriptionPlan.Id,
|
||||
@@ -106,6 +107,7 @@ public class GetUserProfileQueryHandler : IRequestHandler<GetUserProfileQuery, R
|
||||
AverageQuizScore = averageQuizScore,
|
||||
DisplayName = userRaw.DisplayName,
|
||||
BooksReadCount = userRaw.BooksReadCount,
|
||||
ThemePreference = userRaw.ThemePreference,
|
||||
ConceptsMappedCount = conceptsMappedCount,
|
||||
LastReadBook = userRaw.LastReadBook,
|
||||
RecentQuizzes = userRaw.QuizResults.OrderByDescending(q => q.CompletedDate).Take(5).Select(q => new QuizResultDto
|
||||
|
||||
Reference in New Issue
Block a user