fix(chat): move session sidebar toggle next to new-session button (mobile)

This commit is contained in:
OpenClaw Agent
2026-03-16 09:22:05 +00:00
parent 73278af085
commit 909b3d0892
2 changed files with 21 additions and 4 deletions

View File

@@ -83,16 +83,21 @@ export async function render() {
<div class="chat-sidebar" id="chat-sidebar">
<div class="chat-sidebar-header">
<span>会话列表</span>
<button class="chat-sidebar-btn" id="btn-new-session" title="新建会话">
<div class="chat-sidebar-header-actions">
<button class="chat-sidebar-btn" id="btn-toggle-sidebar" title="会话列表">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<button class="chat-sidebar-btn" id="btn-new-session" title="新建会话">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
</button>
</div>
</div>
<div class="chat-session-list" id="chat-session-list"></div>
</div>
<div class="chat-main">
<div class="chat-header">
<div class="chat-status">
<button class="chat-toggle-sidebar" id="btn-toggle-sidebar" title="会话列表">
<button class="chat-toggle-sidebar" id="btn-toggle-sidebar-header" title="会话列表">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<span class="status-dot" id="chat-status-dot"></span>
@@ -235,13 +240,18 @@ function bindEvents(page) {
else sendMessage()
})
page.querySelector('#btn-toggle-sidebar').addEventListener('click', () => {
const _toggleBtns = [
page.querySelector('#btn-toggle-sidebar'),
page.querySelector('#btn-toggle-sidebar-header'),
].filter(Boolean)
_toggleBtns.forEach(btn => btn.addEventListener('click', () => {
const sidebar = page.querySelector('#chat-sidebar')
if (!sidebar) return
const nextOpen = !sidebar.classList.contains('open')
sidebar.classList.toggle('open', nextOpen)
setSidebarOpen(nextOpen)
})
}))
page.querySelector('#btn-new-session').addEventListener('click', () => showNewSessionDialog())
page.querySelector('#btn-cmd').addEventListener('click', () => toggleCmdPanel())
page.querySelector('#btn-reset-session').addEventListener('click', () => resetCurrentSession())

View File

@@ -48,6 +48,13 @@
font-weight: 600;
color: var(--text-secondary);
border-bottom: 1px solid var(--border);
gap: 8px;
}
.chat-sidebar-header-actions {
display: flex;
align-items: center;
gap: 6px;
}
.chat-sidebar-btn {