Compare commits
9 Commits
bf7a989b75
...
18490df072
Author | SHA1 | Date | |
---|---|---|---|
18490df072 | |||
a3f445216d | |||
aea2b4d12e | |||
e27d4ff587 | |||
edcc60b517 | |||
4831e5096c | |||
dcac2b6ba2 | |||
34c5b35194 | |||
a07c269f15 |
18
main.js
18
main.js
@ -24,6 +24,15 @@ class Conversation {
|
|||||||
this.messages = initialMessages;
|
this.messages = initialMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addMessage(message) {
|
||||||
|
this.messages.push(message);
|
||||||
|
this.render();
|
||||||
|
|
||||||
|
var elements = document.getElementById("messages").children;
|
||||||
|
var lastElement = elements[elements.length - 1];
|
||||||
|
lastElement.scrollIntoView();
|
||||||
|
}
|
||||||
|
|
||||||
// for the user to send their own messages
|
// for the user to send their own messages
|
||||||
sendUserMessage(text) {
|
sendUserMessage(text) {
|
||||||
|
|
||||||
@ -76,7 +85,7 @@ class Conversation {
|
|||||||
messageText = json.message;
|
messageText = json.message;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
this.messages.push(new AgentMessage(messageText));
|
this.addMessage(new AgentMessage(messageText));
|
||||||
this.render();
|
this.render();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (score == 1) {
|
if (score == 1) {
|
||||||
@ -95,12 +104,7 @@ class Conversation {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
message.updateStatus("delivered");
|
this.addMessage(message);
|
||||||
this.render();
|
|
||||||
//setTimeout(() => {
|
|
||||||
// message.updateStatus("read");
|
|
||||||
// this.render();
|
|
||||||
//}, 5000);
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,9 @@ body {
|
|||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#main-panel {
|
||||||
|
width: calc(100% - 300px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#side-panel .conversation {
|
#side-panel .conversation {
|
||||||
@ -105,7 +108,7 @@ body {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
width: calc(100% - 300px);
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#page {
|
#page {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user