alpha
Login
or
Join now
flo-bit.dev
/
blog-template
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
[READ-ONLY] Mirror of https://github.com/flo-bit/blog-template. minimalistic astro blog template
flo-bit.dev/blog-template/
astro
blog
template
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
fix build
author
Florian
date
2 years ago
(Nov 22, 2024, 5:18 PM +0100)
commit
c124994d
c124994d4de96884d8db649b88dc932df6a56f72
parent
423ca20b
423ca20ba2deaab03e034765042984407e26d73f
+17
-20
2 changed files
Expand all
Collapse all
Unified
Split
src
components
bluesky
BlueskyLikes.astro
Likes.svelte
+1
-5
src/components/bluesky/BlueskyLikes.astro
View file
Reviewed
···
2
2
import { SITE, BASE, BLUESKY_IDENTIFIER } from "../../config.json";
3
3
import { getCollection } from "astro:content";
4
4
import { getLikes } from "./utils";
5
5
-
import { cn } from "src/utils";
6
5
import Likes from "./Likes.svelte";
7
6
8
7
let posts = await getCollection("posts");
9
9
-
10
10
-
console.log(posts.map((post) => post.data.record.embed?.external?.uri));
11
8
12
9
const path = Astro.url.pathname;
13
10
···
21
18
new Date(a.data.indexedAt).getTime() -
22
19
new Date(b.data.indexedAt).getTime()
23
20
)
21
21
+
// @ts-expect-error: weird type fuckery
24
22
.find((post) => post.data.record.embed?.external?.uri === url);
25
23
26
24
let likesData = post ? await getLikes(post.data.uri) : [];
27
27
-
28
28
-
console.log(likesData);
29
25
---
30
26
31
27
<Likes
+16
-15
src/components/bluesky/Likes.svelte
View file
Reviewed
···
15
15
16
16
const url = window.location.href;
17
17
18
18
+
// @ts-expect-error: weird type fuckery
18
19
const post = posts.find((post) => post.post.embed?.external?.uri === url);
19
20
20
21
if (post) {
···
46
47
47
48
<div class="isolate flex -space-x-2 overflow-hidden px-4 flex-wrap">
48
49
{#each postLikesData as user, index}
49
49
-
<a
50
50
-
href={`https://bsky.app/profile/${user.actor.handle}`}
51
51
-
class={cn(
52
52
-
"relative inline-block size-12 rounded-full overflow-hidden ring-2 ring-base-900 bg-base-950",
53
53
-
index === 0 ? "-ml-2" : ""
54
54
-
)}
55
55
-
target="_blank"
56
56
-
>
57
57
-
<img
58
58
-
title={user.actor.handle}
59
59
-
loading="lazy"
60
60
-
src={user.actor.avatar}
61
61
-
alt={"liked by " + user.actor.handle}
62
62
-
/>
63
63
-
</a>
50
50
+
<a
51
51
+
href={`https://bsky.app/profile/${user.actor.handle}`}
52
52
+
class={cn(
53
53
+
"relative inline-block size-12 rounded-full overflow-hidden ring-2 ring-base-900 bg-base-950",
54
54
+
index === 0 ? "-ml-2" : ""
55
55
+
)}
56
56
+
target="_blank"
57
57
+
>
58
58
+
<img
59
59
+
title={user.actor.handle}
60
60
+
loading="lazy"
61
61
+
src={user.actor.avatar}
62
62
+
alt={"liked by " + user.actor.handle}
63
63
+
/>
64
64
+
</a>
64
65
{/each}
65
66
66
67
{#if postLikesData.length < postLikesCount}