import * as BlueMojiCollectionItem from "../../client/types/blue/moji/collection/item"; import React, { CSSProperties } from "react"; import { DotLottieReact } from "@lottiefiles/dotlottie-react"; export const BluemojiNotAvailable = ({ style = {}, className = "bluemoji bluemoji-not-available", label = "This Bluemoji cannot be rendered.", }: { style?: CSSProperties; className?: string; label?: string; }) => ( ); export const Bluemoji = ({ item, did, width = 128, height = 128, cdnBase = "https://cdn.bsky.app/img/avatar_thumbnail/plain/", style = {}, className = "bluemoji", }: { item: BlueMojiCollectionItem.Record; did: string; width?: 128; height?: 128; cdnBase?: string; style?: CSSProperties; className?: string; }) => { if (!BlueMojiCollectionItem.isRecord(item) || !did) { console.log("Invalid record passed to Bluemoji renderer"); return ; } if (BlueMojiCollectionItem.isFormats_v0(item.formats)) { if (item.formats.lottie) { return ( ); } else if (item.formats.apng_128) { const blob = new Blob([item.formats.apng_128], { type: "image/png" }); const data = URL.createObjectURL(blob); return ; } else { const cid = item.formats.png_128?.ref || item.formats.webp_128?.ref || item.formats.gif_128?.ref; if (!cid) { console.error( `Invalid Bluemoji v0 blob format detected on ${did}/blue.moji.collection.item/${item.name}`, ); return ; } const uri = `${cdnBase}/${did}/${cid}@PNG`; return ; } } };