2024-06-12 15:15:22 +00:00
|
|
|
import { Story } from "@prisma/client";
|
2024-06-20 08:35:25 +00:00
|
|
|
import { DataTable } from "app/ui/tables/data-table";
|
2024-06-12 15:15:22 +00:00
|
|
|
import { columns } from "./columns";
|
2024-06-26 16:19:03 +00:00
|
|
|
import { getGenres, getStoriesWithGenres, getPubsWithGenres } from "app/lib/get";
|
2024-06-19 09:53:35 +00:00
|
|
|
import { Genre } from "@prisma/client";
|
2024-06-26 16:19:03 +00:00
|
|
|
import CreateStoryDialog from "./create";
|
2024-06-19 11:13:54 +00:00
|
|
|
|
2024-06-19 17:46:30 +00:00
|
|
|
export type StoryWithGenres = Story & { genres: Array<Genre> }
|
|
|
|
|
2024-06-26 16:19:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-12 15:15:22 +00:00
|
|
|
export default async function Page() {
|
2024-06-26 16:19:03 +00:00
|
|
|
const genres = await getGenres()
|
|
|
|
const storiesWithGenres: Array<StoryWithGenres> = await getStoriesWithGenres()
|
|
|
|
const pubsWithGenres = await getPubsWithGenres()
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-12 15:15:22 +00:00
|
|
|
return (
|
2024-06-20 21:21:37 +00:00
|
|
|
<div className="container mx-auto">
|
2024-06-26 16:19:03 +00:00
|
|
|
<DataTable columns={columns} data={storiesWithGenres} type="story">
|
|
|
|
<CreateStoryDialog genres={genres} />
|
2024-06-29 15:21:56 +00:00
|
|
|
{/* TODO - EDIT STORY DIALOG */}
|
2024-06-26 16:19:03 +00:00
|
|
|
</DataTable>
|
2024-06-12 15:15:22 +00:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|