inactive uesrs now collected.
modified: app.py new file: migrations/versions/5d93cdf18549_room_inactive_users_column.py modified: templates/base.html modified: templates/chat.html
This commit is contained in:
parent
96c10fc6d6
commit
b01311a825
4 changed files with 116 additions and 34 deletions
|
|
@ -262,7 +262,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="https://github.com/russellballestrini/flask-socketio-llm-completions#interacting-with-language-models" target="_blank">🚀 docs for interacting with language models & other commands or try /help</a>
|
||||
<a href="https://github.com/russellballestrini/opencompletion#interacting-with-language-models" target="_blank">🚀 docs for language models & other commands, also try /help</a>
|
||||
<!-- Search form -->
|
||||
<div id="search-form" style="width: 90%;">
|
||||
<form action="/search" method="get">
|
||||
|
|
@ -284,7 +284,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Chatroom list -->
|
||||
<!-- Chatroom list -->
|
||||
<div class="main-container">
|
||||
<div id="rooms-list">
|
||||
<ul id="rooms-list-ul">
|
||||
|
|
|
|||
|
|
@ -50,12 +50,21 @@
|
|||
<option value="shimmer">Shimmer</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Active Users</h3>
|
||||
<ul id="active-users">
|
||||
<!-- Active users will be dynamically populated here -->
|
||||
</ul>
|
||||
</div>
|
||||
<div id="user-lists">
|
||||
<div id="active-users-list">
|
||||
<h3>Active Users</h3>
|
||||
<ul id="active-users">
|
||||
<!-- Active users will be dynamically populated here -->
|
||||
</ul>
|
||||
</div>
|
||||
<div id="inactive-users-list">
|
||||
<h3>Inactive Users</h3>
|
||||
<ul id="inactive-users">
|
||||
<!-- Inactive users will be dynamically populated here -->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
|
@ -128,29 +137,34 @@ function updateQueryString() {
|
|||
window.history.replaceState({}, '', newUrl);
|
||||
}
|
||||
|
||||
// Object to keep track of active users
|
||||
let activeUsers = {};
|
||||
// Function to update the active and inactive user lists in the DOM
|
||||
function updateUserLists(activeUsers, inactiveUsers) {
|
||||
const activeUserListElement = document.getElementById("active-users");
|
||||
const inactiveUserListElement = document.getElementById("inactive-users");
|
||||
|
||||
// Function to update the active user list in the DOM
|
||||
function updateActiveUserList(users) {
|
||||
const userListElement = document.getElementById("active-users");
|
||||
userListElement.innerHTML = ''; // Clear the current list
|
||||
activeUserListElement.innerHTML = ''; // Clear the current list
|
||||
inactiveUserListElement.innerHTML = ''; // Clear the current list
|
||||
|
||||
// Populate the list with active users
|
||||
users.forEach(username => {
|
||||
activeUsers.forEach(username => {
|
||||
const userItem = document.createElement("li");
|
||||
userItem.textContent = username;
|
||||
userListElement.appendChild(userItem);
|
||||
activeUserListElement.appendChild(userItem);
|
||||
});
|
||||
|
||||
// Populate the list with inactive users
|
||||
inactiveUsers.forEach(username => {
|
||||
const userItem = document.createElement("li");
|
||||
userItem.textContent = username;
|
||||
inactiveUserListElement.appendChild(userItem);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Update active users list whenever the event is received
|
||||
// Update user lists whenever the event is received
|
||||
socket.on("active_users", (data) => {
|
||||
updateActiveUserList(data.users);
|
||||
updateUserLists(data.active_users, data.inactive_users);
|
||||
});
|
||||
|
||||
|
||||
// Function to handle sending the message
|
||||
function sendMessage() {
|
||||
const message = document.getElementById("message").value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue