feat: implement song rating system with admin view and user persistence
This commit is contained in:
@@ -42,6 +42,8 @@ interface Song {
|
||||
puzzles: DailyPuzzle[];
|
||||
genres: Genre[];
|
||||
specials: Special[];
|
||||
averageRating: number;
|
||||
ratingCount: number;
|
||||
}
|
||||
|
||||
type SortField = 'id' | 'title' | 'artist' | 'createdAt';
|
||||
@@ -1141,6 +1143,7 @@ export default function AdminPage() {
|
||||
Added {sortField === 'createdAt' && (sortDirection === 'asc' ? '↑' : '↓')}
|
||||
</th>
|
||||
<th style={{ padding: '0.75rem' }}>Activations</th>
|
||||
<th style={{ padding: '0.75rem' }}>Rating</th>
|
||||
<th style={{ padding: '0.75rem' }}>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -1211,6 +1214,15 @@ export default function AdminPage() {
|
||||
{new Date(song.createdAt).toLocaleDateString('de-DE')}
|
||||
</td>
|
||||
<td style={{ padding: '0.75rem', color: '#666' }}>{song.activations}</td>
|
||||
<td style={{ padding: '0.75rem', color: '#666' }}>
|
||||
{song.averageRating > 0 ? (
|
||||
<span title={`${song.ratingCount} ratings`}>
|
||||
{song.averageRating.toFixed(1)} ★ <span style={{ color: '#999', fontSize: '0.8rem' }}>({song.ratingCount})</span>
|
||||
</span>
|
||||
) : (
|
||||
<span style={{ color: '#ccc' }}>-</span>
|
||||
)}
|
||||
</td>
|
||||
<td style={{ padding: '0.75rem' }}>
|
||||
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
||||
<button
|
||||
@@ -1297,6 +1309,15 @@ export default function AdminPage() {
|
||||
{new Date(song.createdAt).toLocaleDateString('de-DE')}
|
||||
</td>
|
||||
<td style={{ padding: '0.75rem', color: '#666' }}>{song.activations}</td>
|
||||
<td style={{ padding: '0.75rem', color: '#666' }}>
|
||||
{song.averageRating > 0 ? (
|
||||
<span title={`${song.ratingCount} ratings`}>
|
||||
{song.averageRating.toFixed(1)} ★ <span style={{ color: '#999', fontSize: '0.8rem' }}>({song.ratingCount})</span>
|
||||
</span>
|
||||
) : (
|
||||
<span style={{ color: '#ccc' }}>-</span>
|
||||
)}
|
||||
</td>
|
||||
<td style={{ padding: '0.75rem' }}>
|
||||
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user