Skip to content

Commit 5140ff1

Browse files
Update index.html
1 parent be6c683 commit 5140ff1

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

templates/index.html

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
width: 100%;
9898
}
9999

100-
#open-door {
100+
#open-door, #open-garage {
101101
font-size: 1.2em;
102102
padding: 12px 24px;
103103
background-color: #fffb00c0;
@@ -106,9 +106,10 @@
106106
border-radius: 4px;
107107
cursor: pointer;
108108
transition: background-color 0.3s ease;
109+
margin-bottom: 10px;
109110
}
110111

111-
#open-door:hover {
112+
#open-door:hover, #open-garage:hover {
112113
background-color: #1669c1;
113114
}
114115

@@ -118,6 +119,25 @@
118119
font-size: 1em;
119120
color: #555;
120121
}
122+
.chat-box {
123+
position: fixed;
124+
bottom: 10px;
125+
right: 10px;
126+
width: 300px;
127+
max-height: 200px;
128+
overflow-y: auto;
129+
background-color: #333;
130+
color: white;
131+
padding: 10px;
132+
border-radius: 8px;
133+
font-size: 14px;
134+
}
135+
136+
.chat-box p {
137+
margin: 0;
138+
padding: 5px 0;
139+
}
140+
121141
</style>
122142
</head>
123143

@@ -133,7 +153,7 @@ <h3>Outside Garage Camera</h3>
133153
</div>
134154
</div>
135155
<div class="logo-container">
136-
<img src="file:///C:/Users/emohi/Desktop/H3RU-Home_Control_System-main/ra.jpg" alt="H3RU Logo">
156+
<img src="{{ url_for('static', path='ra.jpg') }}" alt="H3RU Logo">
137157
<p>To everyone who can't finish what they started<br>- H3RU</p>
138158
</div>
139159
<div class="camera-feed">
@@ -143,8 +163,10 @@ <h3>Inside Garage Camera</h3>
143163
</div>
144164
</div>
145165
</div>
166+
<div id="chat-box" class="chat-box"></div>
146167
<div class="centered-button">
147168
<button id="open-door">Open Door</button>
169+
<button id="open-garage">Open Garage</button>
148170
</div>
149171
<div class="camera-feed">
150172
<h3>Entrance Camera</h3>
@@ -155,19 +177,31 @@ <h3>Entrance Camera</h3>
155177
<div id="result-message"></div>
156178
<script>
157179
const ws = new WebSocket("ws://localhost:8000/ws");
180+
158181
document.getElementById('open-door').addEventListener('click', function () {
159182
fetch('/open_door', { method: 'POST' })
160183
.then(response => response.json())
161184
.then(data => {
162185
document.getElementById('result-message').innerText = data.message;
163186
});
164187
});
188+
189+
document.getElementById('open-garage').addEventListener('click', function () {
190+
fetch('/open_garage', { method: 'POST' })
191+
.then(response => response.json())
192+
.then(data => {
193+
document.getElementById('result-message').innerText = data.message;
194+
});
195+
});
196+
165197
ws.onmessage = function (event) {
166-
document.getElementById('result-message').innerText = event.data;
198+
const chatBox = document.getElementById('chat-box');
199+
chatBox.innerHTML += `<p>${event.data}</p>`;
200+
chatBox.scrollTop = chatBox.scrollHeight; // En yeni mesajın görünebilmesi için
167201
};
202+
168203
setInterval(() => ws.send("result"), 1000);
169204
</script>
170205
</body>
171206

172207
</html>
173-

0 commit comments

Comments
 (0)