From 65e188b323407b22176a21f083e4be189d5c2053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Jasi=C5=84ski?= Date: Sun, 10 May 2026 19:09:14 +0200 Subject: [PATCH] fix: resolve dashboard bugs (percentage precision, wrong title, and reading resumption) --- .../Commands/Sync/UpdateReadingProgressCommand.cs | 1 + .../DTOs/User/UserProfileDto.cs | 1 + .../Queries/User/GetUserProfileQueryHandler.cs | 3 ++- src/NexusReader.Domain/Entities/Ebook.cs | 2 ++ .../Handlers/UpdateReadingProgressCommandHandler.cs | 1 + src/NexusReader.Infrastructure/RealTime/SyncHub.cs | 9 +++++---- .../Components/Organisms/ReaderCanvas.razor | 3 ++- .../NexusReader.UI.Shared.csproj | 1 + src/NexusReader.UI.Shared/Pages/Dashboard.razor | 8 ++++---- src/NexusReader.UI.Shared/Pages/Home.razor | 12 ++++++++++++ src/NexusReader.UI.Shared/Services/ISyncService.cs | 2 +- src/NexusReader.UI.Shared/Services/SyncService.cs | 2 +- 12 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/NexusReader.Application/Commands/Sync/UpdateReadingProgressCommand.cs b/src/NexusReader.Application/Commands/Sync/UpdateReadingProgressCommand.cs index 4fedcf1..0f6dca8 100644 --- a/src/NexusReader.Application/Commands/Sync/UpdateReadingProgressCommand.cs +++ b/src/NexusReader.Application/Commands/Sync/UpdateReadingProgressCommand.cs @@ -9,4 +9,5 @@ public record UpdateReadingProgressCommand( Guid EbookId, double Progress, string? ChapterTitle, + int ChapterIndex, string? ExcludedConnectionId = null) : IRequest; diff --git a/src/NexusReader.Application/DTOs/User/UserProfileDto.cs b/src/NexusReader.Application/DTOs/User/UserProfileDto.cs index 08c99e6..b85ddfd 100644 --- a/src/NexusReader.Application/DTOs/User/UserProfileDto.cs +++ b/src/NexusReader.Application/DTOs/User/UserProfileDto.cs @@ -27,4 +27,5 @@ public record LastReadBookDto public string? CoverUrl { get; init; } public double Progress { get; init; } public string? LastChapter { get; init; } + public int LastChapterIndex { get; init; } } diff --git a/src/NexusReader.Application/Queries/User/GetUserProfileQueryHandler.cs b/src/NexusReader.Application/Queries/User/GetUserProfileQueryHandler.cs index 4e291bb..b6fe031 100644 --- a/src/NexusReader.Application/Queries/User/GetUserProfileQueryHandler.cs +++ b/src/NexusReader.Application/Queries/User/GetUserProfileQueryHandler.cs @@ -46,7 +46,8 @@ public class GetUserProfileQueryHandler : IRequestHandler + diff --git a/src/NexusReader.UI.Shared/Pages/Dashboard.razor b/src/NexusReader.UI.Shared/Pages/Dashboard.razor index ebbe001..f6769cd 100644 --- a/src/NexusReader.UI.Shared/Pages/Dashboard.razor +++ b/src/NexusReader.UI.Shared/Pages/Dashboard.razor @@ -56,18 +56,18 @@
@_profile.LastReadBook.LastChapter
-
-
@(_profile.LastReadBook.Progress)%
+
+
@(_profile.LastReadBook.Progress.ToString("F1"))%
- Postęp: @(_profile.LastReadBook.Progress)% - @_profile.LastReadBook.Author.Name + Postęp: @(_profile.LastReadBook.Progress.ToString("F2"))% - @_profile.LastReadBook.Author.Name

Kontynuuj odkrywanie wiedzy w książce "@_profile.LastReadBook.Title". Twój cyfrowy asystent Nexus jest gotowy do analizy kolejnych rozdziałów i generowania interaktywnych map myśli.

- +
diff --git a/src/NexusReader.UI.Shared/Pages/Home.razor b/src/NexusReader.UI.Shared/Pages/Home.razor index c6d65e8..fcedb14 100644 --- a/src/NexusReader.UI.Shared/Pages/Home.razor +++ b/src/NexusReader.UI.Shared/Pages/Home.razor @@ -6,6 +6,8 @@ @inject IQuizStateService QuizState @inject IFocusModeService FocusMode @inject IJSRuntime JS +@inject NavigationManager NavManager +@inject IReaderNavigationService NavService Nexus E-Reader
@@ -26,6 +28,16 @@ QuizState.OnQuizRequested += HandleQuizRequestedAsync; FocusMode.OnFocusModeChanged += HandleUpdate; await FocusMode.InitializeAsync(); + + // Handle deep-linking to a specific chapter + var uri = NavManager.ToAbsoluteUri(NavManager.Uri); + if (Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uri.Query).TryGetValue("chapter", out var chapterValue)) + { + if (int.TryParse(chapterValue, out var chapterIndex)) + { + await NavService.GoToChapter(chapterIndex); + } + } } protected override async Task OnAfterRenderAsync(bool firstRender) diff --git a/src/NexusReader.UI.Shared/Services/ISyncService.cs b/src/NexusReader.UI.Shared/Services/ISyncService.cs index 80cd7aa..adcec95 100644 --- a/src/NexusReader.UI.Shared/Services/ISyncService.cs +++ b/src/NexusReader.UI.Shared/Services/ISyncService.cs @@ -5,7 +5,7 @@ namespace NexusReader.UI.Shared.Services; public interface ISyncService { Task InitializeAsync(); - Task UpdateProgressAsync(string pageId, Guid ebookId, double progress, string? chapterTitle); + Task UpdateProgressAsync(string pageId, Guid ebookId, double progress, string? chapterTitle, int chapterIndex); event Func OnProgressReceived; Task DisposeAsync(); } diff --git a/src/NexusReader.UI.Shared/Services/SyncService.cs b/src/NexusReader.UI.Shared/Services/SyncService.cs index 8a4d841..5e37b61 100644 --- a/src/NexusReader.UI.Shared/Services/SyncService.cs +++ b/src/NexusReader.UI.Shared/Services/SyncService.cs @@ -64,7 +64,7 @@ public class SyncService : ISyncService, IAsyncDisposable private string? _lastSentPageId; - public async Task UpdateProgressAsync(string pageId, Guid ebookId, double progress, string? chapterTitle) + public async Task UpdateProgressAsync(string pageId, Guid ebookId, double progress, string? chapterTitle, int chapterIndex) { if (pageId == _lastSentPageId) return Result.Ok();