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
24 name: 'ATProto Collections',
25
26 groups: ['Social'],
27 icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="size-4"><path stroke-linecap="round" stroke-linejoin="round" d="M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125" /></svg>`
28
29} as CardDefinition & { type: 'atprotocollections' };