]> Repos - mime-chat/commitdiff
[bug] fix renderer get message by id functinality
authorriqo <hernandeze2@xavier.edu>
Sat, 5 Dec 2020 18:32:59 +0000 (12:32 -0600)
committerriqo <hernandeze2@xavier.edu>
Sat, 5 Dec 2020 18:32:59 +0000 (12:32 -0600)
src/background.ts
src/components/UI/UIDetails/messageRenderer.vue
src/components/UI/UIDetails/messages.ts
src/composables/messageItem/useMessageItemComp.ts
src/composables/messageRenderer/useOffsetCalculator.ts

index c937b1bac67a313f36fe933965ec1bb7ba6cfc36..c7a5e330c4881794ad1be552ba5a785d9d420aae 100644 (file)
@@ -33,8 +33,8 @@ protocol.registerSchemesAsPrivileged([
 function createWindow() {
   // Create the browser window.
   win = new BrowserWindow({
-    width: 450,
-    height: 1025,
+    width: 350,
+    height: 525,
     resizable: true,
     webPreferences: {
       // Use pluginOptions.nodeIntegration, leave this alone
index aeac5cceae691cee1b0f934d491bc985545b85e5..a07459e735c67bd8471a9af34ec0b6cbc20d8117 100644 (file)
@@ -9,7 +9,6 @@
       <g
         v-for="(item, index) in renderArr"
         :key="index"
-        :id="index"
         class="messageList"
         transform="translate(0, 0)"
       >
index 39593c2da082780f1c31017cb0932e1b58cf25ae..f470bb6f5005125e031bfd7c4878b9a75ea355aa 100644 (file)
@@ -1,15 +1,6 @@
 import { Message } from "@/types/message/index";
 
 const Messages: Message[] = [
-    {
-        content:
-            "I can be there at 5 pm tomorrow to greet you at a Chick file with my almond and chive salad.",
-        context: "You to Josie Wright",
-        subContext: "josie@gmail.com",
-        modifier: "sf",
-        id: "1",
-        time: ""
-    },
     {
         content: "Sounds good, see you Thursday.",
         context: "Message from Josie Wright",
@@ -19,19 +10,12 @@ const Messages: Message[] = [
         time: ""
     },
     {
-        content: "Hey Anna, did you get the paper done?",
-        context: "Mesage from Tommy McConville",
-        subContext: "New Conversation",
-        modifier: "ai",
-        id: "3",
-        time: ""
-    },
-    {
-        content: "Yes posting it online soon.",
-        context: "You to Tommy McConville",
-        subContext: "",
-        modifier: "ai",
-        id: "4",
+        content:
+            "I can be there at 5 pm tomorrow to greet you at a Chick file with my almond and chive salad.",
+        context: "You to Josie Wright",
+        subContext: "josie@gmail.com",
+        modifier: "sf",
+        id: "1",
         time: ""
     },
     {
@@ -50,6 +34,15 @@ const Messages: Message[] = [
         id: "6",
         time: ""
     },
+
+    {
+        content: "Hey Anna, did you get the paper done?",
+        context: "Mesage from Tommy McConville",
+        subContext: "New Conversation",
+        modifier: "ai",
+        id: "3",
+        time: ""
+    },
     {
         content: "Hey do you know Enrique Hernandez?",
         context: "Message from Crimata",
@@ -58,6 +51,15 @@ const Messages: Message[] = [
         id: "7",
         time: ""
     },
+
+    {
+        content: "Yes posting it online soon.",
+        context: "You to Tommy McConville",
+        subContext: "",
+        modifier: "sf",
+        id: "4",
+        time: ""
+    },
     {
         content: "Hey do you know Enrique Hernandez?",
         context: "Message from Crimata",
index afb216df76a49c004460d7cdadf061e4bdb91a57..94efbb6628c61065d533748f90a97ce967942420 100644 (file)
@@ -31,10 +31,11 @@ export default function useMessageItemComp(m: string, id: string) {
       }
   }
 
+  const selfMessageMarginRight = 2.5;
   const calculateXoffset = async () => {
     switch (m) {
         case "sf":
-            x.value = winW - messageWidth.value;
+            x.value = winW - messageWidth.value - selfMessageMarginRight;
             break;
         default:
             x.value = paddingLeft;
index dcbbe20bdbff74a3c57083f35db0ea5fc1e43dc4..5efad539437c8f9bc0174076dd2ac431c41b46e7 100644 (file)
@@ -2,10 +2,10 @@ import { ref } from "vue";
 export default function useOffsetCalculator() {
     const xOffset = ref(0);
     const yOffset = ref(0);
+    const firstChildMarginTop = 40;
     let previousMessageHeight = 0;
     const messagePadding = 10;
 
-
     function setXoffset(message: HTMLElement): void {
         const computedQuery = window.getComputedStyle(message)
         const matrix = new WebKitCSSMatrix(computedQuery.webkitTransform);
@@ -14,7 +14,7 @@ export default function useOffsetCalculator() {
 
     function setYoffset(messageHeight: number): void {
         if (previousMessageHeight === 0) {
-            yOffset.value = 40;
+            yOffset.value = firstChildMarginTop;
         } else {
             yOffset.value += previousMessageHeight + messagePadding;
         }