diff --git a/src/lib/AccountComponent.svelte b/src/lib/AccountComponent.svelte index 3f12cf7..faf6251 100644 --- a/src/lib/AccountComponent.svelte +++ b/src/lib/AccountComponent.svelte @@ -12,10 +12,14 @@ alt="avatar of {account.displayName}" src="{Config.PDS_URL}/xrpc/com.atproto.sync.getBlob?did={account.did}&cid={account.avatarCid}" /> +
+ {account.displayName || account.handle || account.did} +
+ {:else} +
+ {account.displayName || account.handle || account.did} +
{/if} -
- {account.displayName || account.handle || account.did} -
diff --git a/src/lib/pdsfetch.ts b/src/lib/pdsfetch.ts index 20120fb..d57aff4 100644 --- a/src/lib/pdsfetch.ts +++ b/src/lib/pdsfetch.ts @@ -132,7 +132,13 @@ const getDidsFromPDS = async (): Promise => { const getAccountMetadata = async ( did: `did:${string}:${string}`, ) => { - // gonna assume self exists in the app.bsky.actor.profile + const account: AccountMetadata = { + did: did, + handle: "", // Guaranteed to be filled out later + displayName: "", + avatarCid: null, + }; + try { const { data } = await rpc.get("com.atproto.repo.getRecord", { params: { @@ -142,21 +148,22 @@ const getAccountMetadata = async ( }, }); const value = data.value as AppBskyActorProfile.Record; - const handle = await blueskyHandleFromDid(did); - const account: AccountMetadata = { - did: did, - handle: handle, - displayName: value.displayName || "", - avatarCid: null, - }; + account.displayName = value.displayName || ""; if (value.avatar) { account.avatarCid = value.avatar.ref["$link"]; } - return account; } catch (e) { - console.error(`Error fetching metadata for ${did}:`, e); + console.warn(`Error fetching profile for ${did}:`, e); + } + + try { + account.handle = await blueskyHandleFromDid(did); + } catch (e) { + console.error(`Error fetching handle for ${did}:`, e); return null; } + + return account; }; const getAllMetadataFromPds = async (): Promise => { diff --git a/themes/express/theme.css b/themes/express/theme.css index cbc2336..58c399e 100644 --- a/themes/express/theme.css +++ b/themes/express/theme.css @@ -237,6 +237,7 @@ a:hover { margin-right: 4px; border: 4px solid var(--border-color); box-shadow: var(--border-color) 10px 10px; + min-height: 30px; } #accountName { margin-left: 10px; @@ -249,6 +250,10 @@ a:hover { white-space: nowrap; } +.no-avatar { + margin-left: 40px !important; +} + /* App.Svelte */ /* desktop style */ diff --git a/themes/witchcraft/theme.css b/themes/witchcraft/theme.css index cd15805..8ad63d4 100644 --- a/themes/witchcraft/theme.css +++ b/themes/witchcraft/theme.css @@ -235,6 +235,7 @@ a:hover { padding: 0px; margin-bottom: 15px; border: 1px solid var(--border-color); + min-height: 30px; } #accountName { margin-left: 10px; @@ -247,6 +248,11 @@ a:hover { white-space: nowrap; } + +.no-avatar { + margin-left: 70px !important; +} + /* App.Svelte */ /* desktop style */