more cleanup, add filepicker open dialog, start filepicker logic

This commit is contained in:
Radon 2025-09-03 08:31:17 -05:00
parent c2752f57c7
commit 81b7746238
2 changed files with 15 additions and 4 deletions

View File

@ -386,8 +386,18 @@ class Utils {
}
// ==================== UI MANAGEMENT ====================
class UIManager {
static openFilePicker() {
const fileInput = $('#file-input');
fileInput.click();
fileInput.addEventListener('change', (e) => {
const filesToUpload = e.target.files;
console.log(filesToUpload);
})
}
static updateConnectionStatus(connected) {
const sidebar = document.querySelector('.sidebar');
const sidebar = $('.sidebar');
if (connected) {
sidebar.classList.add('visible');
UIManager.removeReconnectionNotice();
@ -601,7 +611,7 @@ class UIManager {
}
}
static async updateUserMuteButton(userId) {
const muteBtn = document.querySelector(`[data-user-id="${userId}"] .mute-user-btn`);
const muteBtn = $(`[data-user-id="${userId}"] .mute-user-btn`);
if (muteBtn) {
const isMuted = state.mutedUsers.has(userId);
if (isMuted) {
@ -1513,7 +1523,7 @@ class UserManager {
}
}
static updateSpeakingStatus(userId, isSpeaking) {
const userCard = document.querySelector(`[data-user-id="${userId}"]`);
const userCard = $(`[data-user-id="${userId}"]`);
if (userCard) {
if (isSpeaking) {
userCard.classList.add('speaking');
@ -2171,6 +2181,7 @@ window.resetAllVolumes = VoiceControls.resetAllVolumes;
window.sendChatMessage = EventHandlers.sendChatMessage;
window.requestMicrophonePermission = AudioManager.requestMicrophonePermission;
window.toggleEmojiPicker = UIManager.toggleEmojiPicker;
window.openFilePicker = UIManager.openFilePicker;
// Debug functions
window.debugVoiceSetup = DebugUtils.debugVoiceSetup;
window.fixVoice = DebugUtils.fixVoice;

View File

@ -106,7 +106,7 @@
<label for="chat-input"></label>
<div class="chat-input-buttons">
<button id="scroll-btn" onclick="scrollChatToBottom()" disabled></button>
<!-- <input type="file" id="file-input" multiple style="display: none;"/>-->
<input type="file" id="file-input" style="display: none;"/>
<button id="file-btn" onclick='openFilePicker()'>📤</button>
<button id="emoji-btn" onclick="toggleEmojiPicker()">😀</button>
<button id="send-btn" onclick="sendChatMessage()" disabled>Send</button>