import type { CardDefinition } from '../../types'; import LatestBlueskyPostCard from './LatestBlueskyPostCard.svelte'; import { getAuthorFeed } from '$lib/atproto/methods'; export const LatestBlueskyPostCardDefinition = { type: 'latestPost', contentComponent: LatestBlueskyPostCard, createNew: (card) => { card.cardType = 'latestPost'; card.w = 4; card.mobileW = 8; card.h = 4; card.mobileH = 8; card.cardData.label = ''; }, loadData: async (items, { did }) => { const authorFeed = await getAuthorFeed({ did, filter: 'posts_no_replies', limit: 2 }); return JSON.parse(JSON.stringify(authorFeed)); }, minW: 4, name: 'Latest Bluesky Post', canHaveLabel: true, keywords: ['bsky', 'atproto', 'recent', 'feed'], groups: ['Social'], icon: ``, migrate: (item) => { if (item.cardData.label === undefined) { item.cardData.label = 'My latest bluesky post'; } } } as CardDefinition & { type: 'latestPost' };