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

34 lines
782 B
TypeScript
Raw Normal View History

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";
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()
2024-06-12 15:15:22 +00:00
return (
<div className="container px-1 md:px-4 mx-auto">
2024-07-23 15:40:35 +00:00
<DataTable columns={columns} data={storiesWithGenres} tableName="story"
genres={genres}
>
2024-06-26 16:19:03 +00:00
<CreateStoryDialog genres={genres} />
</DataTable>
2024-06-12 15:15:22 +00:00
</div>
)
}