-{"key":"854fb3e1-9207-473d-82b8-b6385f47e895","newMessages":[]}
\ No newline at end of file
+{"key":"6cde67f6-6188-452d-a54e-9d38cabf2d63","newMessages":[]}
\ No newline at end of file
import fs from 'fs';
import { backgroundMitt } from "@/modules/emitter";
-import { SessionState, WindowState } from "@/types/message";
+import { SessionState, WindowState } from "@/types";
export const ipcEmit = (channel: string, payload: any) => {
main()
});
+ // Must keep to ensure app doesn't quit on close.
app.on("before-quit", () => {
});
+ // Must keep to ensure app doesn't quit on close.
app.on("window-all-closed", () => {
});
import { play } from "./audio";
import { renderMessage } from "@/modules/message";
-import { AuthProtocol, SessionState, Profile } from "@/types/message";
+import { AuthProtocol, SessionState, Profile } from "@/types";
let win = true;
import { BrowserWindow, ipcMain } from "electron";
import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
import { backgroundMitt } from '@/modules/emitter';
-import { RenderMessage, WindowState } from "@/types/message/index";
+import { RenderMessage, WindowState } from "@/types";
import { loadWinState, saveToJson } from "./helpers";
import * as path from "path";
-import fs from 'fs';
interface IpcRendererPayload {
endpoint: string;
class="messageBox"
>
+ <!-- Render undo button for messages to friends. -->
+ <button
+ v-if="undoOption === true"
+ class="undoButton"
+ >
+ undo
+ </button>
+
<!-- message bubble -->
<div
class="bubble"
</div>
<!-- message context -->
- <span v-if="message.isChild === 'last' || message.isChild === 'none'" class="context">
+ <span
+ v-if="message.isChild === 'last' || message.isChild === 'none'"
+ class="context"
+ :class="{ 'context-undo-anim': undoOption }"
+ >
<!-- Render Crimata icon or friend's initials. -->
<div v-if="message.modifier == 'ai'" class="photo">
<script lang='ts'>
- import {defineComponent, ref, onMounted} from 'vue';
- import { RenderMessage } from "@/types/message/index";
-
+ import { defineComponent, ref, onMounted, onBeforeUpdate } from 'vue';
+ import { clientRequest } from "@/modules/message";
+ import { useIpc } from "@/modules/ipc";
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...")
// newMessages always render with blue dot.
if (props.message.newMessage) {
}
}
+ const onUndo = () => {
+ post("client-message", clientRequest("launch", {name: false}, "undo"))
+ }
+
const onStopPlayback = (e: 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
+ isPlaying,
+ undoOption
}
}
}
.messageBox {
+ position: relative;
+
display: flex;
flex-direction: column;
}
.context {
+ position: relative;
+
display: flex;
align-items: center;
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;
}
-</style>
\ No newline at end of file
+ .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
/* eslint-disable */
+
+import { Emitter } from "mitt";
+
+// Backend emitter
+
+type Mitt = Emitter;
+
const EventEmitter = require('events');
class BackgroundMitt extends EventEmitter { }
-import { RenderMessage, ClientMessage, AuthRequest, LogoutRequest } from "@/types/message/index";
+import { RenderMessage, ClientMessage, ClientRequest, AuthRequest, LogoutRequest } from "@/types";
import { v4 as uuidv4 } from 'uuid';
function getTimeStamp(): number {
}
)
+export const clientRequest = (intent: string, params: object, epic: string | boolean): ClientRequest => (
+ {
+ intent: intent,
+ params: params,
+ epic: epic,
+ confidence: 1.0
+ }
+)
+
export const authRequest = (key: boolean | string, usr: boolean | string, pwd: boolean | string): AuthRequest => (
{
key,
import { ref } from 'vue';
import useScroll from "@/modules/scroll";
-import { RenderMessage, Annotation } from "@/types/message/index";
+import { RenderMessage, Annotation } from "@/types";
const messages = ref(new Map());
import { inject } from "vue";
-import { Mitt } from "@/types/mitt/index";
+import { Emitter } from "mitt";
+
+// Frontend emitter
+
+type Mitt = Emitter;
let emitter: Mitt;
uid: string;
}
+export interface ClientRequest {
+ intent: string,
+ params: object,
+ epic: string | boolean,
+ confidence: number
+}
+
export interface SessionState {
key: string | boolean;
newMessages: RenderMessage[];
+++ /dev/null
-import { Emitter } from "mitt";
-
-export type Mitt = Emitter;
-{"width":386,"height":815,"x":1720,"y":495}
\ No newline at end of file
+{"width":609,"height":721,"x":1376,"y":517}
\ No newline at end of file