Compare commits

..

6 Commits

Author SHA1 Message Date
860d520748 feat: style send button 2025-05-01 01:27:48 +01:00
0e82af6b6f fix: improve french 2025-05-01 01:27:45 +01:00
1bc67c2fa9 feat: add input placeholder text 2025-05-01 01:00:40 +01:00
de69867942 feat: opening message 2025-05-01 00:56:11 +01:00
ff7b933cfc feat: sncf theme 2025-05-01 00:56:10 +01:00
a79838f37a feat: merde alors 2025-05-01 00:51:08 +01:00
4 changed files with 11 additions and 14 deletions

View File

@ -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
View File

@ -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&eacute"); message.updateStatus("envoy&eacute");
this.addMessage(message);
setTimeout(() => { setTimeout(() => {
message.updateStatus("livr&eacute"); message.updateStatus("livr&eacute");
@ -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

View File

@ -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." }
] ]
} }

View File

@ -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);