diff --git a/neo_dolfin/static/css/chatbot.css b/neo_dolfin/static/css/chatbot.css index 1a1f18a9..ddc95fe3 100644 --- a/neo_dolfin/static/css/chatbot.css +++ b/neo_dolfin/static/css/chatbot.css @@ -151,6 +151,7 @@ body { border-radius: 20px; flex-grow: 1; margin: 0px; + order: 1; } .chatbox__button img { @@ -158,9 +159,9 @@ body { width: 50px; } -.chatbox__button button:hover { +/* .chatbox__button button:hover { background: rgb(59, 117, 203, 0.6); -} +} */ .chatbox__button button { padding: 15px; @@ -170,7 +171,13 @@ body { outline: none; box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.2); cursor: pointer; - transition: background-color 0.3s ease; + /* transition: background-color 0.3s ease; */ + + transition-property: transform; + transition-duration: 0.3s; + transition-timing-function: ease; + transition-delay: 0s; + } .text-cloud { @@ -187,6 +194,12 @@ body { margin: 0px 0px; /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); */ cursor: pointer; + + opacity: 0; + transform: translateY(100%); + transition: transform 0.5s, opacity 0.5s; + order: 1; + } .text-cloud p { @@ -205,6 +218,39 @@ body { #chatCloudID { display: flex; gap:1em; + flex-direction:row-reverse; + } +/* Animation and Transition */ + +#hover-button:hover { + transform: translateY(-13px); + +} + +/* .text-cloud:hover { + opacity: 1; +} */ + +.chatbox__button:hover ~ .text-cloud { + transform: translateY(-13px); + opacity: 1; +} + + +/* loading page animation */ +.loading { + font-weight: bold; + display: inline-block; + font-family: monospace; + font-size: 30px; + clip-path: inset(0 3ch 0 0); + animation: loading 1s steps(4) infinite; +} +@keyframes loading { + to { + clip-path: inset(0 -1ch 0 0) + } +} \ No newline at end of file diff --git a/neo_dolfin/static/js/chatbot_app.js b/neo_dolfin/static/js/chatbot_app.js index 9ed7b950..15634109 100644 --- a/neo_dolfin/static/js/chatbot_app.js +++ b/neo_dolfin/static/js/chatbot_app.js @@ -143,23 +143,36 @@ class Chatbox { }); }; } - + + updateChatText(chatbox) { var html = ''; + const l = '
...
' + const chatmessage = chatbox.querySelector('.chatbox__messages'); + this.messages.slice().reverse().forEach(function(item, index) { if (item.name === "DolFine") { html += '
' + item.message + '
' + + setTimeout(() => { + // chatmessage.; + chatmessage.innerHTML = html; + + }, 1300); + chatmessage.innerHTML = l; + } else { html += '
' + item.message + '
' + chatmessage.innerHTML = html; } }); - const chatmessage = chatbox.querySelector('.chatbox__messages'); - chatmessage.innerHTML = html; + + } } @@ -170,42 +183,42 @@ chatbox.display(); // chatbot cloud -class chatbotCloudClass { - constructor() { - this.args = - { - chatbotCloud : document.getElementById("chatbot-cloud"), - chatbotButton : document.getElementsByClassName("chatbox__button")[0] - } - } - - removeOnClick() { - const {chatbotCloud, chatbotButton} = this.args; - document.addEventListener("DOMContentLoaded", function () { - chatbotButton.addEventListener("click", function () { - chatbotCloud.style.display = "none"; - }); - }) - } - - appearChatCloud() { - // const {chatbotCloud, chatbotButton} = this.args; - // chatbotCloud.style.visibility = "visible"; - - document.getElementById("chatbot-cloud").style.visibility = "visible"; - } - - diasppearChatCloud() { - // const {chatbotCloud, chatbotButton} = this.args; - // chatbotCloud.style.visibility = "hidden"; - - // above line throughs an error. - document.getElementById("chatbot-cloud").style.visibility = "hidden"; - } -} -const chatbotcloud = new chatbotCloudClass(); - -chatbotcloud.removeOnClick(); - -setInterval(chatbotcloud.appearChatCloud, 10000) // appear after 10 seconds -setInterval(chatbotcloud.diasppearChatCloud, 20000) //diasppear after another 10 seconds \ No newline at end of file +// class chatbotCloudClass { +// constructor() { +// this.args = +// { +// chatbotCloud : document.getElementById("chatbot-cloud"), +// chatbotButton : document.getElementsByClassName("chatbox__button")[0] +// } +// } + +// removeOnClick() { +// const {chatbotCloud, chatbotButton} = this.args; +// document.addEventListener("DOMContentLoaded", function () { +// chatbotButton.addEventListener("click", function () { +// chatbotCloud.style.display = "none"; +// }); +// }) +// } + +// appearChatCloud() { +// // const {chatbotCloud, chatbotButton} = this.args; +// // chatbotCloud.style.visibility = "visible"; + +// document.getElementById("chatbot-cloud").style.visibility = "visible"; +// } + +// diasppearChatCloud() { +// // const {chatbotCloud, chatbotButton} = this.args; +// // chatbotCloud.style.visibility = "hidden"; + +// // above line throughs an error. +// document.getElementById("chatbot-cloud").style.visibility = "hidden"; +// } +// } +// const chatbotcloud = new chatbotCloudClass(); + +// chatbotcloud.removeOnClick(); + +// setInterval(chatbotcloud.appearChatCloud, 10000) // appear after 10 seconds +// setInterval(chatbotcloud.diasppearChatCloud, 20000) //diasppear after another 10 seconds \ No newline at end of file diff --git a/neo_dolfin/templates/components/chatbotWidget.html b/neo_dolfin/templates/components/chatbotWidget.html index 281f683f..0e3e899f 100644 --- a/neo_dolfin/templates/components/chatbotWidget.html +++ b/neo_dolfin/templates/components/chatbotWidget.html @@ -12,10 +12,12 @@

Chatbot

-
+
+
+ +
+ +
+

Hello, I'm the chatbot.
How can I help you today?

-
- -