fix(ui): otimizar layout e usabilidade do cabecalho do chat mobile

This commit is contained in:
Winícius 2026-11-21 17:57:41 -03:00
parent 7155526d70
commit d4f9b6e12b
7 changed files with 187 additions and 68 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +1,9 @@
{
"version": "1.0.28",
"buildId": "23b496aa",
"releasedAt": "2026-11-21T20:50:12.604Z",
"buildId": "c26de28b",
"releasedAt": "2026-11-21T20:57:34.475Z",
"bundleUrl": "/bundles/bundle-1.0.28.zip",
"latestUrl": "/bundles/bundle-latest.zip",
"checksum": "f81a1438f916e7d2a612d3b01620a488e8cffc0c75659720a8e6ab9d597babe0",
"sizeBytes": 71309
"checksum": "6a1134c67a3cb35376d10c37da034d6e015edfeefed8c31a1f1cd4617ce1e3ef",
"sizeBytes": 71641
}

View File

@ -286,31 +286,31 @@
<div class="chat-header">
<div class="chat-agent-info">
<span class="status-dot active" id="chat-agent-status-dot"></span>
<div>
<div class="chat-agent-meta">
<strong id="chat-agent-name" style="font-size: 0.95rem; color: #f8fafc;">Agente</strong>
<div id="chat-agent-subtitle" style="font-size: 0.7rem; color: #38bdf8;">Terminal Maestri Conectado</div>
</div>
</div>
<div class="chat-header-actions" style="display: flex; align-items: center; gap: 0.25rem;">
<button id="btn-session-downloads" class="btn-icon btn-session-downloads" aria-label="Arquivos da Estação (Downloads)" title="Arquivos da Estação" style="position: relative; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; z-index: 30;">
<div class="chat-header-actions">
<button id="btn-session-downloads" class="btn-icon btn-session-downloads" aria-label="Arquivos da Estação (Downloads)" title="Arquivos da Estação" style="position: relative; min-width: 44px; min-height: 44px;">
<span style="font-size: 1.1rem; line-height: 1;">📥</span>
<span id="session-downloads-badge" class="session-downloads-badge" style="display: none;">0</span>
</button>
<button type="button" id="btn-tui-toggle" class="btn-icon btn-tui-toggle-header" aria-label="Teclas de navegação do terminal (Setas / Enter / Esc)" title="Teclas de Menu (↑ ↓ Enter Esc)" style="min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; z-index: 30;">
<button type="button" id="btn-tui-toggle" class="btn-icon btn-tui-toggle-header" aria-label="Teclas de navegação do terminal (Setas / Enter / Esc)" title="Teclas de Menu (↑ ↓ Enter Esc)" style="min-width: 44px; min-height: 44px;">
<span style="font-size: 1.05rem; line-height: 1;">⌨️</span>
</button>
<button id="chat-notif-toggle-btn" class="btn-icon btn-chat-notif-toggle muted" aria-label="Alternar Notificações" title="Alternar Notificações" style="font-size: 1.1rem; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; z-index: 30;">🔕</button>
<button type="button" id="btn-restart-terminal" class="btn-icon btn-restart-terminal" aria-label="Reiniciar / Recarregar terminal via Maestri" title="Reiniciar / Recarregar terminal via Maestri" style="min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; z-index: 30;">
<button id="chat-notif-toggle-btn" class="btn-icon btn-chat-notif-toggle muted" aria-label="Alternar Notificações" title="Alternar Notificações" style="font-size: 1.1rem; min-width: 44px; min-height: 44px;">🔕</button>
<button type="button" id="btn-restart-terminal" class="btn-icon btn-restart-terminal" aria-label="Reiniciar / Recarregar terminal via Maestri" title="Reiniciar / Recarregar terminal via Maestri" style="min-width: 44px; min-height: 44px;">
<svg style="width:18px;height:18px;color:#f59e0b" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 5.636a9 9 0 11-12.728 0M12 3v9" />
</svg>
</button>
<button id="btn-refresh-chat" class="btn-icon" aria-label="Atualizar saída do terminal" title="Atualizar terminal" style="min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; z-index: 30;">
<button id="btn-refresh-chat" class="btn-icon" aria-label="Atualizar saída do terminal" title="Atualizar terminal" style="min-width: 44px; min-height: 44px;">
<svg style="width:18px;height:18px;color:#38bdf8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
</svg>
</button>
<button id="btn-close-chat" class="btn-icon btn-close-chat" onclick="window.closeChat && window.closeChat()" aria-label="Fechar Chat">&times;</button>
<button id="btn-close-chat" class="btn-icon btn-close-chat" onclick="window.closeChat && window.closeChat()" aria-label="Fechar Chat" style="min-width: 44px; min-height: 44px;">&times;</button>
</div>
</div>

View File

