atproto explorer pdsls.dev
atproto tool

only link schema for $type fields

juli.ee 1cf8db5f 2408254c

verified
Changed files
+8 -7
src
components
+8 -7
src/components/json.tsx
···
mimeType: string;
}
-
const JSONString = ({ data }: { data: string }) => {
+
const JSONString = ({ data, isType }: { data: string; isType?: boolean }) => {
const navigate = useNavigate();
const isURL =
···
<A class="text-blue-400 hover:underline active:underline" href={`/at://${part}`}>
{part}
</A>
-
: isNsid(part.split("#")[0]) ?
+
: isNsid(part.split("#")[0]) && isType ?
<button
type="button"
onClick={() => handleClick(part)}
···
"invisible h-0": !show(),
}}
>
-
<JSONValue data={value} repo={repo} />
+
<JSONValue data={value} repo={repo} isType={key === "$type" ? true : undefined} />
</span>
</span>
);
···
);
};
-
export const JSONValue = ({ data, repo }: { data: JSONType; repo: string }) => {
-
if (typeof data === "string") return <JSONString data={data} />;
+
export const JSONValue = (props: { data: JSONType; repo: string; isType?: boolean }) => {
+
const data = props.data;
+
if (typeof data === "string") return <JSONString data={data} isType={props.isType} />;
if (typeof data === "number") return <JSONNumber data={data} />;
if (typeof data === "boolean") return <JSONBoolean data={data} />;
if (data === null) return <JSONNull />;
-
if (Array.isArray(data)) return <JSONArray data={data} repo={repo} />;
-
return <JSONObject data={data} repo={repo} />;
+
if (Array.isArray(data)) return <JSONArray data={data} repo={props.repo} />;
+
return <JSONObject data={data} repo={props.repo} />;
};
export type JSONType = string | number | boolean | null | { [x: string]: JSONType } | JSONType[];