Skip to content

Commit 9170f9f

Browse files
committed
feat: Enhance user stats display with expanded recent songs section and improved styling
1 parent 8ca3519 commit 9170f9f

3 files changed

Lines changed: 114 additions & 25 deletions

File tree

src/Infrastructure/Services/UserService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public async Task<ICollection<UserStatsDto>> GetAllUsersAsync()
4040
DisplayName = u.DisplayName ?? u.Username,
4141
RecentSongs = u.PlayHistories
4242
.OrderByDescending(ph => ph.PlayedAt)
43-
.Take(10)
43+
.Take(20)
4444
.Select(ph => new RecentSongDto
4545
{
4646
Title = ph.Song.Title,

src/UI/App/src/index.css

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,88 @@ body {
565565
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
566566
}
567567

568+
/* ===== Recently Played (expanded user row) ===== */
569+
570+
.table tr.recent-songs-row:hover {
571+
background: transparent;
572+
}
573+
574+
.recent-songs {
575+
border: 1px solid rgba(255, 255, 255, 0.12);
576+
border-radius: 0.75rem;
577+
background: rgba(0, 0, 0, 0.15);
578+
overflow: hidden;
579+
}
580+
581+
.recent-songs-header {
582+
display: flex;
583+
justify-content: space-between;
584+
align-items: center;
585+
padding: 0.65rem 1rem;
586+
font-size: 0.75rem;
587+
font-weight: 600;
588+
text-transform: uppercase;
589+
letter-spacing: 0.05em;
590+
color: rgba(255, 255, 255, 0.6);
591+
background: rgba(255, 255, 255, 0.06);
592+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
593+
}
594+
595+
.recent-songs-list {
596+
max-height: 320px;
597+
overflow-y: auto;
598+
}
599+
600+
.recent-song-item {
601+
display: flex;
602+
align-items: center;
603+
gap: 0.75rem;
604+
padding: 0.55rem 1rem;
605+
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
606+
}
607+
608+
.recent-song-item:last-child {
609+
border-bottom: none;
610+
}
611+
612+
.recent-song-item:hover {
613+
background: rgba(255, 255, 255, 0.05);
614+
}
615+
616+
.recent-song-rank {
617+
flex-shrink: 0;
618+
width: 1.5rem;
619+
text-align: right;
620+
font-size: 0.8rem;
621+
font-variant-numeric: tabular-nums;
622+
color: rgba(255, 255, 255, 0.4);
623+
}
624+
625+
.recent-song-title {
626+
flex: 1;
627+
min-width: 0;
628+
white-space: nowrap;
629+
overflow: hidden;
630+
text-overflow: ellipsis;
631+
font-weight: 500;
632+
color: rgba(255, 255, 255, 0.9);
633+
}
634+
635+
.recent-song-item .play-count {
636+
flex-shrink: 0;
637+
min-width: 3rem;
638+
text-align: center;
639+
}
640+
641+
.recent-song-date {
642+
flex-shrink: 0;
643+
width: 6.5rem;
644+
text-align: right;
645+
font-size: 0.8rem;
646+
font-variant-numeric: tabular-nums;
647+
color: rgba(255, 255, 255, 0.5);
648+
}
649+
568650
/* ===== Radio Admin ===== */
569651

570652
.add-button {

src/UI/App/src/pages/UserStats.tsx

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -149,39 +149,46 @@ export function UserStats() {
149149
</td>
150150
</tr>
151151
{expandedUser === user.username && (
152-
<tr>
152+
<tr className="recent-songs-row">
153153
<td colSpan={6}>
154154
{user.recentSongs.length === 0 ? (
155155
<span className="song-artist">
156156
No songs played yet.
157157
</span>
158158
) : (
159-
<table className="table">
160-
<thead>
161-
<tr>
162-
<th>Recently Played</th>
163-
<th>Plays</th>
164-
<th>Last Played</th>
165-
</tr>
166-
</thead>
167-
<tbody>
168-
{user.recentSongs.map((song, songIndex) => (
169-
<tr key={songIndex}>
170-
<td>
171-
<div className="song-title">
172-
{cleanTitle(song.title)}
173-
</div>
174-
</td>
175-
<td>
159+
<div className="recent-songs">
160+
<div className="recent-songs-header">
161+
<span>Recently Played</span>
162+
<span>Plays / Last Played</span>
163+
</div>
164+
<div className="recent-songs-list">
165+
{user.recentSongs.map((song, songIndex) => {
166+
const title = cleanTitle(song.title);
167+
return (
168+
<div
169+
className="recent-song-item"
170+
key={songIndex}
171+
>
172+
<span className="recent-song-rank">
173+
{songIndex + 1}
174+
</span>
175+
<span
176+
className="recent-song-title"
177+
title={title}
178+
>
179+
{title}
180+
</span>
176181
<span className="play-count">
177182
{song.totalPlays}
178183
</span>
179-
</td>
180-
<td>{song.playedAt.split('T')[0]}</td>
181-
</tr>
182-
))}
183-
</tbody>
184-
</table>
184+
<span className="recent-song-date">
185+
{song.playedAt.split('T')[0]}
186+
</span>
187+
</div>
188+
);
189+
})}
190+
</div>
191+
</div>
185192
)}
186193
</td>
187194
</tr>

0 commit comments

Comments
 (0)