Skip to content

Commit

Permalink
Final project version: Implementation of chatbot functionality and bu…
Browse files Browse the repository at this point in the history
…g fixes
  • Loading branch information
MariferVL committed Sep 20, 2023
1 parent 4126c8c commit d7f5fc3
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions public/js/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* Verdia Messages Flow */

const chatMessages = document.getElementById('chat-messages');
const userInput = document.getElementById('user-input');
Expand All @@ -21,29 +22,6 @@ function scrollToBottom() {
chatMessages.scrollTop = chatMessages.scrollHeight;
}


/* Messages Flow */

const chatContainer = document.getElementById('chat-container');
const chatButton = document.getElementById('chat-button');
const webContainer = document.getElementById('web-container');

chatButton.addEventListener('click', () => {
if (chatContainer.style.display === 'none') {
chatContainer.style.display = 'block';
chatButton.innerHTML = '<i class="fas fa-times"></i>';
webContainer.classList.add('blur');
addBotMessage("Hola, buen día🌻Soy Verdia. ¿En qué te puedo ayudar?");

} else {
chatContainer.style.display = 'none';
chatButton.innerHTML = '<i class="fas fa-comment"></i>';
webContainer.classList.remove('blur');

}
});


sendButton.addEventListener("click", async (e) => {
e.preventDefault();

Expand Down Expand Up @@ -83,3 +61,24 @@ sendButton.addEventListener("click", async (e) => {
});


/* Open/Close Verdia */

const chatContainer = document.getElementById('chat-container');
const chatButton = document.getElementById('chat-button');
const webContainer = document.getElementById('web-container');

chatButton.addEventListener('click', () => {
if (chatContainer.style.display === 'none') {
chatContainer.style.display = 'block';
chatButton.innerHTML = '<i class="fas fa-times"></i>';
webContainer.classList.add('blur');
addBotMessage("Hola, buen día🌻Soy Verdia. ¿En qué te puedo ayudar?");

} else {
chatContainer.style.display = 'none';
chatButton.innerHTML = '<i class="fas fa-comment"></i>';
webContainer.classList.remove('blur');

}
});

0 comments on commit d7f5fc3

Please sign in to comment.