Personal Site
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Limit the number of displayed quotes to `parent skeet > child skeet > "read more"`

TODO:
- refactor Post.astro to be more maintainable and tolerable to use
- fix how it shows up so its not as chaotic as it is rn
- link to the actual post

+28 -11
+28 -11
src/components/home/feeds/Post.astro
··· 7 7 type ResourceUri, 8 8 } from "@atcute/lexicons"; 9 9 import { AppBskyFeedPost } from "@atcute/bluesky"; 10 - import { throws } from "/utils"; 11 - import BoxTlbr from "/assets/box-tlbr.png" 10 + import { throws, type Prettify } from "/utils"; 11 + import BoxTlbr from "/assets/box-tlbr.png"; 12 12 13 13 export interface Author { 14 14 did: `did:${string}:${string}`; ··· 20 20 interface Props { 21 21 post: AppBskyFeedPost.Main; 22 22 author: Author; 23 + nested?: boolean; 23 24 } 24 25 25 - const { post, author } = Astro.props; 26 + const { post, author, nested = false } = Astro.props; 26 27 27 28 const understoodDid = ( 28 29 did: `did:${string}:${string}`, ··· 76 77 }; 77 78 type embedRecord = { 78 79 $type: "app.bsky.embed.record"; 79 - record: AppBskyFeedPost.Main; 80 - author: Author; 80 + record: AppBskyFeedPost.Main | null; 81 + author: Author | null; 81 82 }; 83 + 82 84 type embedRecordWithMedia = { 83 85 $type: "app.bsky.embed.recordWithMedia"; 84 86 record: embedRecord; ··· 135 137 thumb: external.thumb, 136 138 }); 137 139 138 - const record = async (uri: ResourceUri): Promise<embedRecord> => { 140 + const record = async (uri: ResourceUri): Promise<Prettify<embedRecord>> => { 141 + if (nested) 142 + return { $type: "app.bsky.embed.record", record: null, author: null }; 139 143 const data = await client 140 144 .get("app.bsky.feed.getPosts", { 141 145 params: { ··· 277 281 return ( 278 282 <ul> 279 283 <li> 280 - <Astro.self post={embed.record} author={embed.author} /> 284 + {embed.record && embed.author ? ( 285 + <Astro.self 286 + post={embed.record} 287 + author={embed.author} 288 + nested 289 + /> 290 + ) : ( 291 + <div class="post">Read More</div> 292 + )} 281 293 </li> 282 294 </ul> 283 295 ); ··· 320 332 )} 321 333 <ul> 322 334 <li> 323 - <Astro.self 324 - post={embed.record.record} 325 - author={embed.record.author} 326 - /> 335 + {embed.record.record && embed.record.author ? ( 336 + <Astro.self 337 + post={embed.record.record} 338 + author={embed.record.author} 339 + nested 340 + /> 341 + ) : ( 342 + <div class="post">Read More</div> 343 + )} 327 344 </li> 328 345 </ul> 329 346 </>