From d9943b201d98a2396d62b9a190659e2e776da019 Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Wed, 20 Apr 2022 17:23:27 -0600 Subject: UI updates and fix message directioning --- lib/aggiedit_web/live/post_live/show.html.heex | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'lib/aggiedit_web/live') diff --git a/lib/aggiedit_web/live/post_live/show.html.heex b/lib/aggiedit_web/live/post_live/show.html.heex index 8f91fda..b89999b 100644 --- a/lib/aggiedit_web/live/post_live/show.html.heex +++ b/lib/aggiedit_web/live/post_live/show.html.heex @@ -22,14 +22,15 @@
-
-
-
-
    -
+
+
+
Chat
+
+
    +
+
+
-
-
@@ -52,11 +53,11 @@ element.scrollIntoView({ behavior: 'smooth', block: 'end' }); }; - const appendComment = ({user, body, id, inserted_at}, element) => { + const appendComment = ({user, body, id, user_id, inserted_at}, element) => { const messageElement = document.createElement("div"); messageElement.innerHTML = ` -
  • -
    +
  • +
    ${user}

    ${body}

    @@ -69,10 +70,11 @@ }; + let channel; window.addEventListener('phx:initial-post', (e) => { const chatWindow = document.getElementById("chat"); window.userSocket.connect(); - let channel = window.RoomChat.connect(window.userSocket, e.detail.id); + channel = window.RoomChat.connect(window.userSocket, e.detail.id); channel.on('shout', (comment) => { appendComment(comment, chatWindow); -- cgit v1.2.3-70-g09d2