Skip to content

Commit e29d09a

Browse files
committed
feat(bluesky): add sad face placeholder when no engagement
1 parent 491be28 commit e29d09a

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

src/components/BlueskyEngagement.astro

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,24 @@ const handle = "codingwithcalvin.net";
129129
if (likesLabel) likesLabel.textContent = likes === 1 ? 'like from' : 'likes from';
130130
if (repostsLabel) repostsLabel.textContent = reposts === 1 ? 'repost from' : 'reposts from';
131131

132-
// Note: We always show the sections even with 0 counts
133-
// The count displays "0 likes from" / "0 reposts from"
134-
// Avatars area remains empty when there are no likers/reposters
132+
// Show sad face when no engagement
133+
const sadFaceHtml = `<div class="flex items-center justify-center w-12 h-12 text-text-muted">
134+
<svg class="w-10 h-10" fill="none" stroke="currentColor" viewBox="0 0 24 24">
135+
<circle cx="12" cy="12" r="10" stroke-width="1.5"/>
136+
<circle cx="9" cy="9" r="1" fill="currentColor"/>
137+
<circle cx="15" cy="9" r="1" fill="currentColor"/>
138+
<path stroke-linecap="round" stroke-width="1.5" d="M8 16c1.333-1 2.667-1.5 4-1.5s2.667.5 4 1.5"/>
139+
</svg>
140+
</div>`;
141+
142+
if (likes === 0 && likersAvatars) {
143+
likersAvatars.innerHTML = sadFaceHtml;
144+
}
145+
146+
const repostersAvatars = container.querySelector('.reposters-avatars');
147+
if (reposts === 0 && repostersAvatars) {
148+
repostersAvatars.innerHTML = sadFaceHtml;
149+
}
135150

136151
// Update Bluesky link
137152
if (blueskyLink) {
@@ -179,7 +194,6 @@ const handle = "codingwithcalvin.net";
179194
}
180195

181196
// Fetch reposters for avatars (limit to 50)
182-
const repostersAvatars = container.querySelector('.reposters-avatars');
183197
if (reposts > 0 && repostersAvatars) {
184198
const repostsRes = await fetch(
185199
`https://public.api.bsky.app/xrpc/app.bsky.feed.getRepostedBy?uri=${encodeURIComponent(atUri)}&limit=50`

0 commit comments

Comments
 (0)