Compare commits

...

2 Commits

Author SHA1 Message Date
Hördle Bot
cbfd0c1798 feat: Add sortable 'Added' column to admin table
- Display upload date in German format (DD.MM.YYYY)
- Column is sortable by clicking header
- Uses existing createdAt field from database
2025-11-21 14:46:59 +01:00
Hördle Bot
8540c7be54 fix: Run Docker container as root user to avoid permission issues 2025-11-21 14:44:05 +01:00
2 changed files with 15 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ interface Song {
activations: number;
}
type SortField = 'title' | 'artist';
type SortField = 'title' | 'artist' | 'createdAt';
type SortDirection = 'asc' | 'desc';
export default function AdminPage() {
@@ -229,6 +229,12 @@ export default function AdminPage() {
>
Artist {sortField === 'artist' && (sortDirection === 'asc' ? '↑' : '↓')}
</th>
<th
style={{ padding: '0.75rem', cursor: 'pointer', userSelect: 'none' }}
onClick={() => handleSort('createdAt')}
>
Added {sortField === 'createdAt' && (sortDirection === 'asc' ? '↑' : '↓')}
</th>
<th style={{ padding: '0.75rem' }}>Activations</th>
<th style={{ padding: '0.75rem' }}>Actions</th>
</tr>
@@ -258,6 +264,9 @@ export default function AdminPage() {
style={{ padding: '0.25rem' }}
/>
</td>
<td style={{ padding: '0.75rem', color: '#666', fontSize: '0.75rem' }}>
{new Date(song.createdAt).toLocaleDateString('de-DE')}
</td>
<td style={{ padding: '0.75rem', color: '#666' }}>{song.activations}</td>
<td style={{ padding: '0.75rem' }}>
<div style={{ display: 'flex', gap: '0.5rem' }}>
@@ -282,6 +291,9 @@ export default function AdminPage() {
<>
<td style={{ padding: '0.75rem', fontWeight: 'bold' }}>{song.title}</td>
<td style={{ padding: '0.75rem' }}>{song.artist}</td>
<td style={{ padding: '0.75rem', color: '#666', fontSize: '0.75rem' }}>
{new Date(song.createdAt).toLocaleDateString('de-DE')}
</td>
<td style={{ padding: '0.75rem', color: '#666' }}>{song.activations}</td>
<td style={{ padding: '0.75rem' }}>
<div style={{ display: 'flex', gap: '0.5rem' }}>
@@ -307,7 +319,7 @@ export default function AdminPage() {
))}
{paginatedSongs.length === 0 && (
<tr>
<td colSpan={5} style={{ padding: '1rem', textAlign: 'center', color: '#666' }}>
<td colSpan={6} style={{ padding: '1rem', textAlign: 'center', color: '#666' }}>
{searchQuery ? 'No songs found matching your search.' : 'No songs uploaded yet.'}
</td>
</tr>

View File

@@ -4,6 +4,7 @@ services:
build:
context: .
dockerfile: Dockerfile
user: root
restart: always
ports:
- "3010:3000"