Compare commits
6 Commits
c1e7cc3513
...
860d520748
Author | SHA1 | Date | |
---|---|---|---|
860d520748 | |||
0e82af6b6f | |||
1bc67c2fa9 | |||
de69867942 | |||
ff7b933cfc | |||
a79838f37a |
@ -12,6 +12,7 @@
|
|||||||
<div id="main-panel">
|
<div id="main-panel">
|
||||||
|
|
||||||
<div id="header">
|
<div id="header">
|
||||||
|
<button id="conversation-list-button" class="rounded-rectangle" onclick="showSidePanel()"><- back</button>
|
||||||
<h1 id="header-title">NAME</h1>
|
<h1 id="header-title">NAME</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
17
main.js
17
main.js
@ -23,21 +23,11 @@ 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) {
|
||||||
|
|
||||||
const message = new UserMessage(text);
|
const message = new UserMessage(text);
|
||||||
message.updateStatus("envoyé");
|
message.updateStatus("envoyé");
|
||||||
this.addMessage(message);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
message.updateStatus("livré");
|
message.updateStatus("livré");
|
||||||
@ -47,11 +37,16 @@ class Conversation {
|
|||||||
this.render();
|
this.render();
|
||||||
setTimeout(()=> {
|
setTimeout(()=> {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.addMessage(new AgentMessage("merde alors"));
|
this.messages.push(new AgentMessage("merde alors"));
|
||||||
|
this.render();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}, 500);
|
}, 500);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
//this.messages.push(message);
|
||||||
|
this.messages.push(message);
|
||||||
|
//this.messages.push(new AgentMessage(messageText));
|
||||||
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the current HTML based on messages
|
// update the current HTML based on messages
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
],
|
],
|
||||||
"messages":
|
"messages":
|
||||||
[
|
[
|
||||||
{ "character": 1, "text": "Bonjour, moi je m'appelle SNCF Conrad et je vais vous aider aujourd'hui. N'hésiter pas à me poser des questions." }
|
{ "character": 1, "text": "Bonjour, moi je m'appelle SNCF Conrad et je vais vous aider aujourd'hui. Veuillez nous envoyer vos questions." }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,8 @@ h1 {
|
|||||||
|
|
||||||
ul {
|
ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 1em 1.5em 0 1.5em;
|
padding-top: 1em;
|
||||||
|
padding-right: 2em;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
@ -194,7 +195,7 @@ li.message {
|
|||||||
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
border-radius: 1em;
|
border-radius: 100vw;
|
||||||
|
|
||||||
color: var(--bluewhite);
|
color: var(--bluewhite);
|
||||||
background-color: var(--bluegrey);
|
background-color: var(--bluegrey);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user