import { Link } from "@tanstack/react-router"; import { getComponent } from "./json/getComponent"; // lazy dumb component. redo this ASAP export function RenderJson(props: { data: any; depth?: number; did: string; pds: string; }) { if (props.data === null) return null; if (!props.depth) { props.depth = 0; } // if data is not an object just render it if (typeof props.data !== "object") { if (typeof props.data === "string") { if (props.data.startsWith("at://")) { // have to do this b/c Link type safety. // there's only a set num of things it can be anyways let parts = props.data.replace("at://", "").split("/"); switch (parts.length) { case 1: return ( {props.data} ); case 2: return ( {props.data} ); case 3: return ( {props.data} ); } } else if (props.data.startsWith("did:")) { return ( {props.data} ); } } return {props.data}; } // if the data is an object we have a custom component for, use that instead if (props.data.$type) { const Component = getComponent(props.data?.$type); if (Component) { console.log("props.data", props.data); return (