subman-nextjs/src/app/publication/page.tsx

23 lines
627 B
TypeScript
Raw Normal View History

2024-06-20 08:35:25 +00:00
import { Genre, Pub } from "@prisma/client";
2024-06-26 17:32:18 +00:00
import { getGenres, getPubsWithGenres } from "app/lib/get";
2024-06-20 08:35:25 +00:00
import { columns } from "./columns";
import { DataTable } from "app/ui/tables/data-table";
2024-06-26 17:32:18 +00:00
import CreatePubDialog from "./create";
2024-06-20 08:35:25 +00:00
export type PubsWithGenres = Pub & { genres: Array<Genre> }
2024-06-26 17:32:18 +00:00
2024-06-20 08:35:25 +00:00
export default async function Page() {
2024-06-26 17:32:18 +00:00
const genres = await getGenres()
2024-06-20 08:35:25 +00:00
const pubs = await getPubsWithGenres()
return (
2024-06-20 21:21:37 +00:00
<div className="container mx-auto">
2024-08-06 10:51:23 +00:00
<DataTable data={pubs} columns={columns} tableName="pub" genres={genres}>
2024-06-26 17:32:18 +00:00
<CreatePubDialog genres={genres} />
</DataTable>
2024-06-20 08:35:25 +00:00
</div>
)
}