feat: implement dynamic categories, admin category CRUD, fix routing and cleanup

This commit is contained in:
AyrisAI
2026-07-13 13:51:48 +03:00
parent 2f2dafcfb9
commit 5b44c78396
54 changed files with 3619 additions and 473 deletions
@@ -0,0 +1,43 @@
'use client'
import { restoreListingAction, hardDeleteListingAction } from '@/app/actions'
import { RotateCcw, Trash2 } from 'lucide-react'
export function TrashActionButtons({ id, type }: { id: string; type: 'listing' | 'event' }) {
const handleRestore = async () => {
if (!confirm('Bu ögeyi geri yüklemek istediğinize emin misiniz? Ana listeye eklenecektir.')) return
if (type === 'listing') {
const res = await restoreListingAction(id)
if (res?.error) alert(res.error)
}
}
const handleHardDelete = async () => {
if (!confirm('DİKKAT: Bu ögeyi kalıcı olarak silmek istediğinize emin misiniz? Bu işlem geri alınamaz!')) return
if (type === 'listing') {
const res = await hardDeleteListingAction(id)
if (res?.error) alert(res.error)
}
}
return (
<div className="flex justify-end gap-2">
<button
onClick={handleRestore}
className="p-2 text-shutter hover:text-turquoise hover:bg-turquoise/10 rounded-lg transition-colors"
title="Geri Yükle"
>
<RotateCcw className="w-4 h-4" />
</button>
<button
onClick={handleHardDelete}
className="p-2 text-shutter hover:text-red-500 hover:bg-red-500/10 rounded-lg transition-colors"
title="Kalıcı Olarak Sil"
>
<Trash2 className="w-4 h-4" />
</button>
</div>
)
}