diff --git a/website/icons/16.png b/website/icons/16.png index e7552a6..b479c1c 100644 Binary files a/website/icons/16.png and b/website/icons/16.png differ diff --git a/website/icons/180.png b/website/icons/180.png index 8f938d6..23fa3b6 100644 Binary files a/website/icons/180.png and b/website/icons/180.png differ diff --git a/website/icons/32.png b/website/icons/32.png index 79821ea..004cd4c 100644 Binary files a/website/icons/32.png and b/website/icons/32.png differ diff --git a/website/icons/48.png b/website/icons/48.png index 63a27f4..1c8a4fe 100644 Binary files a/website/icons/48.png and b/website/icons/48.png differ diff --git a/website/index.html b/website/index.html index 8ac54a7..8e99635 100644 --- a/website/index.html +++ b/website/index.html @@ -59,8 +59,8 @@ - + diff --git a/website/terminal.js b/website/terminal.js index 6a2ec9c..22508f3 100644 --- a/website/terminal.js +++ b/website/terminal.js @@ -273,6 +273,7 @@ async function enterChatMode() { term.writeln('─'.repeat(term.cols || 60)); term.write('\x1b[1;32m>\x1b[0m '); showInlineInput(); + updateQuickCommands('chat'); } // Exit chat mode @@ -287,8 +288,57 @@ function exitChatMode() { term.writeln(' Exited chat mode.\r\n'); term.write(promptColored); showInlineInput(); + updateQuickCommands('terminal'); } +/** + * Update quick command buttons based on context + * @param {string} mode - 'terminal' or 'chat' + */ +function updateQuickCommands(mode) { + const container = document.querySelector('.quick-commands'); + const statusLeft = document.querySelector('.status-left'); + if (!container) return; + + if (mode === 'chat') { + if (statusLeft) statusLeft.textContent = 'Chat Mode'; + container.innerHTML = ` + + + + `; + } else { + if (statusLeft) statusLeft.textContent = 'Ready'; + container.innerHTML = ` + + + + + `; + } +} + +/** + * Run a chat command from button click + * @param {string} command - The chat command to run + */ +function runChatCommand(command) { + if (!chatMode.active) return; + + if (command === '/nick') { + // For /nick, just fill in the command prefix + inlineInput.value = '/nick '; + inlineInput.focus(); + return; + } + + // Execute the command + inlineInput.value = command; + submitInlineInput(); +} + +window.runChatCommand = runChatCommand; + // Sync messages from Matrix async function syncChatMessages(onlyNew = false) { try { @@ -396,6 +446,9 @@ async function sendChatMessage(message) { chatMode.inputLine = ''; renderChatPrompt(); + // Reposition input after render + setTimeout(() => positionInlineInput(), 10); + // Immediately sync to show our message setTimeout(() => syncChatMessages(true), 500); } catch (error) { @@ -404,6 +457,7 @@ async function sendChatMessage(message) { term.writeln(`\x1b[31mError: ${error.message}\x1b[0m`); term.writeln('─'.repeat(term.cols || 60)); term.write(`\x1b[1;32m>\x1b[0m `); + setTimeout(() => positionInlineInput(), 10); } } @@ -1043,7 +1097,7 @@ async function submitInlineInput() { term.writeln(' /quit - Exit chat mode'); term.writeln('─'.repeat(term.cols || 60)); term.write('\x1b[1;32m>\x1b[0m '); - positionInlineInput(); + setTimeout(() => positionInlineInput(), 10); return; } @@ -1082,21 +1136,21 @@ async function submitInlineInput() { } term.writeln('─'.repeat(term.cols || 60)); term.write('\x1b[1;32m>\x1b[0m '); - positionInlineInput(); + setTimeout(() => positionInlineInput(), 10); return; } if (cmd && !cmd.startsWith('/')) { await sendChatMessage(cmd); - positionInlineInput(); + setTimeout(() => positionInlineInput(), 10); } else if (cmd.startsWith('/')) { term.writeln(`\x1b[31mUnknown command: ${cmd.split(' ')[0]}. Type /help\x1b[0m`); term.writeln('─'.repeat(term.cols || 60)); term.write('\x1b[1;32m>\x1b[0m '); - positionInlineInput(); + setTimeout(() => positionInlineInput(), 10); } else { term.write('\x1b[1;32m>\x1b[0m '); - positionInlineInput(); + setTimeout(() => positionInlineInput(), 10); } return; }