@ -1016,7 +1016,7 @@ main {
display: flex;
flex-direction: column;
justify-content: flex-end;
padding-top: max(1.5rem, calc(0.75rem + env(safe-area-inset-top, 0px)));
padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
padding-left: env(safe-area-inset-left, 0px);
padding-right: env(safe-area-inset-right, 0px);
}
@ -1025,7 +1025,8 @@ main {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.65);
backdrop-filter: blur(2px);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
}
.chat-content {
@ -1033,10 +1034,8 @@ main {
background: var(--bg-card);
border-top: 1px solid var(--border);
border-radius: 20px 20px 0 0;
height: 93vh;
height: 93dvh;
max-height: 95vh;
max-height: 95dvh;
height: 100%;
max-height: 100%;
display: flex;
flex-direction: column;
box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
@ -1045,65 +1044,135 @@ main {
}
.chat-header {
padding-top: max(0.85rem, calc(0.5rem + env(safe-area-inset-top, 0px)));
padding-bottom: 0.85rem;
padding-left: max(1rem, calc(0.75rem + env(safe-area-inset-left, 0px)));
padding-right: max(1.25rem, calc(1rem + env(safe-area-inset-right, 0px)));
border-bottom: 1px solid var(--border);
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
background: rgba(10, 15, 29, 0.6);
flex-direction: column;
gap: 0.6rem;
padding: 0.75rem 1rem 0.65rem;
padding-left: max(1rem, calc(0.75rem + env(safe-area-inset-left, 0px)));
padding-right: max(1rem, calc(0.75rem + env(safe-area-inset-right, 0px)));
background: rgba(10, 15, 29, 0.85);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
gap: 0.5rem;
}
/* Row 1: Informações do Agente e Botão Fechar */
.chat-agent-info {
display: flex;
align-items: center;
gap: 0.6rem;
gap: 0.65rem;
min-width: 0;
width: 100%;
padding-right: 52px; /* Reserva espaço livre para o botão de fechar no canto superior direito */
box-sizing: border-box;
}
.chat-agent-info .status-dot {
flex-shrink: 0;
width: 10px;
height: 10px;
}
.chat-agent-meta,
.chat-agent-info > div {
min-width: 0;
flex: 1 1 auto;
overflow: hidden;
}
.chat-agent-info > div {
min-width: 0;
#chat-agent-name {
display: block;
font-size: 1.05rem;
font-weight: 700;
color: #f8fafc;
line-height: 1.3;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
letter-spacing: -0.01em;
}
#chat-agent-subtitle {
font-size: 0.74rem;
color: #38bdf8;
line-height: 1.3;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 0.1rem;
}
/* Row 2: Barra de Ações Rápidas do Terminal (5 botões de utilidades) */
.chat-header-actions {
display: flex;
align-items: center;
gap: 0.35rem;
flex-shrink: 0;
margin-right: max(0.25rem, env(safe-area-inset-right, 0px));
gap: 8px; /* Mínimo 8px de respiro livre entre as áreas de toque */
flex-wrap: wrap;
width: 100%;
padding-top: 0.35rem;
border-top: 1px solid rgba(255, 255, 255, 0.06);
}
#btn-close-chat,
.btn-close-chat {
margin-left: 0.35rem;
margin-right: max(0.35rem, calc(0.2rem + env(safe-area-inset-right, 0px)));
flex-shrink: 0;
border-radius: 50%;
width: 40px;
height: 40px;
min-width: 40px;
min-height: 40px;
/* Botões de Ação do Header (Mínimo 44x44px de área de toque) */
.chat-header-actions .btn-icon {
width: 44px;
height: 44px;
min-width: 44px;
min-height: 44px;
padding: 0;
border-radius: 10px;
display: inline-flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.08);
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.09);
color: #94a3b8;
cursor: pointer;
touch-action: manipulation;
transition: all 0.15s ease;
user-select: none;
-webkit-tap-highlight-color: transparent;
flex-shrink: 0;
}
.chat-header-actions .btn-icon:hover {
background: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.18);
color: #f8fafc;
}
.chat-header-actions .btn-icon:active {
transform: scale(0.94);
background: rgba(255, 255, 255, 0.15);
}
/* Botão Fechar: posicionado confortavelmente no canto superior direito */
#btn-close-chat,
.btn-close-chat {
position: absolute;
top: 0.65rem;
right: max(0.85rem, calc(0.5rem + env(safe-area-inset-right, 0px)));
width: 44px;
height: 44px;
min-width: 44px;
min-height: 44px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.07);
border: 1px solid rgba(255, 255, 255, 0.12);
color: var(--text-secondary);
color: #94a3b8;
font-size: 1.5rem;
line-height: 1;
cursor: pointer;
touch-action: manipulation;
z-index: 30;
transition: all 0.2s ease;
transition: all 0.18s ease;
margin: 0;
-webkit-tap-highlight-color: transparent;
}
#btn-close-chat:hover,
@ -1118,34 +1187,42 @@ main {
#btn-close-chat:active,
.btn-close-chat:active {
transform: scale(0.92);
background: rgba(239, 68, 68, 0.3);
background: rgba(239, 68, 68, 0.35);
}
@media (min-width: 641px) {
.chat-header {
flex-direction: row;
justify-content: space-between;
align-items: center;
gap: 1rem;
padding: 0.85rem 1.25rem;
}
.chat-agent-info {
padding-right: 0;
width: auto;
flex: 1 1 auto;
}
.chat-header-actions {
width: auto;
padding-top: 0;
border-top: none;
justify-content: flex-end;
}
#btn-close-chat,
.btn-close-chat {
position: static;
margin-left: 0.25rem;
}
}
@media (max-width: 480px) {
.chat-header {
padding-left: max(0.75rem, calc(0.5rem + env(safe-area-inset-left, 0px)));
padding-right: max(1rem, calc(0.75rem + env(safe-area-inset-right, 0px)));
gap: 0.35rem;
padding-right: max(0.75rem, calc(0.5rem + env(safe-area-inset-right, 0px)));
}
.chat-header-actions {
gap: 0.2rem;
margin-right: max(0.2rem, env(safe-area-inset-right, 0px));
}
.chat-header-actions .btn-icon:not(.btn-close-chat) {
min-width: 36px;
min-height: 36px;
padding: 0.35rem;
font-size: 0.95rem;
}
#btn-close-chat,
.btn-close-chat {
width: 38px;
height: 38px;
min-width: 38px;
min-height: 38px;
font-size: 1.4rem;
margin-left: 0.25rem;
margin-right: max(0.35rem, calc(0.2rem + env(safe-area-inset-right, 0px)));
gap: 8px;
}
}

View File

@ -3149,4 +3149,46 @@ Também verificamos running command e compiling no buffer.
window.removeAgentTyping(true);
assert.strictEqual(document.getElementById('chat-typing-indicator'), null, 'removeAgentTyping(true) deve remover completamente o card ao encerrar');
});
test('36. Layout e Usabilidade do Cabeçalho do Chat (UX Craft - Espaçamento, Safe-Area e Áreas de Toque)', async () => {
// 1. Elementos do cabeçalho
const chatHeader = document.querySelector('.chat-header');
const agentInfo = document.querySelector('.chat-agent-info');
const chatAgentName = document.getElementById('chat-agent-name');
const chatAgentSubtitle = document.getElementById('chat-agent-subtitle');
const headerActions = document.querySelector('.chat-header-actions');
const btnDownloads = document.getElementById('btn-session-downloads');
const btnTui = document.getElementById('btn-tui-toggle');
const btnNotif = document.getElementById('chat-notif-toggle-btn');
const btnRestart = document.getElementById('btn-restart-terminal');
const btnRefresh = document.getElementById('btn-refresh-chat');
const btnClose = document.getElementById('btn-close-chat');
assert.ok(chatHeader, '.chat-header deve existir');
assert.ok(agentInfo, '.chat-agent-info deve existir');
assert.ok(chatAgentName, '#chat-agent-name deve existir');
assert.ok(chatAgentSubtitle, '#chat-agent-subtitle deve existir');
assert.ok(headerActions, '.chat-header-actions deve existir');
// 2. Todos os 6 botões interativos devem ter área mínima de toque de 44x44px
const buttons = [btnDownloads, btnTui, btnNotif, btnRestart, btnRefresh, btnClose];
for (const btn of buttons) {
assert.ok(btn, `Botão ${btn?.id} deve existir no DOM`);
assert.strictEqual(btn.style.minWidth, '44px', `Botão ${btn.id} deve ter min-width de 44px`);
assert.strictEqual(btn.style.minHeight, '44px', `Botão ${btn.id} deve ter min-height de 44px`);
}
// 3. Ordem dos elementos no DOM preservada
assert.strictEqual(btnRestart.nextElementSibling?.id, 'btn-refresh-chat');
assert.strictEqual(btnRefresh.nextElementSibling?.id, 'btn-close-chat');
// 4. Validação das regras de CSS do cabeçalho no arquivo style.css
const cssContent = fs.readFileSync(path.resolve('public', 'style.css'), 'utf8');
assert.ok(cssContent.includes('.chat-header {'), 'Deve conter definição de .chat-header no CSS');
assert.ok(cssContent.includes('gap: 8px;'), 'Deve conter espaçamento mínimo de 8px entre os botões de ação');
assert.ok(cssContent.includes('padding-right: 52px;'), 'chat-agent-info deve reservar espaço para o botão fechar');
assert.ok(cssContent.includes('.chat-header-actions .btn-icon {'), 'Deve conter estilos para os botões do header');
assert.ok(cssContent.includes('min-width: 44px;'), 'CSS deve garantir min-width de 44px');
assert.ok(cssContent.includes('min-height: 44px;'), 'CSS deve garantir min-height de 44px');
});
});