Skip to content
This repository was archived by the owner on Aug 27, 2024. It is now read-only.

Commit fde8b5d

Browse files
Nick Vidalrvolosatovs
authored andcommitted
feat: expand web ui
Signed-off-by: Nick Vidal <[email protected]>
1 parent c2d3c04 commit fde8b5d

File tree

5 files changed

+8
-63
lines changed

5 files changed

+8
-63
lines changed
File renamed without changes.
File renamed without changes.

demos/chat-client/chat-web-ui/index.html renamed to demos/chat-client/web-ui/index.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111

1212
<body>
1313

14-
<section>
15-
<h1>Enarx Chat</h1>
16-
<p>Click on the chat button to start</p>
17-
</section>
18-
1914
<div id="chat-container">
20-
<button class='chat-btn'><i class="material-icons">chat</i></button>
2115
<div class='chat-popup'>
2216

2317
<div class='chat-header'>
Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,14 @@
11
function init() {
2-
3-
//--------------------------- Important Variables----------------------------
4-
var inactiveMessage = "Server is down, Please contact the developer to activate it"
2+
var inactiveMessage = "Server is down"
53
chatPopup = document.querySelector(".chat-popup")
6-
chatBtn = document.querySelector(".chat-btn")
74
chatSubmit = document.querySelector(".chat-submit")
85
chatHeader = document.querySelector(".chat-header")
96
chatArea = document.querySelector(".chat-area")
107
chatInput = document.querySelector(".chat-input")
11-
expandWindow = document.querySelector(".expand-chat-window")
128
root = document.documentElement;
13-
chatPopup.style.display = "none"
9+
chatPopup.style.display = "flex"
1410
var host = "http://localhost:8080"
1511

16-
17-
//------------------------ ChatBot Toggler -------------------------
18-
19-
chatBtn.addEventListener("click", () => {
20-
21-
mobileDevice = !detectMob()
22-
if (chatPopup.style.display == "none" && mobileDevice) {
23-
chatPopup.style.display = "flex"
24-
chatInput.focus();
25-
chatBtn.innerHTML = `<i class='material-icons'>close</i>`
26-
} else if (mobileDevice) {
27-
chatPopup.style.display = "none"
28-
chatBtn.innerHTML = `<i class='material-icons'>chat</i>`
29-
} else {
30-
mobileView()
31-
}
32-
})
33-
3412
chatSubmit.addEventListener("click", () => {
3513
let userResponse = chatInput.value.trim();
3614
if (userResponse !== "") {
@@ -40,8 +18,6 @@ function init() {
4018
})
4119
}
4220

43-
// end of init function
44-
4521
function userResponseBtn(e) {
4622
send(e.value);
4723
}
@@ -70,16 +46,10 @@ function setUserResponse() {
7046
scrollToBottomOfResults();
7147
}
7248

73-
74-
7549
function scrollToBottomOfResults() {
7650
chatArea.scrollTop = chatArea.scrollHeight;
7751
}
7852

79-
/***************************************************************
80-
Frontend Part Completed
81-
****************************************************************/
82-
8353
function send(message) {
8454
chatInput.type = "text"
8555
passwordInput = false;
@@ -95,33 +65,15 @@ function send(message) {
9565
chatInput.focus();
9666
}
9767

98-
function mobileView() {
99-
$('.chat-popup').width($(window).width());
100-
101-
if (chatPopup.style.display == "none") {
102-
chatPopup.style.display = "flex"
103-
// chatInput.focus();
104-
chatBtn.style.display = "none"
105-
chatPopup.style.bottom = "0"
106-
chatPopup.style.right = "0"
107-
// chatPopup.style.transition = "none"
108-
expandWindow.innerHTML = `<i class='material-icons'>close</i>`
109-
}
110-
}
111-
112-
function detectMob() {
113-
return ((window.innerHeight <= 800) && (window.innerWidth <= 600));
114-
}
115-
116-
function createChatBot() {
68+
function createChat() {
11769

11870
host = "http://localhost:8080";
11971
init()
12072
const msg = document.querySelector(".msg");
121-
msg.innerText = "Welcome to Enarx Chat!";
73+
msg.innerText = "Welcome to Enarx Chat! Send a message to an Enarx Keep below:";
12274

12375
const botTitle = document.querySelector(".bot-title");
12476
botTitle.innerText = "Enarx Chat";
12577
}
12678

127-
createChatBot();
79+
createChat();

demos/chat-client/chat-web-ui/style.css renamed to demos/chat-client/web-ui/style.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
}
77

88
:root {
9-
--chat-window-total-width: 380px;
10-
--chat-window-height: 500px;
9+
--chat-window-total-width: 85%;
10+
--chat-window-height: 80%;
1111
--chat-window-color-theme: #1e90ff;
1212
--chat-window-bg-color: #fff;
1313
--chat-send-button: #1e90ff;
@@ -211,9 +211,8 @@ p {
211211

212212
@media (max-width:500px) {
213213
.chat-popup {
214-
bottom: 120px;
215214
right: 10%;
216215
width: 80vw;
217-
height: 100%;
216+
height: 80%;
218217
}
219218
}

0 commit comments

Comments
 (0)