feat: improve mobile overlays and focus panel

This commit is contained in:
JOJO 2025-11-26 23:50:57 +08:00
parent 4cd4232c62
commit 4fe0ee473a
13 changed files with 1377 additions and 26 deletions

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M15 12H3m14 6H3M21 6H3" />
</svg>

After

Width:  |  Height:  |  Size: 204 B

View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<path d="M6 7c0-2 1.6-3.6 3.6-3.6h13c2 0 3.6 1.6 3.6 3.6v10c0 2-1.6 3.6-3.6 3.6h-6.2L12.4 25l0.7-4.4H9.6c-2 0-3.6-1.6-3.6-3.6V7Z" />
<path d="M10.4 11h11.2" />
<path d="M10.4 15h7.2" />
</svg>

After

Width:  |  Height:  |  Size: 360 B

1
static/icons/copy.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="48" height="48" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="opacity:1;"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>

After

Width:  |  Height:  |  Size: 324 B

View File

@ -0,0 +1,341 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>移动端多面板示例</title>
<style>
:root {
font-family: 'SF Pro Display', 'PingFang SC', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
color: #2f251b;
--bg: #f4efe7;
--card: #fffdf8;
--accent: #e06a3a;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
background: var(--bg);
display: flex;
flex-direction: column;
}
.chat-area {
flex: 1;
display: flex;
flex-direction: column;
padding: 16px;
gap: 12px;
}
.chat-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.chat-header h1 {
font-size: 20px;
margin: 0;
}
.message {
padding: 12px 14px;
border-radius: 14px;
max-width: 90%;
line-height: 1.5;
}
.message.user {
background: #fff;
margin-left: auto;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.message.bot {
background: var(--card);
border: 1px solid rgba(0, 0, 0, 0.08);
}
.mobile-toolbar {
position: sticky;
bottom: 0;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
padding: 12px 16px clamp(16px, 4vw, 28px);
background: linear-gradient(180deg, rgba(244, 239, 231, 0.9), rgba(244, 239, 231, 1));
border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.toolbar-btn {
border: none;
border-radius: 999px;
padding: 10px;
background: rgba(47, 37, 27, 0.08);
color: #3a2f23;
font-size: 14px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
transition: background 0.2s ease;
}
.toolbar-btn.active {
background: var(--accent);
color: #fffaf3;
}
.toolbar-btn span {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.08em;
}
.sheet {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 50;
transition: visibility 0.2s;
visibility: hidden;
}
.sheet.is-visible {
pointer-events: auto;
visibility: visible;
}
.sheet-backdrop {
position: absolute;
inset: 0;
background: rgba(11, 8, 5, 0.35);
opacity: 0;
transition: opacity 0.25s ease;
}
.sheet.is-visible .sheet-backdrop {
opacity: 1;
}
.sheet-panel {
position: absolute;
top: clamp(12px, 3vh, 24px);
bottom: clamp(12px, 3vh, 24px);
width: min(420px, 88vw);
border-radius: 20px;
background: #fffdf8;
box-shadow: 0 24px 60px rgba(20, 12, 4, 0.35);
display: flex;
flex-direction: column;
transform: translateX(-120%);
transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sheet[data-side='right'] .sheet-panel {
right: clamp(12px, 3vw, 24px);
transform: translateX(120%);
}
.sheet[data-side='left'] .sheet-panel {
left: clamp(12px, 3vw, 24px);
}
.sheet.is-visible .sheet-panel {
transform: translateX(0);
}
.sheet-header {
padding: 18px 22px;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
display: flex;
justify-content: space-between;
align-items: center;
}
.sheet-title {
font-size: 18px;
font-weight: 600;
}
.close-btn {
border: none;
background: rgba(0, 0, 0, 0.05);
border-radius: 999px;
width: 34px;
height: 34px;
font-size: 18px;
cursor: pointer;
}
.sheet-body {
flex: 1;
overflow-y: auto;
padding: 18px 22px 24px;
display: flex;
flex-direction: column;
gap: 16px;
}
.section-card {
background: rgba(47, 37, 27, 0.04);
border-radius: 16px;
padding: 14px 16px;
border: 1px solid rgba(47, 37, 27, 0.08);
}
.status-card {
background: radial-gradient(circle at 10% 20%, rgba(255, 163, 103, 0.35), rgba(255, 244, 234, 0.7));
border: none;
}
</style>
</head>
<body>
<main class="chat-area">
<header class="chat-header">
<h1>对话区域</h1>
<small>仅占满屏幕,其他面板以弹层呈现</small>
</header>
<div class="message bot">你好!我在移动端也可以干活 🙌</div>
<div class="message user">我想看看其它面板在哪里?</div>
<div class="message bot">点击下方按钮就能半覆盖地拉出侧栏。</div>
</main>
<nav class="mobile-toolbar">
<button class="toolbar-btn" data-open="conversation-sheet">
<span>对话记录</span>
</button>
<button class="toolbar-btn" data-open="workspace-sheet">
🧰
<span>工作台</span>
</button>
<button class="toolbar-btn" data-open="focus-sheet">
👁️
<span>聚焦文件</span>
</button>
</nav>
<section class="sheet" data-side="left" id="conversation-sheet">
<div class="sheet-backdrop" data-close></div>
<div class="sheet-panel">
<div class="sheet-header">
<div class="sheet-title">对话记录</div>
<button class="close-btn" data-close>×</button>
</div>
<div class="sheet-body">
<div class="section-card status-card">
<strong>快速操作</strong>
<p>新建对话 · 搜索 · 会话列表</p>
</div>
<div class="section-card">
<p>#1234 需求讨论 · 刚刚</p>
</div>
<div class="section-card">
<p>#1227 UI 迭代 · 1 小时前</p>
</div>
</div>
</div>
</section>
<section class="sheet" data-side="left" id="workspace-sheet">
<div class="sheet-backdrop" data-close></div>
<div class="sheet-panel">
<div class="sheet-header">
<div class="sheet-title">三合一工作台</div>
<button class="close-btn" data-close>×</button>
</div>
<div class="sheet-body">
<div class="section-card status-card">
<strong>AI Agent v2.4</strong>
<p>已连接 · 思考模式</p>
</div>
<div class="section-card">
<h4>项目文件</h4>
<p>/src/App.vue</p>
<p>/stores/ui.ts</p>
</div>
<div class="section-card">
<h4>待办列表</h4>
<p>1. 完成移动端布局</p>
<p>2. 录制演示</p>
</div>
<div class="section-card">
<h4>子智能体</h4>
<p>#05 构建状态 · 运行中</p>
</div>
</div>
</div>
</section>
<section class="sheet" data-side="right" id="focus-sheet">
<div class="sheet-backdrop" data-close></div>
<div class="sheet-panel">
<div class="sheet-header">
<div class="sheet-title">聚焦面板</div>
<button class="close-btn" data-close>×</button>
</div>
<div class="sheet-body">
<div class="section-card">
<h4>App.vue</h4>
<p>...main-container / panel 切换逻辑...</p>
</div>
<div class="section-card">
<h4>ui.ts</h4>
<p>...isMobileViewport · activeMobileSheet...</p>
</div>
<div class="section-card">
<h4>styles/_responsive.scss</h4>
<p>...overlay 动画与遮罩...</p>
</div>
</div>
</div>
</section>
<script>
const buttons = document.querySelectorAll('[data-open]');
const sheets = document.querySelectorAll('.sheet');
const toolbarButtons = document.querySelectorAll('.toolbar-btn');
const closeAllSheets = () => {
sheets.forEach(sheet => sheet.classList.remove('is-visible'));
toolbarButtons.forEach(btn => btn.classList.remove('active'));
};
buttons.forEach(btn => {
btn.addEventListener('click', () => {
const targetId = btn.getAttribute('data-open');
const targetSheet = document.getElementById(targetId);
if (!targetSheet) return;
const isAlreadyOpen = targetSheet.classList.contains('is-visible');
closeAllSheets();
if (!isAlreadyOpen) {
targetSheet.classList.add('is-visible');
btn.classList.add('active');
}
});
});
document.querySelectorAll('[data-close]').forEach(el => {
el.addEventListener('click', () => {
const sheet = el.closest('.sheet');
if (!sheet) return;
sheet.classList.remove('is-visible');
toolbarButtons.forEach(btn => {
if (btn.getAttribute('data-open') === sheet.id) {
btn.classList.remove('active');
}
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,437 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>移动端半覆盖面板(浮动按钮)</title>
<style>
:root {
--bg: #f4efe7;
--card: #fffdf8;
--accent: #e06a3a;
--text: #2f251b;
}
*, *::before, *::after {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
background: var(--bg);
font-family: 'SF Pro Display', 'PingFang SC', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
color: var(--text);
display: flex;
flex-direction: column;
}
.chat-area {
flex: 1;
padding: 18px 18px calc(90px + env(safe-area-inset-bottom, 0px));
display: flex;
flex-direction: column;
gap: 12px;
}
.chat-headline {
font-size: 22px;
margin: 0 0 8px;
}
.message {
padding: 12px 14px;
border-radius: 16px;
line-height: 1.55;
max-width: 90%;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.message.bot {
background: var(--card);
}
.message.user {
background: #fff;
margin-left: auto;
}
.composer-placeholder {
position: sticky;
bottom: 0;
background: linear-gradient(180deg, rgba(244, 239, 231, 0), rgba(244, 239, 231, 0.95));
padding: 12px 0 0;
}
.composer-shell {
background: #fff;
border-radius: 18px;
display: flex;
align-items: center;
gap: 10px;
padding: 12px 16px;
border: 1px solid rgba(0, 0, 0, 0.08);
}
.composer-shell textarea {
flex: 1;
border: none;
resize: none;
font-size: 15px;
outline: none;
}
.composer-shell button {
border: none;
background: var(--accent);
color: #fff;
border-radius: 50%;
width: 36px;
height: 36px;
}
/* 悬浮主按钮 */
.fab {
position: fixed;
top: 16px;
left: 16px;
z-index: 60;
}
.fab-toggle {
width: 52px;
height: 52px;
border-radius: 26px;
border: none;
background: var(--accent);
color: #fff;
font-size: 22px;
box-shadow: 0 14px 38px rgba(224, 106, 58, 0.35);
cursor: pointer;
}
.fab-menu {
position: absolute;
top: 64px;
left: 4px;
display: flex;
flex-direction: column;
gap: 8px;
padding: 10px;
border-radius: 16px;
background: rgba(47, 37, 27, 0.95);
box-shadow: 0 18px 48px rgba(8, 6, 4, 0.45);
transform-origin: top left;
transform: scale(0.8) translateY(-10px);
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease, transform 0.2s ease;
}
.fab-menu.open {
opacity: 1;
transform: scale(1) translateY(0);
pointer-events: auto;
}
.fab-menu button {
border: none;
background: transparent;
color: #fff;
font-size: 16px;
display: flex;
align-items: center;
gap: 12px;
padding: 8px 12px;
border-radius: 12px;
}
.fab-menu button span {
font-size: 13px;
opacity: 0.8;
}
.fab-menu button:hover,
.fab-menu button.active {
background: rgba(255, 255, 255, 0.12);
}
.sheet {
position: fixed;
inset: 0;
pointer-events: none;
visibility: hidden;
transition: visibility 0.2s;
}
.sheet.is-visible {
pointer-events: auto;
visibility: visible;
}
.sheet-backdrop {
position: absolute;
inset: 0;
background: rgba(11, 8, 5, 0.35);
opacity: 0;
transition: opacity 0.25s ease;
}
.sheet.is-visible .sheet-backdrop {
opacity: 1;
}
.sheet-panel {
position: absolute;
top: clamp(12px, 3vh, 28px);
bottom: clamp(12px, 3vh, 28px);
width: min(420px, 88vw);
border-radius: 22px;
background: #fffdf8;
box-shadow: 0 24px 60px rgba(20, 12, 4, 0.35);
display: flex;
flex-direction: column;
transform: translateX(-120%);
transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sheet[data-side='left'] .sheet-panel {
left: clamp(12px, 3vw, 24px);
}
.sheet[data-side='right'] .sheet-panel {
right: clamp(12px, 3vw, 24px);
transform: translateX(120%);
}
.sheet.is-visible .sheet-panel {
transform: translateX(0);
}
.sheet-header {
padding: 18px 22px;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
display: flex;
justify-content: space-between;
align-items: center;
}
.sheet-title {
font-size: 18px;
font-weight: 600;
}
.close-btn {
border: none;
background: rgba(0, 0, 0, 0.06);
border-radius: 999px;
width: 34px;
height: 34px;
font-size: 18px;
cursor: pointer;
}
.sheet-body {
flex: 1;
overflow-y: auto;
padding: 18px 22px 24px;
display: flex;
flex-direction: column;
gap: 16px;
}
.section-card {
border-radius: 16px;
background: rgba(47, 37, 27, 0.04);
border: 1px solid rgba(47, 37, 27, 0.08);
padding: 14px 16px;
}
.status-pill {
font-size: 13px;
color: rgba(0, 0, 0, 0.55);
}
</style>
</head>
<body>
<div class="fab">
<button class="fab-toggle" id="fabToggle"></button>
<div class="fab-menu" id="fabMenu">
<button data-open="conversation-sheet">
📚
<div>
对话记录
<span>历史 + 搜索</span>
</div>
</button>
<button data-open="workspace-sheet">
🧰
<div>
工作台
<span>文件 / 待办 / 子体</span>
</div>
</button>
<button data-open="focus-sheet">
👁️
<div>
聚焦面板
<span>最多 3 个文件</span>
</div>
</button>
</div>
</div>
<main class="chat-area">
<h1 class="chat-headline">对话区域</h1>
<div class="message bot">你好!移动端默认只显示聊天内容。</div>
<div class="message user">其它面板怎么进入?</div>
<div class="message bot">点击左上角的悬浮按钮,展开二级菜单即可。</div>
<div class="message bot">每个选项会以半覆盖弹层的方式显示对应面板。</div>
<div class="composer-placeholder">
<div class="composer-shell">
<textarea rows="1" placeholder="输入内容…"></textarea>
<button></button>
</div>
</div>
</main>
<!-- 对话记录 -->
<section class="sheet" data-side="left" id="conversation-sheet">
<div class="sheet-backdrop" data-close></div>
<div class="sheet-panel">
<div class="sheet-header">
<div>
<div class="sheet-title">对话记录</div>
<div class="status-pill">最近 10 条 · 可搜索</div>
</div>
<button class="close-btn" data-close>×</button>
</div>
<div class="sheet-body">
<div class="section-card">
<strong>新建对话</strong>
<p>用于创建新的任务空间</p>
</div>
<div class="section-card">
<p>#1243 Bug 跟踪 · 刚刚</p>
</div>
<div class="section-card">
<p>#1235 UI 迭代 · 30 分钟前</p>
</div>
</div>
</div>
</section>
<!-- 三合一工作台 -->
<section class="sheet" data-side="left" id="workspace-sheet">
<div class="sheet-backdrop" data-close></div>
<div class="sheet-panel">
<div class="sheet-header">
<div>
<div class="sheet-title">三合一工作台</div>
<div class="status-pill">Logo 卡片 + 文件 + 待办 + 子体</div>
</div>
<button class="close-btn" data-close>×</button>
</div>
<div class="sheet-body">
<div class="section-card">
<strong>AI Agent v2.4</strong>
<p>思考模式 · 已连接</p>
</div>
<div class="section-card">
<h4>项目文件</h4>
<p>/src/App.vue</p>
<p>/stores/ui.ts</p>
</div>
<div class="section-card">
<h4>待办</h4>
<p>1. 适配移动端布局</p>
<p>2. 补充交互说明</p>
</div>
<div class="section-card">
<h4>子智能体</h4>
<p>#07 日志总结 · 进行中</p>
</div>
</div>
</div>
</section>
<!-- 聚焦面板 -->
<section class="sheet" data-side="right" id="focus-sheet">
<div class="sheet-backdrop" data-close></div>
<div class="sheet-panel">
<div class="sheet-header">
<div>
<div class="sheet-title">聚焦面板</div>
<div class="status-pill">最多 3 个热点文件</div>
</div>
<button class="close-btn" data-close>×</button>
</div>
<div class="sheet-body">
<div class="section-card">
<h4>App.vue</h4>
<p>移动端 Teleport 逻辑</p>
</div>
<div class="section-card">
<h4>ui.ts</h4>
<p>activeMobileSheet 状态</p>
</div>
<div class="section-card">
<h4>styles/_responsive.scss</h4>
<p>半覆盖动画与遮罩</p>
</div>
</div>
</div>
</section>
<script>
const fabToggle = document.getElementById('fabToggle');
const fabMenu = document.getElementById('fabMenu');
const sheetButtons = document.querySelectorAll('.fab-menu [data-open]');
const sheets = document.querySelectorAll('.sheet');
const closeAllSheets = () => {
sheets.forEach(sheet => sheet.classList.remove('is-visible'));
sheetButtons.forEach(btn => btn.classList.remove('active'));
};
fabToggle.addEventListener('click', () => {
fabMenu.classList.toggle('open');
});
sheetButtons.forEach(btn => {
btn.addEventListener('click', () => {
const targetId = btn.getAttribute('data-open');
const sheet = document.getElementById(targetId);
if (!sheet) return;
const alreadyOpen = sheet.classList.contains('is-visible');
closeAllSheets();
fabMenu.classList.remove('open');
if (!alreadyOpen) {
sheet.classList.add('is-visible');
btn.classList.add('active');
}
});
});
document.querySelectorAll('[data-close]').forEach(el => {
el.addEventListener('click', () => {
const sheet = el.closest('.sheet');
if (!sheet) return;
sheet.classList.remove('is-visible');
sheetButtons.forEach(btn => {
if (btn.getAttribute('data-open') === sheet.id) {
btn.classList.remove('active');
}
});
});
});
document.addEventListener('click', event => {
if (!fabMenu.contains(event.target) && event.target !== fabToggle) {
fabMenu.classList.remove('open');
}
});
</script>
</body>
</html>

View File

@ -39,6 +39,7 @@
<template v-else>
<div class="main-container">
<ConversationSidebar
v-if="!isMobileViewport"
:icon-style="iconStyle"
:format-time="formatTime"
@toggle="toggleSidebar"
@ -52,6 +53,7 @@
/>
<LeftPanel
v-if="!isMobileViewport"
ref="leftPanel"
:width="leftWidth"
:icon-style="iconStyle"
@ -65,7 +67,7 @@
@open-file-manager="openGuiFileManager"
/>
<div class="resize-handle" @mousedown="startResize('left', $event)"></div>
<div v-if="!isMobileViewport" class="resize-handle" @mousedown="startResize('left', $event)"></div>
<main class="chat-container">
<TokenDrawer
@ -159,9 +161,10 @@
/>
</main>
<div class="resize-handle" @mousedown="startResize('right', $event)"></div>
<div v-if="!isMobileViewport" class="resize-handle" @mousedown="startResize('right', $event)"></div>
<FocusPanel
v-if="!isMobileViewport"
:collapsed="rightCollapsed"
:width="rightWidth"
:icon-style="iconStyle"
@ -170,6 +173,122 @@
</div>
<PersonalizationDrawer />
<div
v-if="isMobileViewport"
class="mobile-panel-trigger"
:class="{ 'is-hidden': Boolean(activeMobileOverlay) }"
ref="mobilePanelTrigger"
>
<button type="button" class="mobile-panel-fab" aria-label="打开更多工作区面板" @click="toggleMobileOverlayMenu">
<img :src="mobilePanelIcon" alt="" aria-hidden="true" />
</button>
<transition name="mobile-panel-menu">
<div v-if="mobileOverlayMenuOpen" class="mobile-panel-menu">
<button
type="button"
class="mobile-menu-btn mobile-menu-btn--conversation"
aria-label="对话记录"
@click="openMobileOverlay('conversation')"
>
<svg class="mobile-menu-svg" viewBox="0 0 28 28" fill="none" aria-hidden="true">
<path
d="M5 6.5c0-1.38 1.12-2.5 2.5-2.5h13c1.38 0 2.5 1.12 2.5 2.5v8.5c0 1.38-1.12 2.5-2.5 2.5h-5.6l-3.4 3.2.6-3.2H7.5c-1.38 0-2.5-1.12-2.5-2.5V6.5z"
fill="none"
stroke="currentColor"
stroke-width="1.9"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path d="M9 9.5h10" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" />
<path d="M9 13h6" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" />
</svg>
</button>
<button type="button" class="mobile-menu-btn" aria-label="工作台" @click="openMobileOverlay('workspace')">
<img :src="mobileMenuIcons.workspace" alt="" aria-hidden="true" />
</button>
<button type="button" class="mobile-menu-btn" aria-label="聚焦面板" @click="openMobileOverlay('focus')">
<img :src="mobileMenuIcons.focus" alt="" aria-hidden="true" />
</button>
<button type="button" class="mobile-menu-btn" aria-label="个人空间" @click="handleMobilePersonalClick">
<img :src="mobileMenuIcons.personal" alt="" aria-hidden="true" />
</button>
</div>
</transition>
</div>
<transition name="mobile-panel-overlay">
<div
v-if="isMobileViewport && activeMobileOverlay === 'conversation'"
class="mobile-panel-overlay mobile-panel-overlay--left"
@click.self="closeMobileOverlay"
>
<div class="mobile-panel-sheet mobile-panel-sheet--conversation">
<ConversationSidebar
class="mobile-overlay-content"
:icon-style="iconStyle"
:format-time="formatTime"
:show-collapse-button="true"
collapse-button-variant="close"
@toggle="toggleSidebar"
@create="createNewConversation"
@search="handleSidebarSearch"
@select="handleMobileOverlaySelect($event)"
@load-more="loadMoreConversations"
@personal="openPersonalPage"
@delete="deleteConversation"
@duplicate="duplicateConversation"
/>
</div>
</div>
</transition>
<transition name="mobile-panel-overlay">
<div
v-if="isMobileViewport && activeMobileOverlay === 'workspace'"
class="mobile-panel-overlay mobile-panel-overlay--left"
@click.self="closeMobileOverlay"
>
<div class="mobile-panel-sheet mobile-panel-sheet--workspace">
<button type="button" class="mobile-overlay-close" aria-label="关闭面板" @click="closeMobileOverlay">
×
</button>
<LeftPanel
class="mobile-overlay-content"
:width="Math.min(leftWidth, 420)"
:icon-style="iconStyle"
:agent-version="agentVersion"
:thinking-mode="thinkingMode"
:is-connected="isConnected"
:panel-menu-open="panelMenuOpen"
:panel-mode="panelMode"
@toggle-panel-menu="togglePanelMenu"
@select-panel="selectPanelMode"
@open-file-manager="openGuiFileManager"
/>
</div>
</div>
</transition>
<transition name="mobile-panel-overlay">
<div
v-if="isMobileViewport && activeMobileOverlay === 'focus'"
class="mobile-panel-overlay mobile-panel-overlay--right"
@click.self="closeMobileOverlay"
>
<div class="mobile-panel-sheet mobile-panel-sheet--focus">
<FocusPanel
class="mobile-overlay-content"
:collapsed="false"
:width="Math.min(rightWidth, 420)"
:icon-style="iconStyle"
:get-language-class="getLanguageClass"
:show-close-button="true"
@close="closeMobileOverlay"
/>
</div>
</div>
</transition>
</template>
</AppShell>
</template>
@ -177,5 +296,12 @@
<script setup lang="ts">
import appOptions from './app';
const mobilePanelIcon = new URL('../icons/align-left.svg', import.meta.url).href;
const mobileMenuIcons = {
workspace: new URL('../icons/folder.svg', import.meta.url).href,
focus: new URL('../icons/eye.svg', import.meta.url).href,
personal: new URL('../icons/user.svg', import.meta.url).href
};
defineOptions(appOptions);
</script>

View File

@ -123,6 +123,7 @@ const appOptions = {
skipConversationHistoryReload: false,
_scrollListenerReady: false,
historyLoading: false,
mobileViewportQuery: null,
// 工具控制菜单
icons: ICONS,
@ -167,7 +168,10 @@ const appOptions = {
document.addEventListener('click', this.handleClickOutsideQuickMenu);
document.addEventListener('click', this.handleClickOutsidePanelMenu);
document.addEventListener('click', this.handleClickOutsideMobileMenu);
window.addEventListener('popstate', this.handlePopState);
window.addEventListener('keydown', this.handleMobileOverlayEscape);
this.setupMobileViewportWatcher();
this.subAgentFetch();
this.subAgentStartPolling();
@ -204,7 +208,10 @@ const appOptions = {
'quotaToast',
'toastQueue',
'confirmDialog',
'easterEgg'
'easterEgg',
'isMobileViewport',
'mobileOverlayMenuOpen',
'activeMobileOverlay'
]),
...mapWritableState(useConversationStore, [
'conversations',
@ -260,7 +267,10 @@ const appOptions = {
beforeUnmount() {
document.removeEventListener('click', this.handleClickOutsideQuickMenu);
document.removeEventListener('click', this.handleClickOutsidePanelMenu);
document.removeEventListener('click', this.handleClickOutsideMobileMenu);
window.removeEventListener('popstate', this.handlePopState);
window.removeEventListener('keydown', this.handleMobileOverlayEscape);
this.teardownMobileViewportWatcher();
this.subAgentStopPolling();
this.resourceStopContainerStatsPolling();
this.resourceStopProjectStoragePolling();
@ -309,11 +319,108 @@ const appOptions = {
this.initScrollListener();
this._scrollListenerReady = true;
},
setupMobileViewportWatcher() {
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
this.updateMobileViewportState(false);
return;
}
const query = window.matchMedia('(max-width: 768px)');
this.mobileViewportQuery = query;
this.updateMobileViewportState(query.matches);
if (typeof query.addEventListener === 'function') {
query.addEventListener('change', this.handleMobileViewportQueryChange);
} else if (typeof query.addListener === 'function') {
query.addListener(this.handleMobileViewportQueryChange);
}
},
teardownMobileViewportWatcher() {
const query = this.mobileViewportQuery;
if (!query) {
return;
}
if (typeof query.removeEventListener === 'function') {
query.removeEventListener('change', this.handleMobileViewportQueryChange);
} else if (typeof query.removeListener === 'function') {
query.removeListener(this.handleMobileViewportQueryChange);
}
this.mobileViewportQuery = null;
},
handleMobileViewportQueryChange(event) {
this.updateMobileViewportState(event.matches);
},
updateMobileViewportState(isMobile) {
this.uiSetMobileViewport(!!isMobile);
if (!isMobile) {
this.uiSetMobileOverlayMenuOpen(false);
this.closeMobileOverlay();
}
},
toggleMobileOverlayMenu() {
if (!this.isMobileViewport) {
return;
}
this.uiToggleMobileOverlayMenu();
},
openMobileOverlay(target) {
if (!this.isMobileViewport) {
return;
}
if (this.activeMobileOverlay === target) {
this.closeMobileOverlay();
return;
}
if (this.activeMobileOverlay === 'conversation') {
this.uiSetSidebarCollapsed(true);
}
if (target === 'conversation') {
this.uiSetSidebarCollapsed(false);
}
this.uiSetActiveMobileOverlay(target);
this.uiSetMobileOverlayMenuOpen(false);
},
closeMobileOverlay() {
if (!this.activeMobileOverlay) {
this.uiCloseMobileOverlay();
return;
}
if (this.activeMobileOverlay === 'conversation') {
this.uiSetSidebarCollapsed(true);
}
this.uiCloseMobileOverlay();
},
handleClickOutsideMobileMenu(event) {
if (!this.isMobileViewport || !this.mobileOverlayMenuOpen) {
return;
}
const trigger = this.$refs.mobilePanelTrigger;
if (trigger && typeof trigger.contains === 'function' && trigger.contains(event.target)) {
return;
}
this.uiSetMobileOverlayMenuOpen(false);
},
handleMobileOverlayEscape(event) {
if (event.key !== 'Escape' || !this.isMobileViewport) {
return;
}
if (this.mobileOverlayMenuOpen) {
this.uiSetMobileOverlayMenuOpen(false);
return;
}
if (this.activeMobileOverlay) {
this.closeMobileOverlay();
}
},
...mapActions(useUiStore, {
uiToggleSidebar: 'toggleSidebar',
uiSetSidebarCollapsed: 'setSidebarCollapsed',
uiSetPanelMode: 'setPanelMode',
uiSetPanelMenuOpen: 'setPanelMenuOpen',
uiTogglePanelMenu: 'togglePanelMenu',
uiSetMobileViewport: 'setIsMobileViewport',
uiSetMobileOverlayMenuOpen: 'setMobileOverlayMenuOpen',
uiToggleMobileOverlayMenu: 'toggleMobileOverlayMenu',
uiSetActiveMobileOverlay: 'setActiveMobileOverlay',
uiCloseMobileOverlay: 'closeMobileOverlay',
uiPushToast: 'pushToast',
uiUpdateToast: 'updateToast',
uiDismissToast: 'dismissToast',
@ -1610,7 +1717,21 @@ const appOptions = {
this.searchConversations();
},
handleMobileOverlaySelect(conversationId) {
this.loadConversation(conversationId);
this.closeMobileOverlay();
},
handleMobilePersonalClick() {
this.closeMobileOverlay();
this.uiSetMobileOverlayMenuOpen(false);
this.openPersonalPage();
},
toggleSidebar() {
if (this.isMobileViewport && this.activeMobileOverlay === 'conversation') {
this.closeMobileOverlay();
return;
}
this.uiToggleSidebar();
},

View File

@ -5,6 +5,15 @@
<span class="icon icon-sm" :style="iconStyle('eye')" aria-hidden="true"></span>
<span>聚焦文件 ({{ focusedCount }}/3)</span>
</h3>
<button
v-if="showCloseButton"
type="button"
class="focus-close-btn"
aria-label="关闭聚焦面板"
@click="$emit('close')"
>
×
</button>
</div>
<div class="focused-files" v-if="!collapsed">
<div v-if="!focusedCount" class="no-files">暂无聚焦文件</div>
@ -35,6 +44,11 @@ const props = defineProps<{
width: number;
iconStyle: (key: string) => Record<string, string>;
getLanguageClass: (path: string) => string;
showCloseButton?: boolean;
}>();
defineEmits<{
(event: 'close'): void;
}>();
const focusStore = useFocusStore();
@ -44,4 +58,5 @@ const focusedCount = computed(() => Object.keys(focusedFileMap.value).length);
const languageClass = (path: string) => props.getLanguageClass(path);
const formatSize = (size: number) => `${(size / 1024).toFixed(1)}KB`;
const showCloseButton = computed(() => props.showCloseButton === true);
</script>

View File

@ -61,9 +61,14 @@
<span class="btn-icon">+</span>
<span class="btn-text">新建对话</span>
</button>
<button class="toggle-sidebar-btn" @click="$emit('toggle')">
<span v-if="collapsed" class="icon icon-md" :style="iconStyle('menu')" aria-hidden="true"></span>
<span v-else class="toggle-arrow" aria-hidden="true"></span>
<button v-if="showCollapseButton" class="toggle-sidebar-btn" @click="$emit('toggle')">
<template v-if="collapseButtonVariant === 'toggle'">
<span v-if="collapsed" class="icon icon-md" :style="iconStyle('menu')" aria-hidden="true"></span>
<span v-else class="toggle-arrow" aria-hidden="true"></span>
</template>
<template v-else>
<span class="toggle-close" aria-hidden="true">×</span>
</template>
</button>
</template>
</div>
@ -153,6 +158,7 @@
<script setup lang="ts">
defineOptions({ name: 'ConversationSidebar' });
import { computed } from 'vue';
import { storeToRefs } from 'pinia';
import { useUiStore } from '@/stores/ui';
import { useConversationStore } from '@/stores/conversation';
@ -161,6 +167,8 @@ import { usePersonalizationStore } from '@/stores/personalization';
const props = defineProps<{
formatTime?: (input: unknown) => string;
iconStyle?: (key: string) => Record<string, string>;
showCollapseButton?: boolean;
collapseButtonVariant?: 'toggle' | 'close';
}>();
defineEmits<{
@ -191,4 +199,6 @@ const { visible: personalPageVisible } = storeToRefs(personalizationStore);
const formatTime = (value: unknown) => (props.formatTime ? props.formatTime(value) : String(value));
const iconStyle = (key: string) => (props.iconStyle ? props.iconStyle(key) : {});
const showCollapseButton = computed(() => props.showCollapseButton !== false);
const collapseButtonVariant = computed(() => props.collapseButtonVariant || 'toggle');
</script>

View File

@ -2,6 +2,7 @@ import { defineStore } from 'pinia';
type PanelMode = 'files' | 'todo' | 'subAgents';
type ResizingPanel = 'left' | 'right' | null;
type MobileOverlayTarget = 'conversation' | 'workspace' | 'focus' | null;
interface QuotaToast {
message: string;
@ -64,6 +65,9 @@ interface UiState {
confirmDialog: ConfirmDialogState | null;
pendingConfirmResolver: ((value: boolean) => void) | null;
easterEgg: EasterEggState;
isMobileViewport: boolean;
mobileOverlayMenuOpen: boolean;
activeMobileOverlay: MobileOverlayTarget;
}
export const useUiStore = defineStore('ui', {
@ -92,7 +96,10 @@ export const useUiStore = defineStore('ui', {
cleanupTimer: null,
destroying: false,
destroyPromise: null
}
},
isMobileViewport: false,
mobileOverlayMenuOpen: false,
activeMobileOverlay: null
}),
actions: {
setSidebarCollapsed(collapsed: boolean) {
@ -127,6 +134,25 @@ export const useUiStore = defineStore('ui', {
this.minPanelWidth = min;
this.maxPanelWidth = max;
},
setIsMobileViewport(isMobile: boolean) {
this.isMobileViewport = isMobile;
if (!isMobile) {
this.mobileOverlayMenuOpen = false;
this.activeMobileOverlay = null;
}
},
setMobileOverlayMenuOpen(open: boolean) {
this.mobileOverlayMenuOpen = open;
},
toggleMobileOverlayMenu() {
this.mobileOverlayMenuOpen = !this.mobileOverlayMenuOpen;
},
setActiveMobileOverlay(target: MobileOverlayTarget) {
this.activeMobileOverlay = target;
},
closeMobileOverlay() {
this.activeMobileOverlay = null;
},
showQuotaToastMessage(message: string, type: string = 'fast', duration = 5000) {
this.quotaToast = { message, type };
if (this.quotaToastTimer) {

View File

@ -373,26 +373,26 @@
}
.copy-code-btn {
background: transparent;
color: var(--claude-text-secondary);
border: 1px solid rgba(121, 109, 94, 0.35);
padding: 6px 10px;
border-radius: 6px;
font-size: 16px;
width: 32px;
height: 32px;
border: none;
padding: 0;
border-radius: 50%;
background-color: transparent;
background-image: url('/static/icons/copy.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 20px;
cursor: pointer;
transition: all 0.2s ease;
line-height: 1;
transition: opacity 0.2s ease;
}
.copy-code-btn:hover {
background: rgba(218, 119, 86, 0.12);
color: var(--claude-accent-strong);
opacity: 0.7;
}
.copy-code-btn.copied {
background: var(--claude-success);
border-color: var(--claude-success);
color: #f6fff8;
opacity: 0.35;
}
.code-block-wrapper pre {

View File

@ -167,6 +167,234 @@
.toggle-switch input:checked + .switch-slider::before {
transform: translateX(20px);
}
/* ========================================= */
/* 移动端面板入口 */
/* ========================================= */
.mobile-panel-trigger {
position: fixed;
top: 16px;
left: 16px;
z-index: 1500;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 10px;
pointer-events: none;
opacity: 1;
transition: opacity 0.2s ease;
}
.mobile-panel-trigger.is-hidden {
opacity: 0;
}
.mobile-panel-fab {
width: 48px;
height: 48px;
border: none;
padding: 6px;
border-radius: 12px;
background: transparent;
color: var(--claude-accent);
cursor: pointer;
pointer-events: auto;
display: flex;
align-items: center;
justify-content: center;
box-shadow: none;
}
.mobile-panel-fab img {
width: 32px;
height: 32px;
}
.mobile-panel-menu {
pointer-events: auto;
display: grid;
grid-auto-flow: column;
gap: 8px;
padding: 8px 10px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.35);
backdrop-filter: blur(10px);
box-shadow: 0 12px 30px rgba(38, 28, 18, 0.15);
}
.mobile-menu-btn {
width: 44px;
height: 44px;
border-radius: 50%;
border: none;
background: transparent;
color: var(--claude-text);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.mobile-menu-btn img,
.mobile-menu-svg {
width: 26px;
height: 26px;
display: block;
}
.mobile-menu-btn--conversation .mobile-menu-svg {
width: 30px;
height: 30px;
transition: color 0.2s ease;
}
.mobile-panel-menu-enter-active,
.mobile-panel-menu-leave-active {
transition: opacity 0.2s ease, transform 0.2s ease;
}
.mobile-panel-menu-enter-from,
.mobile-panel-menu-leave-to {
opacity: 0;
transform: translateY(-8px) scale(0.95);
}
/* ========================================= */
/* 移动端半覆盖面板 */
/* ========================================= */
.mobile-panel-overlay {
position: fixed;
inset: 0;
background: rgba(16, 11, 7, 0.45);
backdrop-filter: blur(6px);
z-index: 1400;
display: flex;
align-items: stretch;
padding: 0;
}
.mobile-panel-overlay--left {
justify-content: flex-start;
}
.mobile-panel-overlay--right {
justify-content: flex-end;
}
.mobile-panel-sheet {
width: 100%;
height: 100%;
background: var(--claude-left-rail);
border-radius: 0;
box-shadow: none;
padding: 0;
position: relative;
overflow: hidden;
display: flex;
flex-direction: column;
}
.mobile-panel-sheet--conversation,
.mobile-panel-sheet--workspace {
background: var(--claude-left-rail);
}
.mobile-panel-sheet--focus {
background: var(--claude-panel);
}
.mobile-overlay-close {
position: absolute;
top: 10px;
right: 10px;
width: 32px;
height: 32px;
border-radius: 16px;
border: none;
background: rgba(0, 0, 0, 0.08);
color: var(--claude-text);
font-size: 18px;
cursor: pointer;
z-index: 5;
}
.mobile-overlay-content {
margin-top: 0;
flex: 1;
width: 100%;
height: 100%;
overflow: hidden;
}
.mobile-panel-sheet .conversation-sidebar,
.mobile-panel-sheet .sidebar,
.mobile-panel-sheet .right-sidebar {
width: 100% !important;
max-width: 100%;
min-width: 0;
height: 100%;
border: none;
border-radius: 0;
}
.mobile-panel-sheet .conversation-sidebar {
height: 100%;
}
@media (max-width: 768px) {
.mobile-panel-sheet .left-sidebar,
.mobile-panel-sheet .right-sidebar {
display: flex !important;
flex-direction: column;
}
.mobile-panel-sheet .conversation-sidebar {
position: relative;
transform: none !important;
box-shadow: none;
}
.mobile-panel-sheet .conversation-sidebar.collapsed {
transform: none !important;
}
.mobile-panel-sheet .sidebar-header {
position: static;
border: none;
padding: 12px 16px 0;
}
.mobile-panel-sheet .focused-files {
padding-top: 8px;
}
}
.mobile-panel-overlay-enter-active,
.mobile-panel-overlay-leave-active {
transition: opacity 0.25s ease;
}
.mobile-panel-overlay-enter-from,
.mobile-panel-overlay-leave-to {
opacity: 0;
}
.mobile-panel-overlay .mobile-panel-sheet {
transform: translateX(0);
transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-panel-overlay--left.mobile-panel-overlay-enter-from .mobile-panel-sheet,
.mobile-panel-overlay--left.mobile-panel-overlay-leave-to .mobile-panel-sheet {
transform: translateX(-28px);
}
.mobile-panel-overlay--right.mobile-panel-overlay-enter-from .mobile-panel-sheet,
.mobile-panel-overlay--right.mobile-panel-overlay-leave-to .mobile-panel-sheet {
transform: translateX(28px);
}
.confirm-overlay {
position: fixed;
inset: 0;

View File

@ -1,9 +1,47 @@
/* 聚焦文件 */
.focused-files {
padding: 16px;
/* 聚焦文件面板 */
.sidebar.right-sidebar {
display: flex;
flex-direction: column;
}
o-files {
.sidebar.right-sidebar .sidebar-header {
padding: 20px 20px 8px;
border-bottom: 1px solid var(--claude-border);
background: var(--claude-panel);
position: sticky;
top: 0;
z-index: 5;
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.sidebar.right-sidebar .sidebar-header h3 {
font-size: 15px;
font-weight: 600;
color: var(--claude-text);
margin: 0;
}
.focused-files {
flex: 1 1 auto;
padding: 12px 20px 20px;
overflow-y: auto;
}
.focus-close-btn {
width: 32px;
height: 32px;
border: none;
border-radius: 16px;
background: rgba(0, 0, 0, 0.08);
color: var(--claude-text);
font-size: 20px;
cursor: pointer;
}
.no-files {
text-align: center;
color: var(--claude-text-secondary);
padding: 60px 20px;
@ -47,7 +85,7 @@ o-files {
.file-content {
max-height: 320px;
overflow-y: auto;
background: #1e1e1e;
background: #ffffff;
}
.file-content pre {
@ -59,5 +97,5 @@ o-files {
font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
font-size: 13px;
line-height: 1.5;
color: #aed581;
color: #1f2227;
}