// import { sql } from '@/lib/db' // import { Button } from '@/components/ui/button' // import DeleteModalBtn from '@/components/ui/DeleteModalBtn' // import { Suspense } from 'react' // import { Loader2 } from 'lucide-react' // import Link from 'next/link' // interface Model { // id: string | number // name: string // slug: string // featured: boolean // location_name: string | null // } // interface AdminModelsListProps { // searchParams: { page?: string } // } // export default async function AdminModelsList({ searchParams }: AdminModelsListProps) { // const page = parseInt(searchParams.page || '1', 10) // const pageSize = 10 // Number of items per page // const offset = (page - 1) * pageSize // // Fetch data with pagination // const [rows, countResult] = await Promise.all([ // sql` // SELECT m.id, m.name, m.slug, m.featured, l.name as location_name // FROM models m // LEFT JOIN locations l ON l.id = m.location_id // ORDER BY m.created_at DESC // LIMIT ${pageSize} OFFSET ${offset} // `, // sql<{ total: number }[]>` // SELECT COUNT(*) as total // FROM models // `, // ]) // const totalItems = countResult[0]?.total || 0 // const totalPages = Math.ceil(totalItems / pageSize) // const hasPreviousPage = page > 1 // const hasNextPage = page < totalPages // return ( // }> //
//
//

Models

// // // //
// {/* Table */} //
// // // // // // // // // // // // {rows.length === 0 ? ( // // // // ) : ( // rows.map((r) => ( // // // // // // // // )) // )} // //
NameSlugLocationFeaturedActions
// No models found //
{r.name}{r.slug}{r.location_name || '-'}{r.featured ? 'Yes' : 'No'} //
// // Edit // // //
//
//
// {/* Pagination Controls */} //
//
// Showing {(page - 1) * pageSize + 1} to{' '} // {Math.min(page * pageSize, totalItems)} of {totalItems} models //
//
// // //
//
//
//
// ) // } // function LoadingSkeleton() { // return ( //
//
//

Models

// //
//
// // // // // // // // // // // // {[...Array(5)].map((_, i) => ( // // // // // // // // ))} // //
NameSlugLocationFeaturedActions
//
//
//
//
//
//
//
//
//
//
//
//
// ) // }