| 1 | import { ClickCounter } from "@/app/_ui/click-counter"; |
| 2 | import { TabGroup } from "@/app/_ui/tab-group"; |
| 3 | import { getCategories, getCategory } from "@/app/api/categories/getCategories"; |
| 4 | |
| 5 | export default async function Layout({ |
| 6 | children, |
| 7 | params, |
| 8 | }: { |
| 9 | children: React.ReactNode; |
| 10 | params: { categorySlug: string }; |
| 11 | }) { |
| 12 | const category = await getCategory({ slug: params.categorySlug }); |
| 13 | const categories = await getCategories({ parent: params.categorySlug }); |
| 14 | |
| 15 | return ( |
| 16 | <div className="space-y-9"> |
| 17 | <div className="flex justify-between"> |
| 18 | <TabGroup |
| 19 | path={`/feed/${category.slug}`} |
| 20 | items={[ |
| 21 | { |
| 22 | text: 'All', |
| 23 | }, |
| 24 | ...categories.map((x) => ({ |
| 25 | text: x.name, |
| 26 | slug: x.slug, |
| 27 | })), |
| 28 | ]} |
| 29 | /> |
| 30 | |
| 31 | <div className="self-start"> |
| 32 | <ClickCounter /> |
| 33 | </div> |
| 34 | </div> |
| 35 | |
| 36 | <div>{children}</div> |
| 37 | </div> |
| 38 | ); |
| 39 | } |