add mock message test

This commit is contained in:
riqo 2021-02-15 09:26:36 -06:00
commit aa53013cc4
5 changed files with 181 additions and 10 deletions

View file

@ -51,8 +51,9 @@ export default defineComponent({
emitter.on("animateSend", async (message) => {
try {
await invoke(message);
renderArr.push(data.value);
renderArr.push(message)
// await invoke(message);
//renderArr.push(data.value);
} catch (e) {
console.log("No response. Do not render.");
}

View file

@ -55,12 +55,7 @@ export default function useMessageView(): {
if (el) {
if (shift) {
console.log(messageOffset.y)
if (messageOffset.y < 445 && messageOffset.y < 500) {
shiftOffset -= 15;
} else {
shiftOffset -= el.getBBox().height + messagePadding;
}
shiftOffset -= el.getBBox().height + messagePadding;
}
animateMessage(el);
}

View file

@ -1,7 +1,7 @@
import { ref, computed, onMounted, onUnmounted } from "vue";
/**
* handles visualization of view messages through
* handles visualization of view messages through
* vue transition callbacks and anime-js animations
*/
export default function useScrollView({ targetId }: { targetId: string }) {

View file

@ -14,11 +14,26 @@
<script lang="ts">
import MessageView from "@/components/messageView/index.vue";
import TextAudioInput from "@/components/taInput/index.vue";
import { defineComponent } from "vue";
import { defineComponent, ref } from "vue";
import {Messages} from './mockMessages';
import useMitt from "@/modules/mitt";
export default defineComponent({
name: "Messenger",
components: { MessageView, TextAudioInput },
setup() {
const { emitter } = useMitt();
const counter = ref(0);
const emittMessage = () => {
console.log('testing')
counter.value++;
emitter.emit('animateSend', Messages[counter.value])
}
return {
emittMessage
}
}
});
</script>

160
src/views/mockMessages.ts Normal file
View file

@ -0,0 +1,160 @@
import { Message } from "@/types/message/index";
export const Messages: Message[] = [
{
content: "Welcome",
context: "ai",
subContext: "",
modifier: "ai",
id: "2",
time: ""
},
{
content:
"add friend",
context: "launch",
subContext: "",
modifier: "sf",
id: "1",
time: ""
},
{
content: "Did you mean to addcontact?",
context: "addcontact",
subContext: "",
modifier: "ai",
id: "5",
time: ""
},
{
content: "yes",
context: "fulfill",
subContext: "",
modifier: "sf",
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",
subContext: "",
modifier: "ai",
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",
subContext: "",
modifier: "ai",
id: "8",
time: ""
},
{
content: "Hey Anna, did you get the paper done?",
context: "Message from Tommy McConville",
subContext: "",
modifier: "ai",
id: "9",
time: ""
},
{
content: "Hey Anna, did you get the paper done?",
context: "Message from Tommy McConville",
subContext: "",
modifier: "ai",
id: "10",
time: ""
},
{
content: "Yes posting it online soon.",
context: "Message from Tommy McConville",
subContext: "",
modifier: "sf",
id: "11",
time: ""
},
{
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 Tommy McConville",
subContext: "",
modifier: "sf",
id: "12",
time: ""
},
{
content: "Hey Anna, did you get the paper done?",
context: "Message from Tommy McConville",
subContext: "",
modifier: "ai",
id: "13",
time: ""
},
{
content: "Hey Anna, did you get the paper done?",
context: "Message from Tommy McConville",
subContext: "",
modifier: "ai",
id: "14",
time: ""
},
{
content: "Yes posting it online soon.",
context: "You to Tommy McConville",
subContext: "",
modifier: "sf",
id: "15",
time: ""
},
{
content: "Sweet, thanks!",
context: "Message from Tommy McConville",
subContext: "",
modifier: "ai",
id: "16",
time: ""
},
{
content: "Hey do you know Enrique Hernandez?",
context: "Message from Crimata AI",
subContext: "",
modifier: "ai",
id: "17",
time: ""
},
{
content: "Yes posting it online soon.",
context: "You to Tommy McConville",
subContext: "",
modifier: "sf",
id: "18",
time: ""
},
{
content: "Sweet, thanks!",
context: "Message from Tommy McConville",
subContext: "",
modifier: "ai",
id: "19",
time: ""
},
];