aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorGuillermo Serrahima <dev@vylion.com>2026-04-11 07:30:49 +0200
committerGuillermo Serrahima <dev@vylion.com>2026-04-11 07:30:49 +0200
commitf6d60077b7cfc0d589fa7961e2bb59aea9f993a3 (patch)
tree1e994b619b33ea88ef3f62cb97aba4c2cf07ff61 /frontend
parentf8de6c378945495f304efebad86be05d5623290a (diff)
downloadllostre-f6d60077b7cfc0d589fa7961e2bb59aea9f993a3.tar.xz
llostre-f6d60077b7cfc0d589fa7961e2bb59aea9f993a3.zip
media rendering (wip)
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/main.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index 816b86c..056e9f0 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -18,6 +18,12 @@ interface Note {
type: string;
value: string;
}>;
+ media?: Array<{
+ url: string;
+ alt: string;
+ width?: number;
+ height?: number;
+ }>;
}
// convert Facets to Markdown (before Markdown parsing) if Markdown passing is enabled
@@ -162,6 +168,22 @@ function createNoteElement(note: Note): HTMLElement {
}
content.appendChild(textDiv);
+ if (note.media && note.media.length > 0) {
+ const mediaDiv = document.createElement('div');
+ mediaDiv.className = 'note-media';
+ note.media.forEach(item => {
+ const img = document.createElement('img');
+ img.src = item.url;
+ img.alt = item.alt || '';
+ if (item.width && item.height) {
+ img.width = item.width;
+ img.height = item.height;
+ }
+ mediaDiv.appendChild(img);
+ });
+ content.appendChild(mediaDiv);
+ }
+
const timeDiv = document.createElement('div');
timeDiv.className = 'muted';
timeDiv.textContent = new Date(note.createdAt).toLocaleString();