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