diff options
| author | Guillermo Serrahima <dev@vylion.com> | 2026-02-20 16:27:29 +0100 |
|---|---|---|
| committer | Guillermo Serrahima <dev@vylion.com> | 2026-02-20 16:27:29 +0100 |
| commit | fb11d8099e44f0e02f71d46b807dcab9c890eac8 (patch) | |
| tree | 0bcbb65ff9179e3835012f950363e7e328e862b0 /frontend | |
| parent | 4a2a8c34e87c5dd25f6d01a1aafaa10799aa907f (diff) | |
| download | llostre-fb11d8099e44f0e02f71d46b807dcab9c890eac8.tar.xz llostre-fb11d8099e44f0e02f71d46b807dcab9c890eac8.zip | |
added profile info
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/src/main.ts | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/frontend/src/main.ts b/frontend/src/main.ts index f53632c..dbf791b 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -53,6 +53,22 @@ function renderTextWithFacets(text: string, facets: any[]): string { return result; } +function renderAuthor(note: any): string { + const hasDisplayName = note.authorName && note.authorName !== ''; + const hasValidHandle = note.authorHandle !== 'handle.invalid'; + const pronouns = note.pronouns ? `<span class="muted> · ${note.pronouns}</span>` : ''; + + if (hasDisplayName && hasValidHandle) { + return `<div><strong>${note.authorName}</strong>${pronouns}</div><div class="muted">@${note.authorHandle}</div>`; + } else if (hasDisplayName && !hasValidHandle) { + return `<div><strong>${note.authorName}</strong>${pronouns}</div><div class="muted">⚠️ InvalidHandle</div>`; + } else if (!hasDisplayName && hasValidHandle) { + return `<div><strong>@${note.authorHandle}</strong>${pronouns}</div>`; + } else { + return `<div><strong>⚠️ InvalidHandle</strong>${pronouns}</div>`; + } +} + async function main() { const app = document.querySelector('#app'); if (!app) { @@ -80,11 +96,11 @@ async function main() { const postHTML = ` <div class="note"> - <img class="note-avatar" src="https://cdn.bsky.app/img/avatar/plain/did:plc:hyyqbqqhpxt2bnn7s2e2iuxd/bafkreidoiynom7v2y5rpsm467l3d2cnr7ozvlfusrchjey3k2jtyquufq4@jpeg" alt="avatar"> + <img class="note-avatar" src="${post.avatarURL}" alt="avatar"> <div class="note-content"> - <div style="font-weight: bold">@${post.authorHandle}</div> - <div class="note-text">${postText || '<br>'}</div> - <div style="font-size: 12px; color: #888">${new Date(post.createdAt).toLocaleString()}</div> + ${renderAuthor(post)} + <div class="note-text">${postText}</div> + <div class="muted">${new Date(post.createdAt).toLocaleString()}</div> </div> </div> `; |
