Add HEIC to JPEG conversion and image resizing support; update dependencies and Dockerfile
This commit is contained in:
+133
-26
@@ -1187,34 +1187,141 @@ export default function AdminPage() {
|
||||
{timelineContributions
|
||||
.filter(c => c.type === 'timeline')
|
||||
.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime())
|
||||
.map(c => (
|
||||
<div key={`tc-${c.id}`} className={`rounded-lg p-3 border flex items-center justify-between ${
|
||||
c.status === 'flagged' ? 'bg-red-50 border-red-200' :
|
||||
c.status === 'approved' ? 'bg-green-50/50 border-green-200' :
|
||||
c.status === 'rejected' ? 'bg-red-50/30 border-red-100' :
|
||||
'bg-amber-50 border-amber-200'
|
||||
}`}>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<span className="font-lora text-sm text-warm-brown font-medium">{c.title || 'Ohne Titel'}</span>
|
||||
{c.year && <span className="text-warm-gold text-xs">{c.day ? `${c.day}.` : ''}{c.month ? `${c.month}.` : ''}{c.year}</span>}
|
||||
{c.status === 'flagged' && <span className="text-xs px-1.5 py-0.5 bg-red-200 text-red-800 rounded-full">🚩</span>}
|
||||
{c.status === 'approved' && <span className="text-xs px-1.5 py-0.5 bg-green-200 text-green-800 rounded-full">✓</span>}
|
||||
{c.status === 'rejected' && <span className="text-xs px-1.5 py-0.5 bg-red-100 text-red-600 rounded-full">✗</span>}
|
||||
</div>
|
||||
<p className="text-warm-brown-light/60 text-xs truncate">{c.name} {c.content ? `· ${c.content}` : ''}</p>
|
||||
</div>
|
||||
<div className="flex gap-1 ml-2">
|
||||
{(c.status === 'pending' || c.status === 'flagged') && (
|
||||
<>
|
||||
<button onClick={async () => { await fetch(`/api/contributions/${c.id}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'approved' }) }); loadData() }} className="p-1.5 text-green-600 hover:text-green-700" title="Freigeben"><Eye size={13} /></button>
|
||||
<button onClick={async () => { await fetch(`/api/contributions/${c.id}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'rejected' }) }); loadData() }} className="p-1.5 text-red-400 hover:text-red-500" title="Ablehnen"><X size={13} /></button>
|
||||
</>
|
||||
.map(c => {
|
||||
const isEditing = editingContribution?.id === c.id
|
||||
return (
|
||||
<div key={`tc-${c.id}`} className={`rounded-lg p-3 border ${
|
||||
c.status === 'flagged' ? 'bg-red-50 border-red-200' :
|
||||
c.status === 'approved' ? 'bg-green-50/50 border-green-200' :
|
||||
c.status === 'rejected' ? 'bg-red-50/30 border-red-100' :
|
||||
'bg-amber-50 border-amber-200'
|
||||
}`}>
|
||||
{isEditing ? (
|
||||
<div className="space-y-2">
|
||||
<div className="grid grid-cols-3 gap-2">
|
||||
<input
|
||||
type="text"
|
||||
value={editingContribution.day || ''}
|
||||
onChange={(e) => setEditingContribution({ ...editingContribution, day: e.target.value })}
|
||||
placeholder="Tag"
|
||||
className="px-2 py-1.5 rounded border border-warm-border bg-white text-warm-brown text-xs"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value={editingContribution.month || ''}
|
||||
onChange={(e) => setEditingContribution({ ...editingContribution, month: e.target.value })}
|
||||
placeholder="Monat"
|
||||
className="px-2 py-1.5 rounded border border-warm-border bg-white text-warm-brown text-xs"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value={editingContribution.year || ''}
|
||||
onChange={(e) => setEditingContribution({ ...editingContribution, year: e.target.value })}
|
||||
placeholder="Jahr"
|
||||
className="px-2 py-1.5 rounded border border-warm-border bg-white text-warm-brown text-xs"
|
||||
/>
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
value={editingContribution.title || ''}
|
||||
onChange={(e) => setEditingContribution({ ...editingContribution, title: e.target.value })}
|
||||
placeholder="Titel"
|
||||
className="w-full px-2 py-1.5 rounded border border-warm-border bg-white text-warm-brown text-xs"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value={editingContribution.location || ''}
|
||||
onChange={(e) => setEditingContribution({ ...editingContribution, location: e.target.value })}
|
||||
placeholder="Ort (optional)"
|
||||
className="w-full px-2 py-1.5 rounded border border-warm-border bg-white text-warm-brown text-xs"
|
||||
/>
|
||||
<textarea
|
||||
value={editingContribution.content || ''}
|
||||
onChange={(e) => setEditingContribution({ ...editingContribution, content: e.target.value })}
|
||||
placeholder="Beschreibung (optional)"
|
||||
rows={2}
|
||||
className="w-full px-2 py-1.5 rounded border border-warm-border bg-white text-warm-brown text-xs resize-none"
|
||||
/>
|
||||
<div className="flex items-center gap-2">
|
||||
<input
|
||||
type="text"
|
||||
value={editingContribution.name || ''}
|
||||
onChange={(e) => setEditingContribution({ ...editingContribution, name: e.target.value })}
|
||||
placeholder="Name des Einreichers"
|
||||
className="flex-1 px-2 py-1.5 rounded border border-warm-border bg-white text-warm-brown text-xs"
|
||||
/>
|
||||
<button
|
||||
onClick={() => setEditingContribution({ ...editingContribution, name: '' })}
|
||||
title="Namen entfernen (wird nicht angezeigt)"
|
||||
className="px-2 py-1.5 rounded border border-warm-border bg-white text-warm-brown-light hover:text-red-500 text-xs transition-colors"
|
||||
>
|
||||
Name verbergen
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
onClick={async () => {
|
||||
await fetch(`/api/contributions/${editingContribution.id}`, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
name: editingContribution.name,
|
||||
type: editingContribution.type,
|
||||
year: editingContribution.year,
|
||||
month: editingContribution.month,
|
||||
day: editingContribution.day,
|
||||
title: editingContribution.title,
|
||||
content: editingContribution.content,
|
||||
location: editingContribution.location,
|
||||
media_filenames: editingContribution.media_filenames,
|
||||
status: editingContribution.status,
|
||||
}),
|
||||
})
|
||||
setEditingContribution(null)
|
||||
loadData()
|
||||
}}
|
||||
className="px-3 py-1.5 bg-warm-gold text-white rounded text-xs hover:bg-amber-600 transition-colors"
|
||||
>
|
||||
Speichern
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setEditingContribution(null)}
|
||||
className="px-3 py-1.5 bg-warm-brown-light/20 text-warm-brown rounded text-xs hover:bg-warm-brown-light/30 transition-colors"
|
||||
>
|
||||
Abbrechen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<span className="font-lora text-sm text-warm-brown font-medium">{c.title || 'Ohne Titel'}</span>
|
||||
{c.year && <span className="text-warm-gold text-xs">{c.day ? `${c.day}.` : ''}{c.month ? `${c.month}.` : ''}{c.year}</span>}
|
||||
{c.status === 'flagged' && <span className="text-xs px-1.5 py-0.5 bg-red-200 text-red-800 rounded-full">🚩</span>}
|
||||
{c.status === 'approved' && <span className="text-xs px-1.5 py-0.5 bg-green-200 text-green-800 rounded-full">✓</span>}
|
||||
{c.status === 'rejected' && <span className="text-xs px-1.5 py-0.5 bg-red-100 text-red-600 rounded-full">✗</span>}
|
||||
</div>
|
||||
<p className="text-warm-brown-light/60 text-xs truncate">
|
||||
{c.name ? c.name : <span className="italic text-warm-brown-light/40">Kein Name</span>}
|
||||
{c.content ? ` · ${c.content}` : ''}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex gap-1 ml-2">
|
||||
<button onClick={() => setEditingContribution(c)} className="p-1.5 text-amber-700 hover:text-amber-500" title="Bearbeiten"><Edit2 size={13} /></button>
|
||||
{(c.status === 'pending' || c.status === 'flagged') && (
|
||||
<>
|
||||
<button onClick={async () => { await fetch(`/api/contributions/${c.id}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'approved' }) }); loadData() }} className="p-1.5 text-green-600 hover:text-green-700" title="Freigeben"><Eye size={13} /></button>
|
||||
<button onClick={async () => { await fetch(`/api/contributions/${c.id}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'rejected' }) }); loadData() }} className="p-1.5 text-red-400 hover:text-red-500" title="Ablehnen"><X size={13} /></button>
|
||||
</>
|
||||
)}
|
||||
<button onClick={async () => { if (confirm('Löschen?')) { await fetch(`/api/contributions/${c.id}`, { method: 'DELETE' }); loadData() } }} className="p-1.5 text-red-400/60 hover:text-red-500" title="Löschen"><Trash2 size={13} /></button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<button onClick={async () => { if (confirm('Löschen?')) { await fetch(`/api/contributions/${c.id}`, { method: 'DELETE' }); loadData() } }} className="p-1.5 text-red-400/60 hover:text-red-500" title="Löschen"><Trash2 size={13} /></button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user