]> Repos - mime-chat/commitdiff
minor enhancements (e.g. idk what else to say)
authorAndrew Gundersen <gundersena@xavier.edu>
Fri, 9 Apr 2021 13:30:34 +0000 (08:30 -0500)
committerAndrew Gundersen <gundersena@xavier.edu>
Fri, 9 Apr 2021 13:30:34 +0000 (08:30 -0500)
session.json
src/components/controllers/audioCtrl.ts
src/components/controllers/textCtrl.ts
src/components/message.vue
src/modules/message.ts
src/types.ts
window.json

index 688a9c46b1a2e68774a37ecc851beef57aa1bd06..c5383dd36a64638422f04c8287b8dac133dbdd2c 100644 (file)
@@ -1 +1 @@
-{"key":"6cde67f6-6188-452d-a54e-9d38cabf2d63","newMessages":[]}
\ No newline at end of file
+{"key":"1099b966-d9e5-4f1a-876e-13535af32f26","newMessages":[]}
\ No newline at end of file
index 8a73868c5604f43ace3f0430dd68598d8e0ee6b6..c9efaa9331980fed04d8d604f533a716fa96fd56 100644 (file)
@@ -1,7 +1,7 @@
 import anime from "animejs";
-import { onMounted, onUnmounted, ref, Ref } from "vue";
 import useMitt from "@/modules/mitt";
 import { useIpc } from '@/modules/ipc';
+import { onMounted, onUnmounted, ref, Ref } from "vue";
 import keyboardNameMap from "../keyBoardMaps/keyboardNameMap";
 import { renderMessage, clientMessage } from '@/modules/message';
 
