Commit 2866956
authored
feat(chat): refine compact history controls and selection mode (#1596)
* Refine compact history controls
Move compact history visibility to a persistent handle while the export tool toggles the history action controls.
Add separate controls state, updated geometry metadata, enlarged handle styling, localized labels, and focused tests for persisted/open states.
* Finalize compact history selection mode
Default compact history to open when no preference is stored and preserve history action controls across visibility toggles.
Require the action controls to be visible for history selection, clear selected messages when the controls hide, and document the final compact history contract.
* Remove superseded compact chat design notes
Drop the older compact chat geometry and home compact design notes now that the consolidated compact chat mode design document is present.
* fix(chat): tighten compact history interaction contracts
修正紧凑历史消息在操作栏隐藏时仍暴露可选按钮语义的问题,仅在 controlsOpen 且消息可选时提供 role、aria-pressed 和可聚焦状态。
将常驻历史展开按钮纳入 compact input island,避免点击该按钮触发输入区强制收起。
同步静态 CSS 契约测试到新的常驻 handle 和 controls-collapsed 合约。
验证:
- bash build_frontend.sh
- .venv/bin/pytest tests/unit/test_react_chat_window_static.py -q
- git diff --check
* test(chat): align compact history readonly bubble state
同步默认历史面板测试到新的 read-only bubble 语义:操作栏关闭时不暴露按钮角色和 aria-pressed,打开操作栏后再恢复可选择按钮语义。
验证:
- npm test -- App.test.tsx
- .venv/bin/pytest tests/unit/test_react_chat_window_static.py -q
- bash build_frontend.sh
- git diff --check
* fix(chat): refine compact history handle
将紧凑聊天历史常驻展开按钮下移到聊天框拖拽条附近,并改成与原拖拽条一致的青蓝线条样式。
移除中间小三角视觉,改为一条中间粗、两侧细且渐隐的连续线;不增加背景、边框或阴影,不改变历史面板和展开内容结构。
同步静态 CSS 契约测试,锁定 handle 使用 compact surface top 的轻微上偏移定位。
验证:
- .venv/bin/pytest tests/unit/test_react_chat_window_static.py -q
- bash build_frontend.sh
- git diff --check
* fix(chat): soften compact history handle line
优化紧凑聊天历史常驻 handle 的线条样式,参考原聊天框拖拽条的颜色、渐变和 3px 线条厚度。
隐藏中间小三角,改为单条两侧更细、中间保留厚度的平滑线;未展开历史时显示短线,展开后恢复满长度。
不改变历史面板、操作栏、点击区域和展开内容结构;同步静态 CSS 契约测试。
验证:
- .venv/bin/pytest tests/unit/test_react_chat_window_static.py -q
- bash build_frontend.sh
- git diff --check
* fix(chat): toggle history handle on press
将紧凑聊天历史常驻 handle 改为 pointer down 即切换打开/关闭,短按和长按都不需要等松开。
按下事件会 preventDefault 并 stopPropagation,避免未来整块聊天框拖拽时长按 handle 被外层拖拽逻辑接管;随后产生的 click 会被吞掉,避免二次切换。
保留键盘和普通 click 兜底路径,并补充 App 测试覆盖按下即切换、松开不反向切换、事件不冒泡。
验证:
- npm test -- --run App.test.tsx
- .venv/bin/pytest tests/unit/test_react_chat_window_static.py -q
- bash build_frontend.sh
- git diff --check
* fix(chat): allow empty compact input collapse with history
移除 compactExportHistoryOpen 对 collapseCompactInputIfEmpty 的全局早退,避免 first-run 默认显示历史时阻止空输入回到 subtitle。
保留焦点仍在输入壳、历史面板或 history handle 内时不折叠的判断;将 blur 测试改回无持久化记录场景,覆盖默认历史打开状态。
验证:
- npm test -- --run App.test.tsx
- .venv/bin/pytest tests/unit/test_react_chat_window_static.py -q
- bash build_frontend.sh
- git diff --check
* test(chat): assert history handle visible behavior
将紧凑历史 handle 的按下测试从原生 pointerdown 冒泡细节,改为断言产品可见行为。
按下 handle 后继续验证历史展开、持久化状态写入,并新增 app-shell 仍保持 input 状态的断言,避免测试依赖 DOM 传播实现细节。
验证:
- npm test -- --run App.test.tsx
- .venv/bin/pytest tests/unit/test_react_chat_window_static.py -q
- bash build_frontend.sh
- git diff --check1 parent 93c4562 commit 2866956
16 files changed
Lines changed: 364 additions & 1736 deletions
File tree
- docs/design
- frontend/react-neko-chat/src
- static/locales
- tests/unit
This file was deleted.
Lines changed: 32 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
85 | | - | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
93 | | - | |
| 97 | + | |
| 98 | + | |
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
| |||
174 | 179 | | |
175 | 180 | | |
176 | 181 | | |
177 | | - | |
| 182 | + | |
178 | 183 | | |
179 | 184 | | |
180 | 185 | | |
| |||
281 | 286 | | |
282 | 287 | | |
283 | 288 | | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
288 | 294 | | |
289 | 295 | | |
290 | 296 | | |
| |||
342 | 348 | | |
343 | 349 | | |
344 | 350 | | |
345 | | - | |
| 351 | + | |
346 | 352 | | |
347 | 353 | | |
348 | 354 | | |
| |||
352 | 358 | | |
353 | 359 | | |
354 | 360 | | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
359 | 371 | | |
360 | 372 | | |
361 | 373 | | |
| |||
512 | 524 | | |
513 | 525 | | |
514 | 526 | | |
515 | | - | |
| 527 | + | |
516 | 528 | | |
517 | 529 | | |
518 | 530 | | |
| |||
551 | 563 | | |
552 | 564 | | |
553 | 565 | | |
554 | | - | |
| 566 | + | |
555 | 567 | | |
556 | | - | |
557 | | - | |
558 | | - | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
559 | 574 | | |
560 | 575 | | |
561 | 576 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
353 | | - | |
| 353 | + | |
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
374 | | - | |
375 | | - | |
376 | 374 | | |
377 | 375 | | |
378 | 376 | | |
| |||
381 | 379 | | |
382 | 380 | | |
383 | 381 | | |
384 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
385 | 385 | | |
386 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
387 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
388 | 399 | | |
389 | | - | |
390 | 400 | | |
391 | | - | |
| 401 | + | |
392 | 402 | | |
393 | 403 | | |
| 404 | + | |
394 | 405 | | |
395 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
396 | 419 | | |
397 | 420 | | |
398 | 421 | | |
| |||
412 | 435 | | |
413 | 436 | | |
414 | 437 | | |
415 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
416 | 474 | | |
417 | 475 | | |
418 | 476 | | |
| |||
582 | 640 | | |
583 | 641 | | |
584 | 642 | | |
585 | | - | |
| 643 | + | |
586 | 644 | | |
587 | 645 | | |
588 | | - | |
| 646 | + | |
589 | 647 | | |
590 | 648 | | |
591 | 649 | | |
| |||
627 | 685 | | |
628 | 686 | | |
629 | 687 | | |
630 | | - | |
631 | 688 | | |
632 | 689 | | |
633 | 690 | | |
634 | 691 | | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
635 | 700 | | |
636 | 701 | | |
637 | 702 | | |
| |||
1757 | 1822 | | |
1758 | 1823 | | |
1759 | 1824 | | |
1760 | | - | |
| 1825 | + | |
1761 | 1826 | | |
1762 | 1827 | | |
1763 | 1828 | | |
| |||
0 commit comments