summary refs log tree commit diff
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2024-11-30 20:38:50 +0200
committerWlodekM <[email protected]>2024-11-30 20:38:50 +0200
commitbeb7b741c1c6352a1930318489e15bb00eccc7a6 (patch)
tree5fa4c09521388edca30e787479c7b0e03dc95bf7
parentced1a470e5db8ed973919c5ed7ec65d62ed9e516 (diff)
add pfps, improve the looks of the client a bit
-rw-r--r--pages/main/page.js51
-rw-r--r--styles.less43
2 files changed, 58 insertions, 36 deletions
diff --git a/pages/main/page.js b/pages/main/page.js
index 9edb966..370b525 100644
--- a/pages/main/page.js
+++ b/pages/main/page.js
@@ -65,33 +65,42 @@ export function onload() {
     function createMessage(msg) {
         let elem = html('div')
             .class('message')
-            .for(msg.replies, r => html('div')
-                .class('reply')
-                .html(`→ ${getUsernameHTML(r)}: ${deHTML(String(r.content).slice(0, 50))}`))
             .child('div')
-                .class('message-header')
-                .child('span')
-                    .class('username')
-                    .html(getUsernameHTML(msg))
+                .class('message-container')
+                .child('img')
+                    .attr('src', msg.author.avatar)
                     .up()
                 .child('div')
-                    .class('action-buttons')
-                    .child('button')
-                        .text('reply')
-                        .ev('click', e => {
-                            if(msg.length >= 3) return;
-                            replies.push(msg);
-                            rednerReplyThingy();
-                        })
+                    .class('message-content-container')
+                    .for(msg.replies, r => html('div')
+                        .class('reply')
+                        .html(`→ ${getUsernameHTML(r)}: ${deHTML(String(r.content).slice(0, 50))}`))
+                    .child('div')
+                        .class('message-header')
+                        .child('span')
+                            .class('username')
+                            .html(getUsernameHTML(msg))
+                            .up()
+                        .child('div')
+                            .class('action-buttons')
+                            .child('button')
+                                .text('reply')
+                                .ev('click', e => {
+                                    if(msg.length >= 3) return;
+                                    replies.push(msg);
+                                    rednerReplyThingy();
+                                })
+                                .up()
+                            .up()
+                        .up()
+                    .child('span')
+                        .class('post-content')
+                        .html(md.render(msg?.content))
+                    .child('div')
+                        .for(msg.attachments, a => html('img').class('attachment').attr('src', a))
                         .up()
                     .up()
                 .up()
-            .child('span')
-                .class('post-content')
-                .html(md.render(msg?.content))
-            .child('div')
-                .for(msg.attachments, a => html('img').class('attachment').attr('src', a))
-                .up()
             .up()
         msgArea.appendChild(elem)
     }
diff --git a/styles.less b/styles.less
index 98bf87f..d67b084 100644
--- a/styles.less
+++ b/styles.less
@@ -9,6 +9,7 @@ body {
 		background: white;
 		display: flex;
 		justify-content: space-between;
+		border-bottom: gray inset 2px;
 	}
 	.main {
 		flex-grow: 1;
@@ -45,15 +46,33 @@ body {
 	display: flex;
 }
 
-.reply {
-	color: #000000aa
-}
-
-.attachment {
-	max-height: 25vw;
-	max-width: 25vw;
-	width: auto;
-	height: auto;
+.message {
+	.message-container {
+		display: flex;
+		img {
+			height: 5em;
+			aspect-ratio: 1/1;
+			border: gray inset 2px;
+		}
+		.message-content-container {
+			flex-grow: 1;
+			.reply {
+				color: #000000aa
+			}
+			.message-header {
+				width: 100%;
+			}
+			p, h1, h2, h3, h4, h5, h6 {
+				margin: 0;
+			}
+			.attachment {
+				max-height: 25vw;
+				max-width: 25vw;
+				width: auto;
+				height: auto;
+			}
+		}
+	}
 }
 
 #messageInput {
@@ -64,12 +83,6 @@ body {
     display: none;
 }
 
-.message {
-	p, h1, h2, h3, h4, h5, h6 {
-		margin: 0;
-	}
-}
-
 .message-header {
 	display: flex;
 	justify-content: space-between;