Skip to content

Commit 1a9c9d2

Browse files
authored
feat: add num of collects in Bangumi LinkCard (#552)
* feat: add num of collects in bgm character/person * fix: In HTML, <div> cannot be a descendant of <p>. This will cause a hydration error. * fix: unable to turn page * feat: add num of collects in bgm subject
1 parent 820d787 commit 1a9c9d2

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

src/components/layout/footer/FooterInfo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ const FooterBottom = async () => {
179179

180180
return (
181181
<div className="mt-12 space-y-3 text-center md:mt-6 md:text-left">
182-
<p>
182+
<div>
183183
<span>© {date.replace('{{now}}', currentYear)} </span>
184184
<a href="/">
185185
<OwnerName />
@@ -203,7 +203,7 @@ const FooterBottom = async () => {
203203
<span className="mt-3 block md:mt-0 md:inline">
204204
Stay hungry. Stay foolish.
205205
</span>
206-
</p>
206+
</div>
207207
<div>
208208
<PoweredBy className="my-3 block md:my-0 md:inline" />
209209
{icp && (

src/components/modules/post/PostPagination.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,20 @@ export const PostPagination: FC<{ pagination: Pager }> = ({ pagination }) => {
1111
return (
1212
<section className="mt-4 flex justify-between">
1313
{pagination.hasPrevPage ? (
14-
<MotionButtonBase tabIndex={-1} className={className}>
15-
<Link href={`/posts?page=${pagination.currentPage - 1}`}>上一页</Link>
16-
</MotionButtonBase>
14+
<Link href={`/posts?page=${pagination.currentPage - 1}`}>
15+
<MotionButtonBase tabIndex={-1} className={className}>
16+
上一页
17+
</MotionButtonBase>
18+
</Link>
1719
) : (
1820
<div />
1921
)}
2022
{pagination.hasNextPage && (
21-
<MotionButtonBase tabIndex={-1} className={className}>
22-
<Link href={`/posts?page=${pagination.currentPage + 1}`}>下一页</Link>
23-
</MotionButtonBase>
23+
<Link href={`/posts?page=${pagination.currentPage + 1}`}>
24+
<MotionButtonBase tabIndex={-1} className={className}>
25+
下一页
26+
</MotionButtonBase>
27+
</Link>
2428
)}
2529
</section>
2630
)

src/components/ui/link-card/LinkCard.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,10 +575,31 @@ const fetchBangumiData: FetchObject = {
575575
<span className="text-sm opacity-70">({originalTitle})</span>
576576
)}
577577
{type === 'subject' && (
578+
<span className="inline-flex shrink-0 items-center gap-3 self-center">
579+
<span className="inline-flex shrink-0 items-center gap-1 self-center text-xs text-orange-400 dark:text-yellow-500">
580+
<MingcuteStarHalfFill />
581+
<span className="font-sans font-medium">
582+
{json.rating.score > 0 && json.rating.score.toFixed(1)}
583+
</span>
584+
</span>
585+
<span className="inline-flex shrink-0 items-center gap-1 self-center text-xs text-orange-400 dark:text-yellow-500">
586+
<i className="i-mingcute-star-line" />
587+
<span className="font-sans font-medium">
588+
{json.collection &&
589+
json.collection.on_hold +
590+
json.collection.dropped +
591+
json.collection.wish +
592+
json.collection.collect +
593+
json.collection.doing}
594+
</span>
595+
</span>
596+
</span>
597+
)}
598+
{(type === 'character' || type === 'person') && (
578599
<span className="inline-flex shrink-0 items-center gap-1 self-center text-xs text-orange-400 dark:text-yellow-500">
579-
<MingcuteStarHalfFill />
600+
<i className="i-mingcute-star-line" />
580601
<span className="font-sans font-medium">
581-
{json.rating.score > 0 && json.rating.score.toFixed(1)}
602+
{json.stat.collects > 0 && json.stat.collects}
582603
</span>
583604
</span>
584605
)}

0 commit comments

Comments
 (0)