diff --git a/web/src/app/(dashboard)/users/page.tsx b/web/src/app/(dashboard)/users/page.tsx --- a/web/src/app/(dashboard)/users/page.tsx +++ b/web/src/app/(dashboard)/users/page.tsx @@ -77,6 +77,7 @@ 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); @@ -92,6 +93,26 @@ useEffect(() => { 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 { @@ -179,7 +200,7 @@ - DID + User Permissions Created Last Used @@ -224,7 +245,7 @@ setExpandedUserId( expandedUserId === user.id ? null : user.id @@ -232,7 +253,12 @@ } >
- {user.did} +
+ {handles[user.did] && ( + @{handles[user.did]} + )} + {user.did} +
{user.is_super && ( Owner