import React from "react"; import type { ProfileRecord } from "../types/bluesky"; import { BlueskyIcon } from "../components/BlueskyIcon"; import { useAtProto } from "../providers/AtProtoProvider"; export interface BlueskyProfileRendererProps { record: ProfileRecord; loading: boolean; error?: Error; did: string; handle?: string; avatarUrl?: string; } export const BlueskyProfileRenderer: React.FC = ({ record, loading, error, did, handle, avatarUrl, }) => { const { blueskyAppBaseUrl } = useAtProto(); if (error) return (
Failed to load profile.
); if (loading && !record) return
Loading…
; const profileUrl = `${blueskyAppBaseUrl}/profile/${did}`; const rawWebsite = record.website?.trim(); const websiteHref = rawWebsite ? rawWebsite.match(/^https?:\/\//i) ? rawWebsite : `https://${rawWebsite}` : undefined; const websiteLabel = rawWebsite ? rawWebsite.replace(/^https?:\/\//i, "") : undefined; return (
{avatarUrl ? ( {`${record.displayName ) : ( {record.description && (

{record.description}

)}
{record.createdAt && (
Joined {new Date(record.createdAt).toLocaleDateString()}
)} {websiteHref && websiteLabel && ( {websiteLabel} )} View on Bluesky
); }; const base: Record = { card: { display: "flex", flexDirection: "column", height: "100%", borderRadius: 12, padding: 16, fontFamily: "system-ui, sans-serif", maxWidth: 480, transition: "background-color 180ms ease, border-color 180ms ease, color 180ms ease", position: "relative", }, header: { display: "flex", gap: 12, marginBottom: 8, }, avatar: { width: 64, height: 64, borderRadius: "50%", }, avatarImg: { width: 64, height: 64, borderRadius: "50%", objectFit: "cover", }, display: { fontSize: 20, fontWeight: 600, }, handleLine: { fontSize: 13, }, desc: { whiteSpace: "pre-wrap", fontSize: 14, lineHeight: 1.4, }, meta: { marginTop: 0, fontSize: 12, }, pronouns: { display: "inline-flex", alignItems: "center", gap: 4, fontSize: 12, fontWeight: 500, borderRadius: 999, padding: "2px 8px", marginTop: 6, }, link: { display: "inline-flex", alignItems: "center", gap: 4, fontSize: 12, fontWeight: 600, textDecoration: "none", }, bottomRow: { display: "flex", alignItems: "flex-end", justifyContent: "space-between", marginTop: "auto", paddingTop: 12, }, bottomLeft: { display: "flex", flexDirection: "column", gap: 8, }, iconCorner: { // Removed absolute positioning, now in flex layout }, }; export default BlueskyProfileRenderer;