add mock message test
This commit is contained in:
parent
a15a8650de
commit
aa53013cc4
5 changed files with 181 additions and 10 deletions
|
|
@ -51,8 +51,9 @@ export default defineComponent({
|
||||||
|
|
||||||
emitter.on("animateSend", async (message) => {
|
emitter.on("animateSend", async (message) => {
|
||||||
try {
|
try {
|
||||||
await invoke(message);
|
renderArr.push(message)
|
||||||
renderArr.push(data.value);
|
// await invoke(message);
|
||||||
|
//renderArr.push(data.value);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("No response. Do not render.");
|
console.log("No response. Do not render.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,7 @@ export default function useMessageView(): {
|
||||||
if (el) {
|
if (el) {
|
||||||
if (shift) {
|
if (shift) {
|
||||||
|
|
||||||
console.log(messageOffset.y)
|
shiftOffset -= el.getBBox().height + messagePadding;
|
||||||
if (messageOffset.y < 445 && messageOffset.y < 500) {
|
|
||||||
shiftOffset -= 15;
|
|
||||||
} else {
|
|
||||||
shiftOffset -= el.getBBox().height + messagePadding;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
animateMessage(el);
|
animateMessage(el);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { ref, computed, onMounted, onUnmounted } from "vue";
|
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
|
* vue transition callbacks and anime-js animations
|
||||||
*/
|
*/
|
||||||
export default function useScrollView({ targetId }: { targetId: string }) {
|
export default function useScrollView({ targetId }: { targetId: string }) {
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,26 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import MessageView from "@/components/messageView/index.vue";
|
import MessageView from "@/components/messageView/index.vue";
|
||||||
import TextAudioInput from "@/components/taInput/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({
|
export default defineComponent({
|
||||||
name: "Messenger",
|
name: "Messenger",
|
||||||
components: { MessageView, TextAudioInput },
|
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>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
160
src/views/mockMessages.ts
Normal file
160
src/views/mockMessages.ts
Normal 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: ""
|
||||||
|
},
|
||||||
|
];
|
||||||
Loading…
Reference in a new issue