@@ -16,13 +16,15 @@ import {
1616import Link from 'next/link'
1717import type { Metadata } from 'next'
1818import { SITE_NAME } from '@/lib/consts'
19- import { BellRing , Heart } from 'lucide-react'
19+ import { BellRing } from 'lucide-react'
2020import { Badge } from '@/components/ui/badge'
2121import { Verify } from '@/lib/firebase/firebase'
2222import { Button } from '@/components/ui/button'
2323import { getListCollections } from '@/lib/api/collection'
2424import { ListCollection } from '@/components/collections/ListCollection'
2525import { SearchInput } from '@/components/common/SearchInput'
26+ import { FollowCollectionButton } from '@/components/collections/FollowCollectionButton'
27+ import { colorsToCssVars } from '@/lib/utils/color-utils'
2628
2729export const metadata : Metadata = {
2830 title : `Collections · ${ SITE_NAME } ` ,
@@ -50,12 +52,13 @@ export default async function UserCollections({
5052 skip : skip ,
5153 title : sp ?. title ,
5254 include_library : 'true' ,
55+ include_stats : 'true' ,
5356 ...( library_id ? { library_id } : { } ) ,
5457 } as const
5558
56- await Verify ( { from : '/collections' } )
59+ const headers = await Verify ( { from : '/collections' } )
5760
58- const res = await getListCollections ( query )
61+ const res = await getListCollections ( query , { headers } )
5962
6063 if ( 'error' in res ) {
6164 console . log ( res )
@@ -89,14 +92,6 @@ export default async function UserCollections({
8992 </ BreadcrumbItem >
9093 </ BreadcrumbList >
9194 </ Breadcrumb >
92- < Button variant = "secondary" asChild >
93- < Link href = "/collections/watchlist" >
94- < >
95- < BellRing className = "mr-2 h-4 w-4" />
96- Followings
97- </ >
98- </ Link >
99- </ Button >
10095 </ div >
10196 </ nav >
10297
@@ -111,19 +106,15 @@ export default async function UserCollections({
111106 < div className = "grid gap-4 md:grid-cols-2 lg:grid-cols-3" >
112107 { res . data . map ( ( col ) => (
113108 < Link key = { col . id } href = { `/collections/${ col . id } ` } passHref >
114- < ListCollection collection = { col } >
115- < Button
116- size = "sm"
117- className = "w-full"
118- style = { {
119- backgroundColor : 'var(--accent-bg)' ,
120- color : 'var(--accent-text)' ,
121- } }
122- disabled
123- >
124- < Heart className = "mr-2 size-4" />
125- Follow
126- </ Button >
109+ < ListCollection
110+ collection = { col }
111+ style = { colorsToCssVars ( col . colors ) }
112+ >
113+ < FollowCollectionButton
114+ collectionId = { col . id }
115+ initialIsFollowed = { ! ! col . stats ?. followed_at }
116+ className = "bg-(--color-vibrant,var(--color-primary)) hover:bg-(--color-dark-muted,var(--color-muted-foreground)) dark:hover:bg-(--color-light-muted,var(--color-muted-foreground))"
117+ />
127118 </ ListCollection >
128119 </ Link >
129120 ) ) }
0 commit comments