From fb11d8099e44f0e02f71d46b807dcab9c890eac8 Mon Sep 17 00:00:00 2001 From: Guillermo Serrahima Date: Fri, 20 Feb 2026 16:27:29 +0100 Subject: added profile info --- frontend/src/main.ts | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'frontend/src') 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 ? `@${note.authorHandle}`; + } else if (hasDisplayName && !hasValidHandle) { + return `
${note.authorName}${pronouns}
⚠️ InvalidHandle
`; + } else if (!hasDisplayName && hasValidHandle) { + return `
@${note.authorHandle}${pronouns}
`; + } else { + return `
⚠️ InvalidHandle${pronouns}
`; + } +} + async function main() { const app = document.querySelector('#app'); if (!app) { @@ -80,11 +96,11 @@ async function main() { const postHTML = `
- avatar + avatar
-
@${post.authorHandle}
-
${postText || '
'}
-
${new Date(post.createdAt).toLocaleString()}
+ ${renderAuthor(post)} +
${postText}
+
${new Date(post.createdAt).toLocaleString()}
`; -- cgit v1.2.3