@@ -7,36 +7,29 @@ import {
77 BreadcrumbPage ,
88 BreadcrumbSeparator ,
99} from '@/components/ui/breadcrumb'
10- import { Button } from '@/components/ui/button'
1110import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card'
1211import { getCollection , getListCollectionBooks } from '@/lib/api/collection'
13- import {
14- BookOpen ,
15- Calendar ,
16- Edit ,
17- Heart ,
18- Library ,
19- Plus ,
20- Settings ,
21- Trash2 ,
22- Users ,
23- } from 'lucide-react'
12+ import { Book , Calendar , Library , Users } from 'lucide-react'
2413import Image from 'next/image'
2514import Link from 'next/link'
2615
2716export default async function CollectionDetailsPage ( {
2817 params,
18+ searchParams,
2919} : {
3020 params : Promise < { id : string } >
21+ searchParams : { title ?: string }
3122} ) {
3223 // const claims = await IsLoggedIn()
3324
3425 const { id } = await params
26+ const { title } = searchParams
3527
3628 const [ collectionRes , bookRes ] = await Promise . all ( [
3729 getCollection ( id ) ,
3830 getListCollectionBooks ( id , {
3931 include_book : 'true' ,
32+ book_title : title ,
4033 } ) ,
4134 ] )
4235
@@ -91,40 +84,13 @@ export default async function CollectionDetailsPage({
9184 < span > { collectionRes . data . follower_count } followers</ span >
9285 </ div >
9386 < div className = "flex items-center gap-1" >
94- < BookOpen className = "h-4 w-4" />
87+ < Book className = "h-4 w-4" />
9588 < span > { collectionRes . data . book_count } books</ span >
9689 </ div >
9790 </ div >
9891 </ div >
9992 </ div >
10093
101- { /* Action Buttons */ }
102- { /* <div className="flex gap-2 mb-8 flex-wrap">
103- <Button variant={true ? 'secondary' : 'default'}>
104- <Heart className={`mr-2 h-4 w-4 ${true ? 'fill-current' : ''}`} />
105- {true ? 'Following' : 'Follow'}
106- </Button>
107- <Button variant="outline" asChild>
108- <Link href={`/collections/${collectionRes.data.id}/manage-books` }>
109- <Settings className="mr-2 h-4 w-4" />
110- Manage Books
111- </Link>
112- </Button>
113- <Button variant="outline" asChild>
114- <Link href={`/collections/${collectionRes.data.id}/edit` }>
115- <Edit className="mr-2 h-4 w-4" />
116- Edit
117- </Link>
118- </Button>
119- <Button
120- variant="outline"
121- className="text-red-600 hover:text-red-700 bg-transparent"
122- >
123- <Trash2 className="mr-2 h-4 w-4" />
124- Delete
125- </Button>
126- </div> */ }
127-
12894 < div className = "grid grid-cols-1 lg:grid-cols-4 gap-8" >
12995 { /* Collection Info */ }
13096 < div className = "lg:col-span-1" >
@@ -149,7 +115,7 @@ export default async function CollectionDetailsPage({
149115 < span > { collectionRes . data . follower_count } followers</ span >
150116 </ div >
151117 < div className = "flex items-center gap-2 text-sm" >
152- < BookOpen className = "h-4 w-4 text-muted-foreground" />
118+ < Book className = "h-4 w-4 text-muted-foreground" />
153119 < span > { bookRes . data . length } books</ span >
154120 </ div >
155121 < div className = "flex items-center gap-2 text-sm" >
@@ -170,37 +136,28 @@ export default async function CollectionDetailsPage({
170136 < div className = "lg:col-span-3" >
171137 < div className = "flex justify-between items-center mb-6" >
172138 < h2 className = "text-2xl font-semibold" > Books in Collection</ h2 >
173- { /* <Button asChild>
174- <Link href={`/collections/${collectionRes.data.id}/manage-books` }>
175- <Plus className="mr-2 h-4 w-4" />
176- Manage Books
177- </Link>
178- </Button> */ }
179139 </ div >
180140
181141 < div className = "grid gap-6 md:grid-cols-2 lg:grid-cols-3" >
182142 { bookRes . data . map ( ( collectionBook ) => (
183- < ListBook book = { collectionBook . book ! } key = { collectionBook . id } />
143+ < Link
144+ href = { `/books/${ collectionBook . book ?. id } ` }
145+ key = { collectionBook . id }
146+ >
147+ < ListBook book = { collectionBook . book ! } />
148+ </ Link >
184149 ) ) }
185150 </ div >
186151
187152 { collectionRes . data . book_count === 0 && (
188153 < Card className = "p-12 text-center" >
189- < BookOpen className = "h-12 w-12 text-muted-foreground mx-auto mb-4" />
154+ < Book className = "h-12 w-12 text-muted-foreground mx-auto mb-4" />
190155 < h3 className = "text-lg font-medium mb-2" >
191156 No books in this collection
192157 </ h3 >
193158 < p className = "text-muted-foreground mb-4" >
194- Start building your collection by adding some books.
159+ Follow this collection to get updates when new books are added .
195160 </ p >
196- { /* <Button asChild>
197- <Link
198- href={`/collections/${collectionRes.data.id}/manage-books` }
199- >
200- <Plus className="mr-2 h-4 w-4" />
201- Add Books
202- </Link>
203- </Button> */ }
204161 </ Card >
205162 ) }
206163 </ div >
0 commit comments