Complete 4.3.2: Loading States - comprehensive loading system implementation with indicators, progress bars, and loading hierarchies

This commit is contained in:
VinnyNC 2025-09-29 23:30:14 -04:00
parent 60a5cbb576
commit b67f14bb9b
4 changed files with 791 additions and 7 deletions

View file

@ -152,6 +152,7 @@
function sendMessage() {
const messageInput = document.getElementById('messageInput');
const nicknameInput = document.getElementById('nickname');
const sendButton = document.querySelector('.chat-input button') || document.querySelector('#messageInput').nextElementSibling;
const nicknameErrorElement = document.getElementById('nicknameError');
const messageErrorElement = document.getElementById('messageError');
@ -177,6 +178,9 @@
return;
}
// Show loading state on send button
const loadingContext = window.LoadingStates?.showButtonLoading(sendButton, 'Sending...');
// All validation passed - send message via API
API.sendMessage(nickname, message)
.then(data => {
@ -208,6 +212,12 @@
AppLogger.error('Error sending message:', error);
updateValidationUI('messageInput', messageErrorElement, false, 'Failed to send message. Please try again.');
UIControls.updateConnectionStatus(false);
})
.finally(() => {
// End loading state
if (loadingContext) {
loadingContext.end(true);
}
});
}