first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:46:42 +03:00
commit 2a5b661443
202 changed files with 49770 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
"use client"
import { ColumnDef } from "@tanstack/react-table"
import { Hero } from "@/types/hero"
import { Badge } from "@/components/ui/badge"
import { HeroRowActions } from "./hero-row-actions"
export const getColumns = (onSuccess: () => void): ColumnDef<Hero>[] => [
{
accessorKey: "image",
header: "Görsel",
cell: ({ row }) => {
const imagePath = row.getValue("image") as string
if (!imagePath) return <div className="w-16 h-9 bg-gray-100 rounded" />
return (
<div className="w-24 h-14 relative rounded overflow-hidden border">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={`${process.env.NEXT_PUBLIC_API_URL}${imagePath}`}
alt={row.original.title}
className="object-cover w-full h-full"
/>
</div>
)
},
},
{
accessorKey: "title",
header: "Başlık",
},
{
accessorKey: "is_active",
header: "Durum",
cell: ({ row }) => {
const isActive = row.getValue("is_active") as boolean
return (
<Badge variant={isActive ? "default" : "secondary"}>
{isActive ? "Aktif" : "Pasif"}
</Badge>
)
},
},
{
accessorKey: "DeletedAt",
header: "Silinme Durumu",
cell: ({ row }) => {
const deletedAt = row.getValue("DeletedAt")
if (deletedAt) {
return <Badge variant="destructive">Silinmiş</Badge>
}
return null
}
},
{
id: "actions",
cell: ({ row }) => <HeroRowActions row={row} onSuccess={onSuccess} />,
},
]