A React component library for rendering common AT Protocol records for applications such as Bluesky and Leaflet.
1import type { ProfileRecord } from '../types/bluesky';
2
3interface LegacyBlobRef {
4 ref?: { $link?: string };
5 cid?: string;
6}
7
8export function getAvatarCid(record: ProfileRecord | undefined): string | undefined {
9 const avatar = record?.avatar as LegacyBlobRef | undefined;
10 if (!avatar) return undefined;
11 if (typeof avatar.cid === 'string') return avatar.cid;
12 return avatar.ref?.$link;
13}