Use tRPC for recent groups page (#253)

* Use tRPC for recent groups page

* Use tRPC for adding group by URL

* Use tRPC for saving visited group

* Group context
This commit is contained in:
Sebastien Castiel
2024-10-20 17:43:42 -04:00
parent 39c1a2ffc6
commit 4db788680e
31 changed files with 314 additions and 260 deletions

View File

@@ -1,9 +1,7 @@
import { cached } from '@/app/cached-functions'
import { GroupHeader } from '@/app/groups/[groupId]/group-header'
import { SaveGroupLocally } from '@/app/groups/[groupId]/save-recent-group'
import { Metadata } from 'next'
import { notFound } from 'next/navigation'
import { PropsWithChildren } from 'react'
import { GroupLayoutClient } from './layout.client'
type Props = {
params: {
@@ -24,20 +22,9 @@ export async function generateMetadata({
}
}
export default async function GroupLayout({
export default function GroupLayout({
children,
params: { groupId },
}: PropsWithChildren<Props>) {
const group = await cached.getGroup(groupId)
if (!group) notFound()
return (
<>
<GroupHeader groupId={groupId} />
{children}
<SaveGroupLocally group={{ id: group.id, name: group.name }} />
</>
)
return <GroupLayoutClient groupId={groupId}>{children}</GroupLayoutClient>
}