Improve camera drawer UX: layout, device switching, default selection

- Grid layout for source controls: camera + switch on top row (equal
  width), upload full-width below; preview area uses aspect-ratio 4/3
- "使用摄像头" no longer changes label text; uses is-active highlight only
- "切换摄像头" now actually cycles through real video devices via
  enumerateDevices(); falls back to facingMode flip on mobile/single-cam;
  button disabled until camera is active and ≥2 devices are detected
- Default-selects first sample image when drawer opens so "拍摄完成"
  is immediately pressable without requiring a capture/upload first
- Fix: camera prompt text is now locked to CAMERA_STATE_PROMPTS[state]
  and no longer overwritten by assistant replies

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Xin Wang
2026-06-02 10:43:18 +08:00
parent 6cf31c7062
commit 85baf5698e
3 changed files with 70 additions and 15 deletions

View File

@@ -120,11 +120,13 @@
id="camera-flip-btn"
class="btn btn--ghost camera-drawer__source"
type="button"
hidden
disabled
>
切换摄像头
</button>
<label class="btn btn--ghost camera-drawer__source">
<label
class="btn btn--ghost camera-drawer__source camera-drawer__source--upload"
>
上传图片
<input
id="camera-upload"