@@ -65,8 +65,15 @@ export default function useAudioInputController (typing: Ref) {
         // Stop recording on space up.
         if (cmd == "SPACE" && recording.value) {
 
-            // Render audio immediately.
-            const message = renderMessage("", "", "", "sf")
+            // Create a message.
+            const message = renderMessage(
+                "", 
+                "", 
+                "", 
+                "sf"
+            )
+
+            // Render it immediately.
             emitter.emit("self-message", message);
 
             // Stop recording and get audio from recorder.
index 18d686a19d11815e45f4d0bfd0a35426d97a6478..7a2e2e81bfcb1a9135757dc248b8650d6850bcd7 100644 (file)
@@ -85,8 +85,14 @@ export default function useTextInputController(elementX: Ref) {
     const sendMessage = () => {
         if (textInput) {
 
-            // Render message
-            const message = renderMessage(textInput.value, false, "", "sf")
+            // Create the message.
+            const message = renderMessage(
+                textInput.value, 
+                false, 
+                "", 
+                "sf"
+            )
+
             emitter.emit("self-message", message);
 
             // Send it to the backend for processing.
index 41e039ee9123a5f2f00bfd7f848f72ac2165db37..e69f29c264b1a1c2f49ccc504b5c25e26fac59ee 100644 (file)
@@ -11,7 +11,7 @@
 
     <!-- Shows when a new session is created with Crimata. -->
     <div 
-      v-if="message.context === 'launch'"
+      v-if="message.context === 'Crimata'"
       class="divider"
     >
       <div>new session</div>
       class="messageBox"
     >
 
-      <!-- Render undo button for messages to friends. -->
-      <button 
-        v-if="undoOption === true"
-        class="undoButton"
-      >
-        undo
-      </button>
-
       <!-- message bubble -->
       <div
         class="bubble"
@@ -72,7 +64,6 @@
       <span 
         v-if="message.isChild === 'last' || message.isChild === 'none'"
         class="context"
-        :class="{ 'context-undo-anim': undoOption }"
       >
 
         <!-- Render Crimata icon or friend's initials. -->
@@ -98,9 +89,7 @@
 
 <script lang='ts'>
 
- import { defineComponent, ref, onMounted, onBeforeUpdate } from 'vue';
- import { clientRequest } from "@/modules/message";
- import { useIpc } from "@/modules/ipc";
+ import { defineComponent, ref, onMounted } from 'vue';
 
  export default defineComponent({
   name: "MessageItem",
 
     let addListener = false;
 
-    const undoOption = ref(false);
-
     const notify = ref(false)
     const isPlaying = ref(false);
 
-    const { post } = useIpc()
-
     if (!props.message.seen) {
       console.log("MSG:Checking...")
 
     }
 
     // Callback for window visibilityState.
-    const onVisibilityChange = (event: any) => {
+    const onVisibilityChange = (_event: any) => {
       if (document.visibilityState === "visible") {
         console.log("MSG:Window visible, notifying.")
 
       }
     }
 
-    const onUndo = () => {
-      post("client-message", clientRequest("launch", {name: false}, "undo"))
-    }
-
-    const onStopPlayback = (e: any) => {
+    const onStopPlayback = (_event: any) => {
       window.ipcRenderer.removeAllListeners("stop-playback-anim");
       isPlaying.value = false
     }
 
-    onBeforeUpdate(() => {
-
-      if (props.message.context.substring(0, 3) === 'To ') {
-        console.log("MSG:Applying undo anim")
-        undoOption.value = true;
-      }
-      
-    })
-
     onMounted(() => {
 
       // Listen for window focus event.
     })
 
     return {
-      onUndo,
       notify,
-      isPlaying,
-      undoOption
+      isPlaying
     }
   }
 
     margin-top: 5px;
   }
 
-  .context-undo-anim {
-    animation-name: context-anim;
-    animation-duration: 3s;
-  }
-
-  @keyframes context-anim {
-    0%, 90% {
-      transform: translateX(-45px);
-    }
-    100% {
-      transform: translateX(0px);
-    }
-  }
-
   .photo {
     display: flex;
     justify-content: center;
     color: #357CA2;
   }
 
-  .undoButton {
-    position: absolute;
-
-    bottom: 0px;
-    right: 0px;
-
-    opacity: 0;
-
-    border: none;
-    outline: none;
-
-    margin: 0px;
-    padding: 0px;
-
-    background-color: Transparent;
-
-    font-family: "SF Compact Display";
-    font-size: 12px;
-    font-weight: bold;
-    color: #9B9B9B;
-
-    animation-name: undo-anim;
-    animation-duration: 3s;
-}
-
-.undoButton:hover {
-  cursor: pointer;
-}
-
-@keyframes undo-anim {
-  0%, 90% {
-    opacity: 1;
-  }
-  100% {
-    opacity: 0;
-  }
-}
-
 </style>
-<!-- 
-      // If this is a message to a friend, we render undo button.
-      if (props.message.context.substring(0, 3) === 'To ') {
-        console.log("MSG:Applying undo anim")
-        undoOption.value = true;
-      } -->
\ No newline at end of file
index 80be1dd17aeed84cfbc7e9568ed1218a014c691f..71beb702cf81ded43eae19bcc72a2e73aa272179 100644 (file)
@@ -1,4 +1,11 @@
-import { RenderMessage, ClientMessage, ClientRequest, AuthRequest, LogoutRequest } from "@/types";
+import { 
+  RenderMessage, 
+  ClientMessage, 
+  ClientRequest, 
+  AuthRequest, 
+  LogoutRequest 
+} from "@/types";
+
 import { v4 as uuidv4 } from 'uuid';
 
 function getTimeStamp(): number {  
index d1826eeae615391c09fa3f41eef1b6da97e6c03c..37b18ac6239fcde0e9f56b0eb08ffc1330b22a70 100644 (file)
@@ -19,10 +19,10 @@ export interface ClientMessage {
 }
 
 export interface ClientRequest {
-    intent: string, 
-    params: object,
-    epic: string | boolean,
-    confidence: number
+    intent: string; 
+    params: object;
+    epic: string | boolean;
+    confidence: number;
 }
 
 export interface SessionState {
index a91e61100d5f1b5dfed018ce1855c4e29faf1cc8..0d13bcfc6190d42c0f23eb4497d0080c6530e66a 100644 (file)
@@ -1 +1 @@
-{"width":609,"height":721,"x":1376,"y":517}
\ No newline at end of file
+{"width":395,"height":676,"x":1595,"y":542}
\ No newline at end of file