@@ -365,10 +365,13 @@ const { user } = useAtproto()
365365
366366const authModal = useModal (' auth-modal' )
367367
368- const { data : likesData } = useFetch (() => ` /api/social/likes/${packageName .value } ` , {
369- default : () => ({ totalLikes: 0 , userHasLiked: false }),
370- server: false ,
371- })
368+ const { data : likesData, status : likeStatus } = useFetch (
369+ () => ` /api/social/likes/${packageName .value } ` ,
370+ {
371+ default : () => ({ totalLikes: 0 , userHasLiked: false }),
372+ server: false ,
373+ },
374+ )
372375
373376const isLikeActionPending = ref (false )
374377
@@ -548,32 +551,35 @@ defineOgImageComponent('Package', {
548551 :is-binary =" isBinaryOnly"
549552 class =" self-baseline ms-1 sm:ms-2"
550553 />
554+
555+ <!-- Package likes -->
556+ <button
557+ @click =" likeAction"
558+ type =" button"
559+ class =" inline-flex items-center gap-1.5 font-mono text-sm text-fg hover:text-fg-muted transition-colors duration-200"
560+ :title =" $t('package.links.like')"
561+ >
562+ <span
563+ :class ="
564+ likesData?.userHasLiked
565+ ? 'i-lucide-heart-minus text-red-500'
566+ : 'i-lucide-heart-plus'
567+ "
568+ class =" w-4 h-4"
569+ aria-hidden =" true"
570+ />
571+ <span >{{ formatCompactNumber(likesData?.totalLikes ?? 0, { decimals: 1 }) }}</span >
572+ </button >
573+
551574 <template #fallback >
552575 <div class =" flex items-center gap-1.5 self-baseline ms-1 sm:ms-2" >
553576 <SkeletonBlock class =" w-8 h-5 rounded" />
554577 <SkeletonBlock class =" w-12 h-5 rounded" />
578+ <SkeletonBlock class =" w-5 h-5 rounded" />
555579 </div >
556580 </template >
557581 </ClientOnly >
558582
559- <button
560- @click =" likeAction"
561- type =" button"
562- class =" inline-flex items-center gap-1.5 font-mono text-sm text-fg hover:text-fg-muted transition-colors duration-200"
563- :title =" $t('package.links.like')"
564- >
565- <span
566- :class ="
567- likesData?.userHasLiked
568- ? 'i-lucide-heart-minus text-red-500'
569- : 'i-lucide-heart-plus'
570- "
571- class =" w-4 h-4"
572- aria-hidden =" true"
573- />
574- <span >{{ formatCompactNumber(likesData?.totalLikes ?? 0, { decimals: 1 }) }}</span >
575- </button >
576-
577583 <!-- Internal navigation: Docs + Code + Compare (hidden on mobile, shown in external links instead) -->
578584 <nav
579585 v-if =" resolvedVersion"
0 commit comments