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,17 +1,13 @@
'use client'
import {
RecentGroup,
saveRecentGroup,
} from '@/app/groups/recent-groups-helpers'
import { saveRecentGroup } from '@/app/groups/recent-groups-helpers'
import { useEffect } from 'react'
import { useCurrentGroup } from './current-group-context'
type Props = {
group: RecentGroup
}
export function SaveGroupLocally() {
const { group } = useCurrentGroup()
export function SaveGroupLocally({ group }: Props) {
useEffect(() => {
saveRecentGroup(group)
if (group) saveRecentGroup({ id: group.id, name: group.name })
}, [group])
return null