Skip to content

Commit ccda15a

Browse files
committed
fix: book details & watchlist btn
1 parent a82f05e commit ccda15a

File tree

4 files changed

+29
-19
lines changed

4 files changed

+29
-19
lines changed

app/(protected)/admin/books/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export default async function BookDetailsPage({
163163
<div className="mt-6 pt-6 border-t">
164164
{/* <Link href="/reviews"> */}
165165
<Button variant="outline" className="w-full bg-transparent">
166-
View All Reviews
166+
View All Reviews ({reviewsRes.meta.total})
167167
</Button>
168168
{/* </Link> */}
169169
</div>

app/(protected)/books/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export default async function BookDetailsPage({
172172
<div className="mt-6 pt-6 border-t">
173173
{/* <Link href="/reviews"> */}
174174
<Button variant="outline" className="w-full bg-transparent">
175-
View All Reviews
175+
View All Reviews ({reviewsRes.meta.total})
176176
</Button>
177177
{/* </Link> */}
178178
</div>

components/books/DataRecentBorrows.tsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import {
66
Book,
77
ChevronRight,
88
Clock,
9-
MessageSquare,
10-
Star,
119
Calendar,
1210
CalendarCheck,
1311
} from 'lucide-react'
@@ -20,6 +18,7 @@ import { Avatar, AvatarFallback } from '../ui/avatar'
2018
import { formatDate, getBorrowStatus } from '@/lib/utils'
2119
import { Badge } from '../ui/badge'
2220
import { Button } from '../ui/button'
21+
import clsx from 'clsx'
2322

2423
export const DataRecentBorrows: React.FC<
2524
React.ComponentProps<typeof RecentBorrows>
@@ -57,7 +56,7 @@ const RecentBorrows: React.FC<{
5756
sort_by: 'created_at',
5857
limit: 5,
5958
user_id,
60-
include_review: 'true',
59+
// include_review: 'true',
6160
},
6261
{
6362
headers,
@@ -97,7 +96,11 @@ const RecentBorrows: React.FC<{
9796
<Link
9897
href={((isAdmin ? '/admin' : '') + `/borrows/${borrow.id}`) as Route}
9998
key={borrow.id}
100-
className="flex items-center justify-between p-4 rounded-lg border bg-muted/30 hover:bg-muted/50 transition-colors"
99+
className={clsx(
100+
'flex flex-row justify-between items-center p-4 rounded-lg border bg-muted/30 hover:bg-muted/50 transition-colors',
101+
getBorrowStatus(borrow) === 'active' &&
102+
'border-(--color-vibrant,var(--color-primary))'
103+
)}
101104
>
102105
<div className="flex items-center gap-4">
103106
{isAdmin && (
@@ -123,25 +126,26 @@ const RecentBorrows: React.FC<{
123126
</div>
124127
</div>
125128
</div>
126-
<div className="flex items-center gap-3">
127-
{borrow.review ? (
128-
<div className="flex items-center gap-1 text-sm">
129-
<Star className="h-4 w-4 fill-(--color-vibrant,var(--color-yellow-400)) text-(--color-vibrant,var(--color-yellow-400))" />
130-
<span>{borrow.review.rating}</span>
131-
</div>
132-
) : borrow.returning ? (
133-
<Badge variant="outline" className="text-xs">
134-
<MessageSquare className="h-3 w-3 mr-1" />
135-
No review
136-
</Badge>
137-
) : null}
138-
{getBorrowStatus(borrow)}
129+
<div className="flex justify-between md:items-center gap-3">
130+
<Badge
131+
variant={
132+
getBorrowStatus(borrow) === 'overdue'
133+
? 'destructive'
134+
: getBorrowStatus(borrow) === 'active'
135+
? 'default'
136+
: 'secondary'
137+
}
138+
className="capitalize hidden md:block"
139+
>
140+
{getBorrowStatus(borrow)}
141+
</Badge>
139142
<Button variant="ghost" size="icon" className="h-8 w-8">
140143
<ChevronRight className="h-4 w-4" />
141144
</Button>
142145
</div>
143146
</Link>
144147
))}
148+
145149
<div className="">
146150
<Link
147151
href={

lib/utils/color-utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,11 @@ export function colorsToCssVars(
6767
}
6868
}
6969

70+
// --color-muted is conflicting with tailwind's muted class, so we use --color-muted- instead
71+
if (vars['--color-muted']) {
72+
vars['--color-muted-'] = vars['--color-muted']
73+
delete vars['--color-muted']
74+
}
75+
7076
return vars
7177
}

0 commit comments

Comments
 (0)