your personal website on atproto - mirror blento.app
at fix-cached-posts 37 lines 1.5 kB view raw
1import type { CardDefinition } from '../../types'; 2import LatestBlueskyPostCard from './LatestBlueskyPostCard.svelte'; 3import { getAuthorFeed } from '$lib/atproto/methods'; 4 5export const LatestBlueskyPostCardDefinition = { 6 type: 'latestPost', 7 contentComponent: LatestBlueskyPostCard, 8 createNew: (card) => { 9 card.cardType = 'latestPost'; 10 card.w = 4; 11 card.mobileW = 8; 12 card.h = 4; 13 card.mobileH = 8; 14 15 card.cardData.label = ''; 16 }, 17 loadData: async (items, { did }) => { 18 const authorFeed = await getAuthorFeed({ did, filter: 'posts_no_replies', limit: 2 }); 19 20 return JSON.parse(JSON.stringify(authorFeed)); 21 }, 22 minW: 4, 23 24 name: 'Latest Bluesky Post', 25 26 canHaveLabel: true, 27 28 keywords: ['bsky', 'atproto', 'recent', 'feed'], 29 groups: ['Social'], 30 icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-4"><path d="M6.335 3.836a47.2 47.2 0 0 1 5.354 4.94c.088.093.165.18.232.26a18 18 0 0 1 .232-.26 47.2 47.2 0 0 1 5.355-4.94C18.882 2.687 21.46 1.37 22.553 2.483c.986 1.003.616 4.264.305 5.857-.567 2.902-2.018 4.274-3.703 4.542 2.348.386 4.678 1.96 3.13 5.602-1.97 4.636-7.065 1.763-9.795-.418a3 3 0 0 1-.18-.15 3 3 0 0 1-.18.15c-2.73 2.18-7.825 5.054-9.795.418-1.548-3.643.782-5.216 3.13-5.602C3.98 12.631 2.529 11.26 1.962 8.357c-.311-1.593-.681-4.854.305-5.857C3.361 1.37 5.94 2.687 6.335 3.836Z" /></svg>`, 31 32 migrate: (item) => { 33 if (item.cardData.label === undefined) { 34 item.cardData.label = 'My latest bluesky post'; 35 } 36 } 37} as CardDefinition & { type: 'latestPost' };