atproto explorer pdsls.dev
atproto tool

Compare changes

Choose any two refs to compare.

+3 -1
src/views/settings.tsx
···
import { createSignal } from "solid-js";
import { TextInput } from "../components/text-input.jsx";
+
import { ThemeSelection } from "../components/theme.jsx";
export const [hideMedia, setHideMedia] = createSignal(localStorage.hideMedia === "true");
···
<div class="flex items-center gap-1 font-semibold">
<span>Settings</span>
</div>
-
<div class="flex flex-col gap-2">
+
<div class="flex flex-col gap-3">
<div class="flex flex-col gap-0.5">
<label for="plcDirectory" class="select-none">
PLC Directory
···
}}
/>
</div>
+
<ThemeSelection />
<div class="flex justify-between">
<div class="flex items-center gap-1">
<input
+7 -1
src/components/video-player.tsx
···
});
return (
-
<video ref={video} class="max-h-80 max-w-[20rem]" controls playsinline onLoadedData={props.onLoad}>
+
<video
+
ref={video}
+
class="max-h-80 max-w-[20rem]"
+
controls
+
playsinline
+
onLoadedData={props.onLoad}
+
>
<source type="video/mp4" />
</video>
);
+15 -15
src/utils/hooks/debounced.ts
···
-
import { type Accessor, createEffect, createSignal, onCleanup } from 'solid-js';
+
import { type Accessor, createEffect, createSignal, onCleanup } from "solid-js";
export const createDebouncedValue = <T>(
-
accessor: Accessor<T>,
-
delay: number,
-
equals?: false | ((prev: T, next: T) => boolean),
+
accessor: Accessor<T>,
+
delay: number,
+
equals?: false | ((prev: T, next: T) => boolean),
): Accessor<T> => {
-
const initial = accessor();
-
const [state, setState] = createSignal(initial, { equals });
+
const initial = accessor();
+
const [state, setState] = createSignal(initial, { equals });
-
createEffect((prev: T) => {
-
const next = accessor();
+
createEffect((prev: T) => {
+
const next = accessor();
-
if (prev !== next) {
-
const timeout = setTimeout(() => setState(() => next), delay);
-
onCleanup(() => clearTimeout(timeout));
-
}
+
if (prev !== next) {
+
const timeout = setTimeout(() => setState(() => next), delay);
+
onCleanup(() => clearTimeout(timeout));
+
}
-
return next;
-
}, initial);
+
return next;
+
}, initial);
-
return state;
+
return state;
};
+1 -1
src/components/notification.tsx
···
export const NotificationContainer = () => {
return (
-
<div class="pointer-events-none fixed bottom-4 left-4 z-50 flex flex-col gap-2">
+
<div class="pointer-events-none fixed bottom-4 left-4 z-60 flex flex-col gap-2">
<For each={notifications}>
{(notification) => (
<div
+30
src/utils/key.ts
···
+
import { parseDidKey, parsePublicMultikey } from "@atcute/crypto";
+
import { fromBase58Btc } from "@atcute/multibase";
+
+
export const detectKeyType = (key: string): string => {
+
try {
+
return parsePublicMultikey(key).type;
+
} catch (e) {
+
try {
+
const bytes = fromBase58Btc(key.startsWith("z") ? key.slice(1) : key);
+
if (bytes.length >= 2) {
+
const type = (bytes[0] << 8) | bytes[1];
+
if (type === 0xed01) {
+
return "ed25519";
+
}
+
}
+
} catch {}
+
return "unknown";
+
}
+
};
+
+
export const detectDidKeyType = (key: string): string => {
+
try {
+
return parseDidKey(key).type;
+
} catch (e) {
+
if (key.startsWith("did:key:")) {
+
return detectKeyType(key.slice(8));
+
}
+
return "unknown";
+
}
+
};
+1 -1
public/oauth-client-metadata.json
···
"client_uri": "https://pdsls.dev",
"logo_uri": "https://pdsls.dev/favicon.ico",
"redirect_uris": ["https://pdsls.dev/"],
-
"scope": "atproto transition:generic",
+
"scope": "atproto repo:*?action=create repo:*?action=update repo:*?action=delete blob:*/*",
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"],
"token_endpoint_auth_method": "none",
+13
src/auth/oauth-config.ts
···
+
import { configureOAuth, defaultIdentityResolver } from "@atcute/oauth-browser-client";
+
import { didDocumentResolver, handleResolver } from "../utils/api";
+
+
configureOAuth({
+
metadata: {
+
client_id: import.meta.env.VITE_OAUTH_CLIENT_ID,
+
redirect_uri: import.meta.env.VITE_OAUTH_REDIRECT_URL,
+
},
+
identityResolver: defaultIdentityResolver({
+
handleResolver: handleResolver,
+
didDocumentResolver: didDocumentResolver,
+
}),
+
});
+77
src/auth/scope-flow.ts
···
+
import { isDid, isHandle } from "@atcute/lexicons/syntax";
+
import { createAuthorizationUrl } from "@atcute/oauth-browser-client";
+
import { createSignal } from "solid-js";
+
+
interface UseOAuthScopeFlowOptions {
+
onError?: (error: unknown) => void;
+
onRedirecting?: () => void;
+
beforeRedirect?: (account: string) => Promise<void>;
+
}
+
+
export const useOAuthScopeFlow = (options: UseOAuthScopeFlowOptions = {}) => {
+
const [showScopeSelector, setShowScopeSelector] = createSignal(false);
+
const [pendingAccount, setPendingAccount] = createSignal("");
+
const [shouldForceRedirect, setShouldForceRedirect] = createSignal(false);
+
+
const initiate = (account: string) => {
+
if (!account) return;
+
setPendingAccount(account);
+
setShouldForceRedirect(false);
+
setShowScopeSelector(true);
+
};
+
+
const initiateWithRedirect = (account: string) => {
+
if (!account) return;
+
setPendingAccount(account);
+
setShouldForceRedirect(true);
+
setShowScopeSelector(true);
+
};
+
+
const complete = async (scopeString: string, scopeIds: string) => {
+
try {
+
const account = pendingAccount();
+
+
if (options.beforeRedirect && !shouldForceRedirect()) {
+
try {
+
await options.beforeRedirect(account);
+
setShowScopeSelector(false);
+
return;
+
} catch {}
+
}
+
+
localStorage.setItem("pendingScopes", scopeIds);
+
+
options.onRedirecting?.();
+
+
const authUrl = await createAuthorizationUrl({
+
scope: scopeString,
+
target:
+
isHandle(account) || isDid(account) ?
+
{ type: "account", identifier: account }
+
: { type: "pds", serviceUrl: account },
+
});
+
+
await new Promise((resolve) => setTimeout(resolve, 250));
+
location.assign(authUrl);
+
} catch (e) {
+
console.error(e);
+
options.onError?.(e);
+
setShowScopeSelector(false);
+
}
+
};
+
+
const cancel = () => {
+
setShowScopeSelector(false);
+
setPendingAccount("");
+
setShouldForceRedirect(false);
+
};
+
+
return {
+
showScopeSelector,
+
pendingAccount,
+
initiate,
+
initiateWithRedirect,
+
complete,
+
cancel,
+
};
+
};
+53
src/auth/scope-utils.ts
···
+
import { agent, sessions } from "./state";
+
+
export const GRANULAR_SCOPES = [
+
{
+
id: "create",
+
scope: "repo:*?action=create",
+
label: "Create records",
+
},
+
{
+
id: "update",
+
scope: "repo:*?action=update",
+
label: "Update records",
+
},
+
{
+
id: "delete",
+
scope: "repo:*?action=delete",
+
label: "Delete records",
+
},
+
{
+
id: "blob",
+
scope: "blob:*/*",
+
label: "Upload blobs",
+
},
+
];
+
+
export const BASE_SCOPES = ["atproto"];
+
+
export const buildScopeString = (selected: Set<string>): string => {
+
const granular = GRANULAR_SCOPES.filter((s) => selected.has(s.id)).map((s) => s.scope);
+
return [...BASE_SCOPES, ...granular].join(" ");
+
};
+
+
export const scopeIdsToString = (scopeIds: Set<string>): string => {
+
return ["atproto", ...Array.from(scopeIds)].join(",");
+
};
+
+
export const parseScopeString = (scopeIdsString: string): Set<string> => {
+
if (!scopeIdsString) return new Set();
+
const ids = scopeIdsString.split(",").filter(Boolean);
+
return new Set(ids.filter((id) => id !== "atproto"));
+
};
+
+
export const hasScope = (grantedScopes: string | undefined, scopeId: string): boolean => {
+
if (!grantedScopes) return false;
+
return grantedScopes.split(",").includes(scopeId);
+
};
+
+
export const hasUserScope = (scopeId: string): boolean => {
+
if (!agent()) return false;
+
const grantedScopes = sessions[agent()!.sub]?.grantedScopes;
+
if (!grantedScopes) return true;
+
return hasScope(grantedScopes, scopeId);
+
};
+14
src/auth/state.ts
···
+
import { OAuthUserAgent } from "@atcute/oauth-browser-client";
+
import { createSignal } from "solid-js";
+
import { createStore } from "solid-js/store";
+
+
export type Account = {
+
signedIn: boolean;
+
handle?: string;
+
grantedScopes?: string;
+
};
+
+
export type Sessions = Record<string, Account>;
+
+
export const [agent, setAgent] = createSignal<OAuthUserAgent | undefined>();
+
export const [sessions, setSessions] = createStore<Sessions>();
-143
src/components/login.tsx
···
-
import { Client } from "@atcute/client";
-
import { Did } from "@atcute/lexicons";
-
import { isDid, isHandle } from "@atcute/lexicons/syntax";
-
import {
-
configureOAuth,
-
createAuthorizationUrl,
-
defaultIdentityResolver,
-
finalizeAuthorization,
-
getSession,
-
OAuthUserAgent,
-
type Session,
-
} from "@atcute/oauth-browser-client";
-
import { createSignal, Show } from "solid-js";
-
import { didDocumentResolver, handleResolver } from "../utils/api";
-
-
configureOAuth({
-
metadata: {
-
client_id: import.meta.env.VITE_OAUTH_CLIENT_ID,
-
redirect_uri: import.meta.env.VITE_OAUTH_REDIRECT_URL,
-
},
-
identityResolver: defaultIdentityResolver({
-
handleResolver: handleResolver,
-
didDocumentResolver: didDocumentResolver,
-
}),
-
});
-
-
export const [agent, setAgent] = createSignal<OAuthUserAgent | undefined>();
-
-
type Account = {
-
signedIn: boolean;
-
handle?: string;
-
};
-
-
export type Sessions = Record<string, Account>;
-
-
const Login = () => {
-
const [notice, setNotice] = createSignal("");
-
const [loginInput, setLoginInput] = createSignal("");
-
-
const login = async (handle: string) => {
-
try {
-
setNotice("");
-
if (!handle) return;
-
setNotice(`Contacting your data server...`);
-
const authUrl = await createAuthorizationUrl({
-
scope: import.meta.env.VITE_OAUTH_SCOPE,
-
target:
-
isHandle(handle) || isDid(handle) ?
-
{ type: "account", identifier: handle }
-
: { type: "pds", serviceUrl: handle },
-
});
-
-
setNotice(`Redirecting...`);
-
await new Promise((resolve) => setTimeout(resolve, 250));
-
-
location.assign(authUrl);
-
} catch (e) {
-
console.error(e);
-
setNotice(`${e}`);
-
}
-
};
-
-
return (
-
<form class="flex flex-col gap-y-2 px-1" onsubmit={(e) => e.preventDefault()}>
-
<label for="username" class="hidden">
-
Add account
-
</label>
-
<div class="dark:bg-dark-100 dark:inset-shadow-dark-200 flex grow items-center gap-2 rounded-lg border-[0.5px] border-neutral-300 bg-white px-2 inset-shadow-xs focus-within:outline-[1px] focus-within:outline-neutral-600 dark:border-neutral-600 dark:focus-within:outline-neutral-400">
-
<label
-
for="username"
-
class="iconify lucide--user-round-plus shrink-0 text-neutral-500 dark:text-neutral-400"
-
></label>
-
<input
-
type="text"
-
spellcheck={false}
-
placeholder="user.bsky.social"
-
id="username"
-
name="username"
-
autocomplete="username"
-
aria-label="Your AT Protocol handle"
-
class="grow py-1 select-none placeholder:text-sm focus:outline-none"
-
onInput={(e) => setLoginInput(e.currentTarget.value)}
-
/>
-
<button
-
onclick={() => login(loginInput())}
-
class="flex items-center rounded-md p-1 hover:bg-neutral-100 active:bg-neutral-200 dark:hover:bg-neutral-600 dark:active:bg-neutral-500"
-
>
-
<span class="iconify lucide--log-in"></span>
-
</button>
-
</div>
-
<Show when={notice()}>
-
<div class="text-sm">{notice()}</div>
-
</Show>
-
</form>
-
);
-
};
-
-
const retrieveSession = async () => {
-
const init = async (): Promise<Session | undefined> => {
-
const params = new URLSearchParams(location.hash.slice(1));
-
-
if (params.has("state") && (params.has("code") || params.has("error"))) {
-
history.replaceState(null, "", location.pathname + location.search);
-
-
const auth = await finalizeAuthorization(params);
-
const did = auth.session.info.sub;
-
-
localStorage.setItem("lastSignedIn", did);
-
-
const sessions = localStorage.getItem("sessions");
-
const newSessions: Sessions = sessions ? JSON.parse(sessions) : { [did]: {} };
-
newSessions[did] = { signedIn: true };
-
localStorage.setItem("sessions", JSON.stringify(newSessions));
-
return auth.session;
-
} else {
-
const lastSignedIn = localStorage.getItem("lastSignedIn");
-
-
if (lastSignedIn) {
-
const sessions = localStorage.getItem("sessions");
-
const newSessions: Sessions = sessions ? JSON.parse(sessions) : {};
-
try {
-
const session = await getSession(lastSignedIn as Did);
-
const rpc = new Client({ handler: new OAuthUserAgent(session) });
-
const res = await rpc.get("com.atproto.server.getSession");
-
newSessions[lastSignedIn].signedIn = true;
-
localStorage.setItem("sessions", JSON.stringify(newSessions));
-
if (!res.ok) throw res.data.error;
-
return session;
-
} catch (err) {
-
newSessions[lastSignedIn].signedIn = false;
-
localStorage.setItem("sessions", JSON.stringify(newSessions));
-
throw err;
-
}
-
}
-
}
-
};
-
-
const session = await init();
-
-
if (session) setAgent(new OAuthUserAgent(session));
-
};
-
-
export { Login, retrieveSession };
+2 -2
src/views/blob.tsx
···
-
import { Client, CredentialManager } from "@atcute/client";
+
import { Client, simpleFetchHandler } from "@atcute/client";
import { createResource, createSignal, For, Show } from "solid-js";
import { Button } from "../components/button";
···
let rpc: Client;
const fetchBlobs = async () => {
-
if (!rpc) rpc = new Client({ handler: new CredentialManager({ service: props.pds }) });
+
if (!rpc) rpc = new Client({ handler: simpleFetchHandler({ service: props.pds }) });
const res = await rpc.get("com.atproto.sync.listBlobs", {
params: {
did: props.repo as `did:${string}:${string}`,
+2 -2
src/views/collection.tsx
···
import { ComAtprotoRepoApplyWrites, ComAtprotoRepoGetRecord } from "@atcute/atproto";
-
import { Client, CredentialManager } from "@atcute/client";
+
import { Client, simpleFetchHandler } from "@atcute/client";
import { $type, ActorIdentifier, InferXRPCBodyOutput } from "@atcute/lexicons";
import * as TID from "@atcute/tid";
import { A, useParams } from "@solidjs/router";
···
const fetchRecords = async () => {
if (!pds) pds = await resolvePDS(did!);
-
if (!rpc) rpc = new Client({ handler: new CredentialManager({ service: pds }) });
+
if (!rpc) rpc = new Client({ handler: simpleFetchHandler({ service: pds }) });
const res = await rpc.get("com.atproto.repo.listRecords", {
params: {
repo: did as ActorIdentifier,
+2 -2
src/views/pds.tsx
···
import { ComAtprotoServerDescribeServer, ComAtprotoSyncListRepos } from "@atcute/atproto";
-
import { Client, CredentialManager } from "@atcute/client";
+
import { Client, simpleFetchHandler } from "@atcute/client";
import { InferXRPCBodyOutput } from "@atcute/lexicons";
import * as TID from "@atcute/tid";
import { A, useLocation, useParams } from "@solidjs/router";
···
setPDS(params.pds);
const pds =
params.pds!.startsWith("localhost") ? `http://${params.pds}` : `https://${params.pds}`;
-
const rpc = new Client({ handler: new CredentialManager({ service: pds }) });
+
const rpc = new Client({ handler: simpleFetchHandler({ service: pds }) });
const getVersion = async () => {
// @ts-expect-error: undocumented endpoint
+2 -2
src/views/repo.tsx
···
-
import { Client, CredentialManager } from "@atcute/client";
+
import { Client, simpleFetchHandler } from "@atcute/client";
import { DidDocument } from "@atcute/identity";
import { ActorIdentifier, Did, Handle, Nsid } from "@atcute/lexicons";
import { A, useLocation, useNavigate, useParams } from "@solidjs/router";
···
return {};
}
-
rpc = new Client({ handler: new CredentialManager({ service: pds }) });
+
rpc = new Client({ handler: simpleFetchHandler({ service: pds }) });
try {
const res = await rpc.get("com.atproto.repo.describeRepo", {
params: { repo: did as ActorIdentifier },
public/favicon.ico

This is a binary file and will not be displayed.

public/fonts/Figtree[wght].woff2

This is a binary file and will not be displayed.

+7 -1
src/styles/index.css
···
@custom-variant dark (&:where(.dark, .dark *));
+
@font-face {
+
font-family: "Figtree";
+
src: url("/fonts/Figtree[wght].woff2") format("woff2");
+
font-display: swap;
+
}
+
@theme {
-
--font-sans: "Inter", sans-serif;
+
--font-sans: "Figtree", sans-serif;
--font-mono: "Roboto Mono", monospace;
--font-pecita: "Pecita", serif;
+5 -1
src/auth/account.tsx
···
return (
<MenuProvider>
<DropdownMenu icon="lucide--ellipsis" buttonClass="rounded-md p-2">
-
<NavMenu href={`/at://${props.did}`} label="Go to repo" icon="lucide--user-round" />
+
<NavMenu
+
href={`/at://${props.did}`}
+
label={agent()?.sub === props.did ? "Go to repo (g)" : "Go to repo"}
+
icon="lucide--user-round"
+
/>
<ActionMenu
icon="lucide--settings"
label="Edit permissions"
+109
src/components/create/file-upload.tsx
···
+
import { Client } from "@atcute/client";
+
import { remove } from "@mary/exif-rm";
+
import { createSignal, onCleanup, Show } from "solid-js";
+
import { agent } from "../../auth/state";
+
import { Button } from "../button.jsx";
+
import { TextInput } from "../text-input.jsx";
+
import { editorInstance } from "./state";
+
+
export const FileUpload = (props: {
+
file: File;
+
blobInput: HTMLInputElement;
+
onClose: () => void;
+
}) => {
+
const [uploading, setUploading] = createSignal(false);
+
const [error, setError] = createSignal("");
+
+
onCleanup(() => (props.blobInput.value = ""));
+
+
const formatFileSize = (bytes: number) => {
+
if (bytes === 0) return "0 Bytes";
+
const k = 1024;
+
const sizes = ["Bytes", "KB", "MB", "GB"];
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
+
return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + " " + sizes[i];
+
};
+
+
const uploadBlob = async () => {
+
let blob: Blob;
+
+
const mimetype = (document.getElementById("mimetype") as HTMLInputElement)?.value;
+
(document.getElementById("mimetype") as HTMLInputElement).value = "";
+
if (mimetype) blob = new Blob([props.file], { type: mimetype });
+
else blob = props.file;
+
+
if ((document.getElementById("exif-rm") as HTMLInputElement).checked) {
+
const exifRemoved = remove(new Uint8Array(await blob.arrayBuffer()));
+
if (exifRemoved !== null) blob = new Blob([exifRemoved], { type: blob.type });
+
}
+
+
const rpc = new Client({ handler: agent()! });
+
setUploading(true);
+
const res = await rpc.post("com.atproto.repo.uploadBlob", {
+
input: blob,
+
});
+
setUploading(false);
+
if (!res.ok) {
+
setError(res.data.error);
+
return;
+
}
+
editorInstance.view.dispatch({
+
changes: {
+
from: editorInstance.view.state.selection.main.head,
+
insert: JSON.stringify(res.data.blob, null, 2),
+
},
+
});
+
props.onClose();
+
};
+
+
return (
+
<div class="dark:bg-dark-300 dark:shadow-dark-700 absolute top-70 left-[50%] w-[20rem] -translate-x-1/2 rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md transition-opacity duration-200 dark:border-neutral-700 starting:opacity-0">
+
<h2 class="mb-2 font-semibold">Upload blob</h2>
+
<div class="flex flex-col gap-2 text-sm">
+
<div class="flex flex-col gap-1">
+
<p class="flex gap-1">
+
<span class="truncate">{props.file.name}</span>
+
<span class="shrink-0 text-neutral-600 dark:text-neutral-400">
+
({formatFileSize(props.file.size)})
+
</span>
+
</p>
+
</div>
+
<div class="flex items-center gap-x-2">
+
<label for="mimetype" class="shrink-0 select-none">
+
MIME type
+
</label>
+
<TextInput id="mimetype" placeholder={props.file.type} />
+
</div>
+
<div class="flex items-center gap-1">
+
<input id="exif-rm" type="checkbox" checked />
+
<label for="exif-rm" class="select-none">
+
Remove EXIF data
+
</label>
+
</div>
+
<p class="text-xs text-neutral-600 dark:text-neutral-400">
+
Metadata will be pasted after the cursor
+
</p>
+
<Show when={error()}>
+
<span class="text-red-500 dark:text-red-400">Error: {error()}</span>
+
</Show>
+
<div class="flex justify-between gap-2">
+
<Button onClick={props.onClose}>Cancel</Button>
+
<Show when={uploading()}>
+
<div class="flex items-center gap-1">
+
<span class="iconify lucide--loader-circle animate-spin"></span>
+
<span>Uploading</span>
+
</div>
+
</Show>
+
<Show when={!uploading()}>
+
<Button
+
onClick={uploadBlob}
+
class="dark:shadow-dark-700 flex items-center gap-1 rounded-lg bg-blue-500 px-2 py-1.5 text-xs text-white shadow-xs select-none hover:bg-blue-600 active:bg-blue-700 dark:bg-blue-600 dark:hover:bg-blue-500 dark:active:bg-blue-400"
+
>
+
Upload
+
</Button>
+
</Show>
+
</div>
+
</div>
+
</div>
+
);
+
};
+87
src/components/create/handle-input.tsx
···
+
import { Handle } from "@atcute/lexicons";
+
import { createSignal, Show } from "solid-js";
+
import { resolveHandle } from "../../utils/api";
+
import { Button } from "../button.jsx";
+
import { TextInput } from "../text-input.jsx";
+
import { editorInstance } from "./state";
+
+
export const HandleInput = (props: { onClose: () => void }) => {
+
const [resolving, setResolving] = createSignal(false);
+
const [error, setError] = createSignal("");
+
let handleFormRef!: HTMLFormElement;
+
+
const resolveDid = async (e: SubmitEvent) => {
+
e.preventDefault();
+
const formData = new FormData(handleFormRef);
+
const handleValue = formData.get("handle")?.toString().trim();
+
+
if (!handleValue) {
+
setError("Please enter a handle");
+
return;
+
}
+
+
setResolving(true);
+
setError("");
+
try {
+
const did = await resolveHandle(handleValue as Handle);
+
editorInstance.view.dispatch({
+
changes: {
+
from: editorInstance.view.state.selection.main.head,
+
insert: `"${did}"`,
+
},
+
});
+
props.onClose();
+
handleFormRef.reset();
+
} catch (err: any) {
+
setError(err.message || "Failed to resolve handle");
+
} finally {
+
setResolving(false);
+
}
+
};
+
+
return (
+
<div class="dark:bg-dark-300 dark:shadow-dark-700 absolute top-70 left-[50%] w-[20rem] -translate-x-1/2 rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md transition-opacity duration-200 dark:border-neutral-700 starting:opacity-0">
+
<h2 class="mb-2 font-semibold">Insert DID from handle</h2>
+
<form ref={handleFormRef} onSubmit={resolveDid} class="flex flex-col gap-2 text-sm">
+
<div class="flex flex-col gap-1">
+
<label for="handle-input" class="select-none">
+
Handle
+
</label>
+
<TextInput id="handle-input" name="handle" placeholder="user.bsky.social" />
+
</div>
+
<p class="text-xs text-neutral-600 dark:text-neutral-400">
+
DID will be pasted after the cursor
+
</p>
+
<Show when={error()}>
+
<span class="text-red-500 dark:text-red-400">Error: {error()}</span>
+
</Show>
+
<div class="flex justify-between gap-2">
+
<Button
+
type="button"
+
onClick={() => {
+
props.onClose();
+
handleFormRef.reset();
+
setError("");
+
}}
+
>
+
Cancel
+
</Button>
+
<Show when={resolving()}>
+
<div class="flex items-center gap-1">
+
<span class="iconify lucide--loader-circle animate-spin"></span>
+
<span>Resolving</span>
+
</div>
+
</Show>
+
<Show when={!resolving()}>
+
<Button
+
type="submit"
+
class="dark:shadow-dark-700 flex items-center gap-1 rounded-lg bg-blue-500 px-2 py-1.5 text-xs text-white shadow-xs select-none hover:bg-blue-600 active:bg-blue-700 dark:bg-blue-600 dark:hover:bg-blue-500 dark:active:bg-blue-400"
+
>
+
Insert
+
</Button>
+
</Show>
+
</div>
+
</form>
+
</div>
+
);
+
};
+12
src/components/create/menu-item.tsx
···
+
export const MenuItem = (props: { icon: string; label: string; onClick: () => void }) => {
+
return (
+
<button
+
type="button"
+
class="flex items-center gap-2 rounded-md p-2 text-left text-xs hover:bg-neutral-100 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"
+
onClick={props.onClick}
+
>
+
<span class={`iconify ${props.icon}`}></span>
+
<span>{props.label}</span>
+
</button>
+
);
+
};
+4
src/components/create/state.ts
···
+
import { createSignal } from "solid-js";
+
+
export const editorInstance = { view: null as any };
+
export const [placeholder, setPlaceholder] = createSignal<any>();
+1 -1
src/views/record.tsx
···
import { agent } from "../auth/state";
import { Backlinks } from "../components/backlinks.jsx";
import { Button } from "../components/button.jsx";
-
import { RecordEditor, setPlaceholder } from "../components/create.jsx";
+
import { RecordEditor, setPlaceholder } from "../components/create";
import {
CopyMenu,
DropdownMenu,