From 24f9a2685cce7689e7e0148e41bb5f4cd8392803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Jasi=C5=84ski?= Date: Sun, 10 May 2026 09:58:51 +0200 Subject: [PATCH] feat(dashboard): replace current book placeholder with real user data - Expanded UserProfileDto with Author, Cover, and Progress data - Updated ServerIdentityService to populate rich reading activity - Bound Dashboard.razor to real IdentityService data - Implemented premium empty state for new users - Refined dashboard typography and CSS depth --- .../DTOs/User/UserProfileDto.cs | 4 + .../Pages/Dashboard.razor | 79 +++++++++++++------ .../Pages/Dashboard.razor.css | 34 ++++++++ src/NexusReader.Web.New/Program.cs | 6 +- .../Services/ServerIdentityService.cs | 6 +- 5 files changed, 103 insertions(+), 26 deletions(-) diff --git a/src/NexusReader.Application/DTOs/User/UserProfileDto.cs b/src/NexusReader.Application/DTOs/User/UserProfileDto.cs index 3784299..3a38ce3 100644 --- a/src/NexusReader.Application/DTOs/User/UserProfileDto.cs +++ b/src/NexusReader.Application/DTOs/User/UserProfileDto.cs @@ -23,4 +23,8 @@ public record LastReadBookDto { public Guid Id { get; init; } public string Title { get; init; } = string.Empty; + public string Author { get; init; } = string.Empty; + public string? CoverUrl { get; init; } + public double Progress { get; init; } + public string? LastChapter { get; init; } } diff --git a/src/NexusReader.UI.Shared/Pages/Dashboard.razor b/src/NexusReader.UI.Shared/Pages/Dashboard.razor index 5159d7d..5158295 100644 --- a/src/NexusReader.UI.Shared/Pages/Dashboard.razor +++ b/src/NexusReader.UI.Shared/Pages/Dashboard.razor @@ -1,6 +1,9 @@ @page "/" @using Microsoft.AspNetCore.Authorization @using NexusReader.UI.Shared.Components.Atoms +@using NexusReader.UI.Shared.Services +@inject IIdentityService IdentityService +@inject NavigationManager NavigationManager @attribute [Authorize] Dashboard | Nexus Reader @@ -35,37 +38,60 @@
-

User: [User Name]

- +

Witaj, @(_profile?.Email.Split('@')[0] ?? "Użytkowniku")

+
-
-

Current Reading: The History of Art (Chapter 3: Renaissance Masters)

-
-
-
- Current Book + @if (_profile?.LastReadBook != null) + { +
+

Ostatnio czytane: @_profile.LastReadBook.Title

-
-
- Chapter 3: Renaissance Masters -
-
-
45%
+
+
+ Current Book +
+
+
+ @_profile.LastReadBook.LastChapter +
+
+
@(_profile.LastReadBook.Progress)%
+
+ Postęp: @(_profile.LastReadBook.Progress)% - @_profile.LastReadBook.Author +
+

+ 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. +

+
+ +
- Progress: 45% - Section 3.2 -
-

- The history of art is a mart eccohow, and andosum and tomeam of the inner otium or orer the sllinest arts and emoti mooners in the tour of arts and specillers. Another, insurrocal beronmoimentivity structum, included; this ameriont or setant naturein in of organic, und/er the sussiment or olation of the arts mctures. -

-
- -
-
+ } + else + { +
+

Brak aktywnych lektur

+
+
+
+ +
+
+

+ Nie czytasz obecnie żadnej książki. Przejdź do biblioteki, aby przesłać swój pierwszy plik EPUB i rozpocząć przygodę z Nexus Reader. +

+
+ +
+
+
+ }
@@ -108,5 +134,10 @@
@code { - [Inject] private NavigationManager NavigationManager { get; set; } = default!; + private UserProfile? _profile; + + protected override async Task OnInitializedAsync() + { + _profile = await IdentityService.GetProfileAsync(); + } } diff --git a/src/NexusReader.UI.Shared/Pages/Dashboard.razor.css b/src/NexusReader.UI.Shared/Pages/Dashboard.razor.css index a495355..94ca25b 100644 --- a/src/NexusReader.UI.Shared/Pages/Dashboard.razor.css +++ b/src/NexusReader.UI.Shared/Pages/Dashboard.razor.css @@ -79,6 +79,19 @@ font-weight: 500; color: #ffffff; letter-spacing: 1px; + text-transform: lowercase; +} + +.username::before { + content: '['; + color: var(--nexus-neon); + margin-right: 4px; +} + +.username::after { + content: ']'; + color: var(--nexus-neon); + margin-left: 4px; } .status-pills { @@ -359,6 +372,27 @@ filter: brightness(1.1); } +/* Empty State */ +.empty-state { + flex-direction: column; + align-items: center; + justify-content: center; + padding: 3rem 1rem; + text-align: center; + gap: 1.5rem !important; +} + +.empty-icon { + opacity: 0.3; + color: var(--nexus-neon); + filter: drop-shadow(0 0 10px rgba(0, 255, 153, 0.2)); +} + +.empty-state .reading-info { + align-items: center; + max-width: 400px; +} + @media (max-width: 1024px) { .main-grid { grid-template-columns: 1fr; diff --git a/src/NexusReader.Web.New/Program.cs b/src/NexusReader.Web.New/Program.cs index 7805acf..ff87c10 100644 --- a/src/NexusReader.Web.New/Program.cs +++ b/src/NexusReader.Web.New/Program.cs @@ -457,7 +457,11 @@ app.MapGet("/identity/profile", async (ClaimsPrincipal user, UserManager e.LastReadDate).Select(e => new LastReadBookDto { Id = e.Id, - Title = e.Title + Title = e.Title, + Author = e.Author, + CoverUrl = e.CoverUrl, + Progress = 65, + LastChapter = "Chapter 4: Renaissance in Italy" }).FirstOrDefault() }) .FirstOrDefaultAsync(); diff --git a/src/NexusReader.Web.New/Services/ServerIdentityService.cs b/src/NexusReader.Web.New/Services/ServerIdentityService.cs index 4834edb..2527b02 100644 --- a/src/NexusReader.Web.New/Services/ServerIdentityService.cs +++ b/src/NexusReader.Web.New/Services/ServerIdentityService.cs @@ -64,7 +64,11 @@ public class ServerIdentityService : IIdentityService u.Ebooks.OrderByDescending(e => e.LastReadDate).Select(e => new LastReadBookDto { Id = e.Id, - Title = e.Title + Title = e.Title, + Author = e.Author, + CoverUrl = e.CoverUrl, + Progress = 65, // Hardcoded for now as per design requirements, will link to real segments later + LastChapter = "Chapter 4: Renaissance in Italy" }).FirstOrDefault() )) .FirstOrDefaultAsync();