Skip to content

Commit 5d805e4

Browse files
committed
fix: disable view transitions for borrows
1 parent 94f9245 commit 5d805e4

File tree

1 file changed

+57
-60
lines changed

1 file changed

+57
-60
lines changed

components/borrows/ListCardBorrow.tsx

Lines changed: 57 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
} from '@/components/ui/card'
2020
import Link from 'next/link'
2121
import { Route } from 'next'
22-
import { ViewTransition } from 'react'
2322
import { GetBorrowQuery } from '@/lib/api/borrow'
2423

2524
export const ListCardBorrow: React.FC<
@@ -48,65 +47,63 @@ export const ListCardBorrow: React.FC<
4847
).toString()) as Route<string>
4948

5049
return (
51-
<ViewTransition name={borrow.id} key={borrow.id}>
52-
<Card className={cn('relative', status === 'lost' && 'bg-destructive/5')}>
53-
<CardHeader>
54-
<Link
55-
href={href}
56-
className="flex justify-between items-start min-h-20"
57-
>
58-
<div>
59-
<CardTitle className="text-lg line-clamp-2">
60-
<abbr title={borrow.book.title} className="no-underline">
61-
{borrow.book.title}
62-
</abbr>
63-
</CardTitle>
64-
<CardDescription>
65-
<span className="text-muted-foreground/80 font-bold tracking-wider">
66-
#&nbsp;{idx.toString().padStart(4, '0')}
67-
</span>
68-
</CardDescription>
69-
</div>
70-
<Badge
71-
variant={
72-
getBorrowStatus(borrow) === 'overdue'
73-
? 'destructive'
74-
: getBorrowStatus(borrow) === 'active'
75-
? 'default'
76-
: 'secondary'
77-
}
78-
className="capitalize"
79-
>
80-
{getBorrowStatus(borrow)}
81-
</Badge>
82-
</Link>
83-
</CardHeader>
84-
<CardContent className="space-y-3">
85-
<div className="flex items-center gap-2 text-sm">
86-
<User className="size-4 text-muted-foreground" />
87-
<span>{borrow.subscription.user.name}</span>
88-
</div>
89-
<div className="flex items-center gap-2 text-sm">
90-
<LibraryIcon className="size-4 text-muted-foreground" />
91-
<span>{borrow.subscription.membership.library.name}</span>
92-
</div>
93-
<div className="flex items-center gap-2 text-sm">
94-
<Calendar className="size-4 text-muted-foreground" />
95-
<span>Borrowed: {formatDate(borrow.borrowed_at)}</span>
96-
</div>
97-
<div className="flex items-center gap-2 text-sm">
98-
{isDue ? (
99-
<CalendarX className="size-4 text-destructive" />
100-
) : (
101-
<CalendarClock className="size-4 text-muted-foreground" />
102-
)}
103-
<span className={cn(isDue && 'text-destructive')}>
104-
Due: {formatDate(borrow.due_at)}
105-
</span>
50+
<Card
51+
key={borrow.id}
52+
className={cn('relative', status === 'lost' && 'bg-destructive/5')}
53+
>
54+
<CardHeader>
55+
<Link href={href} className="flex justify-between items-start min-h-20">
56+
<div>
57+
<CardTitle className="text-lg line-clamp-2">
58+
<abbr title={borrow.book.title} className="no-underline">
59+
{borrow.book.title}
60+
</abbr>
61+
</CardTitle>
62+
<CardDescription>
63+
<span className="text-muted-foreground/80 font-bold tracking-wider">
64+
#&nbsp;{idx.toString().padStart(4, '0')}
65+
</span>
66+
</CardDescription>
10667
</div>
107-
</CardContent>
108-
<CardFooter>{children}</CardFooter>
109-
</Card>
110-
</ViewTransition>
68+
<Badge
69+
variant={
70+
getBorrowStatus(borrow) === 'overdue'
71+
? 'destructive'
72+
: getBorrowStatus(borrow) === 'active'
73+
? 'default'
74+
: 'secondary'
75+
}
76+
className="capitalize"
77+
>
78+
{getBorrowStatus(borrow)}
79+
</Badge>
80+
</Link>
81+
</CardHeader>
82+
<CardContent className="space-y-3">
83+
<div className="flex items-center gap-2 text-sm">
84+
<User className="size-4 text-muted-foreground" />
85+
<span>{borrow.subscription.user.name}</span>
86+
</div>
87+
<div className="flex items-center gap-2 text-sm">
88+
<LibraryIcon className="size-4 text-muted-foreground" />
89+
<span>{borrow.subscription.membership.library.name}</span>
90+
</div>
91+
<div className="flex items-center gap-2 text-sm">
92+
<Calendar className="size-4 text-muted-foreground" />
93+
<span>Borrowed: {formatDate(borrow.borrowed_at)}</span>
94+
</div>
95+
<div className="flex items-center gap-2 text-sm">
96+
{isDue ? (
97+
<CalendarX className="size-4 text-destructive" />
98+
) : (
99+
<CalendarClock className="size-4 text-muted-foreground" />
100+
)}
101+
<span className={cn(isDue && 'text-destructive')}>
102+
Due: {formatDate(borrow.due_at)}
103+
</span>
104+
</div>
105+
</CardContent>
106+
<CardFooter>{children}</CardFooter>
107+
</Card>
111108
)
112109
}

0 commit comments

Comments
 (0)