From 6ba43ae9df43722d747cb5a422f7a2471849b079 Mon Sep 17 00:00:00 2001 From: Guillermo Serrahima Date: Fri, 20 Feb 2026 16:34:46 +0100 Subject: cleanup --- frontend/src/main.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'frontend/src/main.ts') diff --git a/frontend/src/main.ts b/frontend/src/main.ts index dbf791b..20c3bea 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -36,7 +36,7 @@ function renderTextWithFacets(text: string, facets: any[]): string { case 'tag': result += `#${facetText}`; break; - default: // in case Bluesky ever adds other fcaet types + default: // in case Bluesky ever adds other facet types result += facetText; // if we don't recognize the type, just add it as plain text break; } @@ -48,8 +48,6 @@ function renderTextWithFacets(text: string, facets: any[]): string { const remainingBytes = postBytes.slice(lastPos); result += decoder.decode(remainingBytes); - console.log(result); - return result; } @@ -82,25 +80,25 @@ async function main() { const response = await fetch('http://localhost:8080/api/posts'); if (!response.ok) throw new Error(`HTTP ${response.status}`); - const posts = await response.json(); + const notes = await response.json(); app.innerHTML = ''; - for (const post of posts) { + for (const note of notes) { let parsedText = ''; - if(post.facets && post.facets.length > 0) { - parsedText = renderTextWithFacets(post.text || '', post.facets || []); + if(note.facets && note.facets.length > 0) { + parsedText = renderTextWithFacets(note.text || '', note.facets || []); } else { - parsedText = post.text; + parsedText = note.text; } - const postText = marked.parseInline(parsedText, { breaks: true }); + const noteText = marked.parseInline(parsedText, { breaks: true }); const postHTML = `
- avatar + avatar
- ${renderAuthor(post)} -
${postText}
-
${new Date(post.createdAt).toLocaleString()}
+ ${renderAuthor(note)} +
${noteText}
+
${new Date(note.createdAt).toLocaleString()}
`; -- cgit v1.2.3