refactor: 重构视频面板 UI,情景选择改为卡片网格,控制按钮改为 SVG 图标

- 情景选择从 ChatPanel header 下拉菜单迁移至视频面板下方卡片网格
- 摄像头/麦克风按钮改为圆形 SVG 图标按钮
- 识别/中断/停止按钮改为药丸形状 SVG 图标按钮
- 设备选择器改为水平布局,优化空间利用
- 移除 ChatPanel 空状态中重复的情景卡片
- .gitignore 忽略 .claudian/ 和笔记目录
This commit is contained in:
2026-06-21 22:58:02 +08:00
parent 492fb06c08
commit 949a707e0f
4 changed files with 306 additions and 58 deletions

View File

@@ -401,6 +401,27 @@ function AppContent() {
)}
</div>
{/* ---- 情景选择卡片网格(视频下方) ---- */}
<div className="scenario-picker">
<div className="scenario-picker__title">
<span className="scenario-picker__label">{tr("settings.scenario")}</span>
<span className="scenario-picker__active">{activeScenario.icon} {activeScenario.nameKey ? tr(activeScenario.nameKey) : activeScenario.name}</span>
</div>
<div className="scenario-picker__grid">
{allScenarios.map((sc) => (
<button
key={sc.id}
className={`scenario-picker__card ${config.scenario === sc.id ? "scenario-picker__card--active" : ""}`}
onClick={() => handleSelectScenario(sc.id)}
title={sc.description ? sc.description : sc.descKey ? tr(sc.descKey) : sc.name}
>
<span className="scenario-picker__card-icon">{sc.icon}</span>
<span className="scenario-picker__card-name">{sc.nameKey ? tr(sc.nameKey) : sc.name}</span>
</button>
))}
</div>
</div>
{/* 视频下方控制区(三层结构) */}
<div className="video-controls">
{!isConnected ? (
@@ -415,33 +436,68 @@ function AppContent() {
{/* 视频通话态:核心控制工具栏 */}
<div className="video-controls__toolbar">
<button
className={`btn btn--ctrl ${isCameraOn ? "btn--ctrl-on" : "btn--ctrl-off"}`}
className={`btn-ctrl-round ${isCameraOn ? "btn-ctrl-round--on" : "btn-ctrl-round--off"}`}
onClick={toggleCamera}
title={isCameraOn ? tr("controls.cameraOff") : tr("controls.cameraOn")}
>
📷
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
{isCameraOn ? (
<>
<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" />
<circle cx="12" cy="13" r="4" />
</>
) : (
<>
<path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10" />
<line x1="1" y1="1" x2="23" y2="23" />
</>
)}
</svg>
</button>
<button
className={`btn btn--ctrl ${isMicOn ? "btn--ctrl-on" : "btn--ctrl-off"} ${isSpeaking ? "btn--speaking" : ""}`}
className={`btn-ctrl-round ${isMicOn ? "btn-ctrl-round--on" : "btn-ctrl-round--off"} ${isSpeaking ? "btn-ctrl-round--speaking" : ""}`}
onClick={toggleMic}
title={isMicOn ? tr("controls.micOff") : tr("controls.micOn")}
>
🎤
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
{isMicOn ? (
<>
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" />
<path d="M19 10v2a7 7 0 0 1-14 0v-2" />
<line x1="12" y1="19" x2="12" y2="23" />
<line x1="8" y1="23" x2="16" y2="23" />
</>
) : (
<>
<line x1="1" y1="1" x2="23" y2="23" />
<path d="M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6" />
<path d="M17 16.95A7 7 0 0 1 5 12v-2m14 0v2c0 .76-.12 1.49-.34 2.17" />
<line x1="12" y1="19" x2="12" y2="23" />
<line x1="8" y1="23" x2="16" y2="23" />
</>
)}
</svg>
</button>
{/* 识别画面按钮 */}
<button
className="btn--recognize"
className="btn-ctrl-pill btn-ctrl-pill--recognize"
onClick={handleRecognize}
disabled={isProcessing}
>
🔍 {tr("controls.recognize")}
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
</svg>
{tr("controls.recognize")}
</button>
{isProcessing && (
<button className="btn btn--warning" onClick={interrupt}>
<button className="btn-ctrl-pill btn-ctrl-pill--interrupt" onClick={interrupt}>
{tr("controls.interrupt")}
</button>
)}
<button className="btn btn--danger" onClick={stopVideo}>
<button className="btn-ctrl-pill btn-ctrl-pill--stop" onClick={stopVideo}>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<rect x="6" y="6" width="12" height="12" rx="2" />
</svg>
{tr("controls.stopVideo")}
</button>
</div>
@@ -502,18 +558,6 @@ function AppContent() {
<div className="chat-panel-header">
<span>{tr("chat.title")}</span>
<div className="chat-panel-header__right">
<select
className="scenario-selector"
value={activeScenario.id}
onChange={(e) => handleSelectScenario(e.target.value)}
title={tr("settings.scenario")}
>
{allScenarios.map((sc) => (
<option key={sc.id} value={sc.id}>
{sc.icon} {sc.nameKey ? tr(sc.nameKey) : sc.name}
</option>
))}
</select>
{isConnected && stats.queryCount > 0 && (
<span className="chat-panel-header__stats">
{stats.queryCount} {tr("statusbar.recognitions")}