feat: sncf theme

This commit is contained in:
Cat Flynn 2025-04-26 21:38:17 +01:00
parent 7765d25835
commit 6589d76d5f
3 changed files with 46 additions and 42 deletions

35
main.js
View File

@ -5,7 +5,7 @@ var conversation = null;
class Conversation { class Conversation {
constructor(name) { constructor(name) {
this.messages = []; this.messages = [];
this.name = romanize(name); this.name = name;
this.score = 1.0; this.score = 1.0;
} }
@ -27,18 +27,24 @@ class Conversation {
sendUserMessage(text) { sendUserMessage(text) {
const message = new UserMessage(text); const message = new UserMessage(text);
message.updateStatus("envoyé"); message.updateStatus("envoy&eacute");
setTimeout(() => { setTimeout(() => {
message.updateStatus("livré"); message.updateStatus("livr&eacute");
this.render(); this.render();
setTimeout(() => { setTimeout(() => {
message.updateStatus("lu"); message.updateStatus("lu");
this.render(); this.render();
}, 5000); setTimeout(()=> {
}, 5000); setTimeout(() => {
this.messages.push(new AgentMessage("merde alors"));
this.render();
}, 2000);
}, 500);
}, 3000);
}, 1000);
//this.messages.push(message);
this.messages.push(message); this.messages.push(message);
this.messages.push(new AgentMessage(messageText));
//this.messages.push(new AgentMessage(messageText)); //this.messages.push(new AgentMessage(messageText));
this.render(); this.render();
} }
@ -83,13 +89,6 @@ function getMessageList() {
return document.getElementById("messages"); return document.getElementById("messages");
} }
function romanize(text) {
text = text.replaceAll('u', 'v');
text = text.replaceAll('U', 'V');
return text;
}
class AgentMessage { class AgentMessage {
constructor(text, senderName) { constructor(text, senderName) {
this.text = text; this.text = text;
@ -110,13 +109,13 @@ class AgentMessage {
if (this.senderName) { if (this.senderName) {
const nameElem = document.createElement("h3"); const nameElem = document.createElement("h3");
nameElem.innerHTML = romanize(this.senderName); nameElem.innerHTML = this.senderName;
contentElem.appendChild(nameElem); contentElem.appendChild(nameElem);
} }
const textElem = document.createElement("span"); const textElem = document.createElement("span");
textElem.className = "message-text"; textElem.className = "message-text";
textElem.innerHTML = romanize(this.text); textElem.innerHTML = this.text;
contentElem.appendChild(textElem); contentElem.appendChild(textElem);
return liElem; return liElem;
@ -126,7 +125,7 @@ class AgentMessage {
class UserMessage { class UserMessage {
constructor(text) { constructor(text) {
this.createdTime = Date.now(); this.createdTime = Date.now();
this.text = romanize(text); this.text = text;
this.status = ""; this.status = "";
} }
@ -162,7 +161,7 @@ class UserMessage {
class SystemMessage { class SystemMessage {
constructor(text) { constructor(text) {
this.text = romanize(text); this.text = text;
} }
getIsOurs() { getIsOurs() {
@ -229,7 +228,7 @@ function pressSendButton() {
if (event.type == "keydown" && event.key != "Enter") if (event.type == "keydown" && event.key != "Enter")
{ {
textBox.value = romanize(text); textBox.value = text;
return; return;
} }

View File

@ -1,10 +1,10 @@
{ {
"title": "SNCF billetier", "title": "SNCF Conrad",
"interactive": true, "interactive": true,
"characters": [ "characters": [
"you", "you",
"SNCF billetier" "SNCF Conrad"
], ],
"messages": "messages":
[ [

View File

@ -6,7 +6,12 @@
--bleu: #0055a4; --bleu: #0055a4;
--rouge: #e1000f; --rouge: #e1000f;
--rose-de-l-erreur: #f0f --rose-de-l-erreur: #f0f;
--navy: #0b131f;
--bluegrey: #232b35;
--sky: #7bbffd;
--bluewhite: #ebebec;
} }
html { html {
@ -18,7 +23,7 @@ body {
margin: 0; margin: 0;
height: 100%; height: 100%;
display: flex; display: flex;
background-color: var(--blanc); background-color: var(--navy);
} }
#side-panel { #side-panel {
@ -82,7 +87,7 @@ body {
#header { #header {
position: sticky; position: sticky;
top: 0; top: 0;
border-bottom: solid var(--blanc) 3px; border-bottom: none var(--navy) 3px;
} }
#main-panel { #main-panel {
@ -98,7 +103,7 @@ body {
h1 { h1 {
display: inline-block; display: inline-block;
color: var(--noir); color: var(--bluewhite);
margin-left: 1em; margin-left: 1em;
} }
@ -106,9 +111,9 @@ h1 {
border-width: 2px; border-width: 2px;
border: black; border: black;
border-style: none; border-style: none;
border-radius: 1em; border-radius: 1.5em;
padding: .6em .8em; padding: 1em 1.5em;
} }
.message-content { .message-content {
@ -117,8 +122,8 @@ h1 {
} }
.message-content.theirs { .message-content.theirs {
background-color: var(--bleu); background-color: var(--bluegrey);
color: var(--blanc); color: var(--bluewhite);
float: left; float: left;
@ -138,7 +143,7 @@ h1 {
} }
.message-content.ours { .message-content.ours {
background-color: var(--rouge); background-color: var(--sky);
right: 0; right: 0;
margin-bottom: 0.5em; margin-bottom: 0.5em;
@ -147,7 +152,7 @@ h1 {
} }
.ours .message-text { .ours .message-text {
color: var(--blanc); color: var(--bluegrey);
} }
.system-message { .system-message {
@ -189,7 +194,7 @@ li.message {
} }
#typing-indicator { #typing-indicator {
color: var(--gris); color: var(--bluewhite);
margin: 0; margin: 0;
margin-left: 1em; margin-left: 1em;
@ -202,9 +207,9 @@ li.message {
#textbox input { #textbox input {
flex-grow: 4; flex-grow: 4;
color: var(--noir); color: var(--bluewhite);
background-color: var(--blanc); background-color: var(--bluegrey);
border-color: var(--gris); border-color: var(--bluegrey);
border-width: 3px; border-width: 3px;
border-style: solid; border-style: solid;
@ -217,8 +222,8 @@ li.message {
} }
button { button {
background-color: var(--rouge); background-color: var(--sky);
color: var(--blanc); color: var(--bluegrey);
margin: 0.5em; margin: 0.5em;
padding: 0; padding: 0;
@ -230,16 +235,16 @@ button {
} }
button:hover { button:hover {
color: var(--rouge); color: var(--bluewhite);
background-color: var(--blanc); background-color: var(--bluegrey);
border-color: var(--rouge); border-color: var(--bluegrey);
border-width: 3px; border-width: 3px;
padding: 0; padding: 0;
border-style: solid; border-style: solid;
} }
.message-status { .message-status {
color: var(--gris); color: var(--bluewhite);
position: absolute; position: absolute;
bottom: -1.75em; bottom: -1.75em;