Compare commits

..

10 Commits

Author SHA1 Message Date
c1e7cc3513 feat: coordinate message padding and input shape 2025-05-02 17:21:40 +01:00
c2e52ff71e feat: improve french 2025-05-02 17:21:13 +01:00
cdec814b66 fix: remove back button 2025-05-02 17:21:13 +01:00
95773bcd74 feat: style send button 2025-05-02 17:21:13 +01:00
7f6c629ca4 fix: improve french 2025-05-02 17:21:13 +01:00
46ae9f56b7 feat: add input placeholder text 2025-05-02 17:21:13 +01:00
175ed7b725 feat: opening message 2025-05-02 17:21:13 +01:00
55d161cc7d feat: sncf theme 2025-05-02 17:21:12 +01:00
c3351ec7e4 feat: merde alors 2025-05-02 17:18:21 +01:00
a07c269f15 feat: scroll to new message 2025-05-02 17:18:02 +01:00
4 changed files with 14 additions and 11 deletions

View File

@ -12,7 +12,6 @@
<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,11 +23,21 @@ 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");
@ -37,16 +47,11 @@ class Conversation {
this.render(); this.render();
setTimeout(()=> { setTimeout(()=> {
setTimeout(() => { setTimeout(() => {
this.messages.push(new AgentMessage("merde alors")); this.addMessage(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. Veuillez nous envoyer vos questions." } { "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." }
] ]
} }

View File

@ -164,8 +164,7 @@ h1 {
ul { ul {
margin: 0; margin: 0;
padding-top: 1em; padding: 1em 1.5em 0 1.5em;
padding-right: 2em;
height: 100%; height: 100%;
overflow: scroll; overflow: scroll;
list-style: none; list-style: none;
@ -195,7 +194,7 @@ li.message {
z-index: 1; z-index: 1;
border-radius: 100vw; border-radius: 1em;
color: var(--bluewhite); color: var(--bluewhite);
background-color: var(--bluegrey); background-color: var(--bluegrey);