feat: Allow event owners to delete their own events and admins to delete any event with UI action buttons and confirmation dialog
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V5 */
|
||||
/* Hallmark · redesign: HomePage · studied-DNA: https://inihaus.de · macrostructure: Newsstand Feed */
|
||||
import React, { useState } from 'react';
|
||||
import { Search, Calendar, MapPin, Clock, ArrowRight, Plus, EyeOff, CheckCircle2, Edit3, ShieldAlert } from 'lucide-react';
|
||||
import { Search, Calendar, MapPin, Clock, ArrowRight, Plus, EyeOff, CheckCircle2, Edit3, ShieldAlert, Trash2 } from 'lucide-react';
|
||||
|
||||
export default function HomePage({
|
||||
events,
|
||||
@@ -10,6 +10,7 @@ export default function HomePage({
|
||||
onOpenCreateEvent,
|
||||
onToggleEventActive,
|
||||
onEditEvent,
|
||||
onDeleteEvent,
|
||||
branding
|
||||
}) {
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
@@ -212,6 +213,16 @@ export default function HomePage({
|
||||
{evt.is_active !== false ? <EyeOff className="w-3.5 h-3.5" /> : <CheckCircle2 className="w-3.5 h-3.5" />}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{(isUserAdmin || (user && (evt.created_by === user.id || evt.created_by?.id === user.id))) && onDeleteEvent && (
|
||||
<button
|
||||
onClick={() => onDeleteEvent(evt)}
|
||||
className="py-1.5 px-2 rounded-sm text-[10px] font-mono font-bold bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 transition flex items-center gap-1 shrink-0"
|
||||
title="Veranstaltung unwiderruflich löschen"
|
||||
>
|
||||
<Trash2 className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user