your personal website on atproto - mirror
blento.app
1import { describeRepo } from '$lib/atproto';
2import type { CardDefinition } from '../types';
3import ATProtoCollectionsCard from './ATProtoCollectionsCard.svelte';
4
5export const ATProtoCollectionsCardDefinition = {
6 type: 'atprotocollections',
7 contentComponent: ATProtoCollectionsCard,
8 loadData: async (items, { did }) => {
9 const data = await describeRepo({ did });
10 const collections = new Set<string>();
11 for (const collection of data?.collections ?? []) {
12 const split = collection.split('.');
13 if (split.length > 1) collections.add(split[1] + '.' + split[0]);
14 }
15
16 return Array.from(collections);
17 },
18 createNew: (item) => {
19 item.w = 4;
20 item.mobileW = 8;
21 },
22 sidebarButtonText: 'Atmosphere Collections'
23} as CardDefinition & { type: 'atprotocollections' };