From 47209bd9656f88c62f672433079fc9aa13ca223c Mon Sep 17 00:00:00 2001 From: Trezy Date: Sat, 14 Mar 2026 00:57:54 -0500 Subject: [PATCH] feat: display user handles in users page --- web/src/app/(dashboard)/users/page.tsx | 32 +++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/web/src/app/(dashboard)/users/page.tsx b/web/src/app/(dashboard)/users/page.tsx index 72d4eed..93cf207 100644 --- a/web/src/app/(dashboard)/users/page.tsx +++ b/web/src/app/(dashboard)/users/page.tsx @@ -77,6 +77,7 @@ const TEMPLATE_PERMISSIONS: Record = { export default function UsersPage() { const { getToken, did: currentDid } = useAuth(); const [users, setUsers] = useState([]); + const [handles, setHandles] = useState>({}); const [error, setError] = useState(null); const [expandedUserId, setExpandedUserId] = useState(null); @@ -93,6 +94,26 @@ export default function UsersPage() { load(); }, [load]); + // Resolve DIDs to handles via PLC directory + useEffect(() => { + const newDids = users.map((u) => u.did).filter((did) => !(did in handles)); + if (newDids.length === 0) return; + for (const did of newDids) { + fetch(`https://plc.directory/${encodeURIComponent(did)}`) + .then((res) => (res.ok ? res.json() : null)) + .then((data) => { + if (!data) return; + const handle = data.alsoKnownAs + ?.find((aka: string) => aka.startsWith("at://")) + ?.replace("at://", ""); + if (handle) { + setHandles((prev) => ({ ...prev, [did]: handle })); + } + }) + .catch(() => {}); + } + }, [users, handles]); + async function handleDelete(id: string) { try { await deleteUser(getToken, id); @@ -179,7 +200,7 @@ export default function UsersPage() { - DID + User Permissions Created Last Used @@ -224,7 +245,7 @@ export default function UsersPage() { setExpandedUserId( expandedUserId === user.id ? null : user.id @@ -232,7 +253,12 @@ export default function UsersPage() { } >
- {user.did} +
+ {handles[user.did] && ( + @{handles[user.did]} + )} + {user.did} +
{user.is_super && ( Owner -- 2.51.2