feat(ui): revert indicator with undo/redo, message list, and attachment restore (#1279)

* feat(ui): revert indicator with undo/redo, message list, and attachment restore

Add bidirectional undo/redo with redo stack navigation and expandable
revert indicator in StatusRow. List reverted messages with inline
revert/fork actions. Restore file attachments on revert.

- Add revert indicator with count, expandable popover, per-button spinner
- Restore file/image attachments when reverting to a message
- Clear previous attachments on revert when target has none
- Restore-all bypasses redo stack for direct unrevert
- Survive popover close/reopen without losing loading state
- Fix flash when sending message after revert
- Fix count disappearing on browser refresh
- Remove dead code (undoStack, getRevertHistory, fork-from-here)
- Fix toast grammar (Undid -> Reverted, Redid -> Redone)
- Add i18n keys for revert popover across all locales

* fix(ui): Greptile review fixes and i18n for revert toasts

- Fix handleSlashUndo toast always showing [No text] (moved getSyncParts before revertToMessage)
- Add inputStore rollback in revertToMessage catch (restore attachments + text on API failure)
- Change portal ID to per-session (prevent multi-session collisions)
- Add i18n keys for undo/redo/restored toasts across all 7 locales
- Use formatMessage in store for localized toast strings

* fix(ui): add missing sessionId to click-outside effect deps

* fix(ui): remove unused sessionActions import in ChatMessage

* fix(ui): derive revert dock from session state

---------

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
youfch
2026-05-16 16:44:37 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent 947f725976
commit 9c71119835
13 changed files with 371 additions and 47 deletions
+13
View File
@@ -1402,6 +1402,19 @@ export const dict = {
'chat.statusRow.tasksTitle': 'Tasks',
'chat.statusRow.summary.activeLeft': '{active} active · {left} left',
'chat.statusRow.aborted': 'Aborted',
'chat.revertIndicator.redo': 'Redo',
'chat.revertIndicator.redoAria': 'Redo — restore reverted messages',
'chat.revertPopover.title': 'Reverted',
'chat.revertPopover.noTextContent': 'No text content',
'chat.revertPopover.forkFromHere': 'Fork from here',
'chat.revertPopover.forkFromMessage': 'Fork from this message',
'chat.revertPopover.restoreAll': 'Restore all',
'chat.revertPopover.restore': 'Restore',
'chat.revertPopover.revert': 'Revert',
'chat.revertPopover.fork': 'Fork',
'chat.revert.toast.undo': 'Reverted to {preview}',
'chat.revert.toast.redo': 'Redone',
'chat.revert.toast.restored': 'Restored all messages',
'chat.errorBoundary.title': 'Chat Error',
'chat.errorBoundary.description': 'The chat interface encountered an error. This might be due to a temporary network issue or corrupted message data.',
'chat.errorBoundary.sessionLabel': 'Session',
+13
View File
@@ -1368,6 +1368,19 @@ export const dict: Record<I18nKey, string> = {
"chat.statusRow.tasksTitle": "Tareas",
"chat.statusRow.summary.activeLeft": "{active} activas · {left} restantes",
"chat.statusRow.aborted": "Interrumpido",
"chat.revertIndicator.redo": "Rehacer",
"chat.revertIndicator.redoAria": "Rehacer — restaurar mensajes revertidos",
"chat.revertPopover.title": "Revertidos",
"chat.revertPopover.noTextContent": "Sin contenido de texto",
"chat.revertPopover.forkFromHere": "Bifurcar desde aquí",
"chat.revertPopover.forkFromMessage": "Bifurcar desde este mensaje",
"chat.revertPopover.restoreAll": "Restaurar todo",
"chat.revertPopover.restore": "Restaurar",
"chat.revertPopover.revert": "Revertir",
"chat.revertPopover.fork": "Bifurcar",
"chat.revert.toast.undo": "Revertido a {preview}",
"chat.revert.toast.redo": "Rehecho",
"chat.revert.toast.restored": "Todos los mensajes restaurados",
"chat.errorBoundary.title": "Error en la conversación",
"chat.errorBoundary.description": "La interfaz de la conversación encontró un error. Esto podría deberse a un problema de red temporal o a datos de mensaje corruptos.",
"chat.errorBoundary.sessionLabel": "Sesión",
+13
View File
@@ -1404,6 +1404,19 @@ export const dict: Record<I18nKey, string> = {
'chat.statusRow.tasksTitle': '작업',
'chat.statusRow.summary.activeLeft': '{active}개 활성 · {left}개 남음',
'chat.statusRow.aborted': '중단됨',
'chat.revertIndicator.redo': '다시 실행',
'chat.revertIndicator.redoAria': '다시 실행 — 되돌린 메시지 복원',
'chat.revertPopover.title': '되돌림',
'chat.revertPopover.noTextContent': '텍스트 없음',
'chat.revertPopover.forkFromHere': '여기서 분기',
'chat.revertPopover.forkFromMessage': '이 메시지에서 분기',
'chat.revertPopover.restoreAll': '모두 복원',
'chat.revertPopover.restore': '복원',
'chat.revertPopover.revert': '되돌리기',
'chat.revertPopover.fork': '분기',
'chat.revert.toast.undo': '{preview}(으)로 되돌림',
'chat.revert.toast.redo': '다시 실행',
'chat.revert.toast.restored': '모든 메시지 복원됨',
'chat.errorBoundary.title': '채팅 오류',
'chat.errorBoundary.description': '채팅 인터페이스에서 오류가 발생했습니다. 일시적인 네트워크 이슈 또는 손상된 메시지 데이터 때문일 수 있습니다.',
'chat.errorBoundary.sessionLabel': '세션',
+13
View File
@@ -459,6 +459,19 @@ export const dict: Record<I18nKey, string> = {
'chat.statusRow.tasksTitle': 'Zadania',
'chat.statusRow.summary.activeLeft': '{active} aktywne · {left} pozostało',
'chat.statusRow.aborted': 'Przerwane',
'chat.revertIndicator.redo': 'Ponów',
'chat.revertIndicator.redoAria': 'Ponów — przywróć cofnięte wiadomości',
'chat.revertPopover.title': 'Cofnięte',
'chat.revertPopover.noTextContent': 'Brak treści tekstowej',
'chat.revertPopover.forkFromHere': 'Rozgałęź stąd',
'chat.revertPopover.forkFromMessage': 'Rozgałęź od tej wiadomości',
'chat.revertPopover.restoreAll': 'Przywróć wszystkie',
'chat.revertPopover.restore': 'Przywróć',
'chat.revertPopover.revert': 'Cofnij',
'chat.revertPopover.fork': 'Rozgałęź',
'chat.revert.toast.undo': 'Cofnięte do {preview}',
'chat.revert.toast.redo': 'Ponowione',
'chat.revert.toast.restored': 'Przywrócono wszystkie wiadomości',
'chat.errorBoundary.title': 'Błąd Czatu',
'chat.errorBoundary.description': 'Interfejs czatu napotkał błąd. Może to być spowodowane tymczasowym problemem sieciowym lub uszkodzonymi danymi wiadomości.',
'chat.errorBoundary.sessionLabel': 'Sesja',
@@ -1368,6 +1368,19 @@ export const dict: Record<I18nKey, string> = {
"chat.statusRow.tasksTitle": "Tarefas",
"chat.statusRow.summary.activeLeft": "{active} ativas · {left} restantes",
"chat.statusRow.aborted": "Interrompido",
"chat.revertIndicator.redo": "Refazer",
"chat.revertIndicator.redoAria": "Refazer — restaurar mensagens revertidas",
"chat.revertPopover.title": "Revertidas",
"chat.revertPopover.noTextContent": "Sem conteúdo de texto",
"chat.revertPopover.forkFromHere": "Criar ramificação aqui",
"chat.revertPopover.forkFromMessage": "Criar ramificação desta mensagem",
"chat.revertPopover.restoreAll": "Restaurar todas",
"chat.revertPopover.restore": "Restaurar",
"chat.revertPopover.revert": "Reverter",
"chat.revertPopover.fork": "Bifurcar",
"chat.revert.toast.undo": "Revertido para {preview}",
"chat.revert.toast.redo": "Refeito",
"chat.revert.toast.restored": "Todas as mensagens restauradas",
"chat.errorBoundary.title": "Erro na conversa",
"chat.errorBoundary.description": "A interface da conversa encontrou um erro. Isso pode ter sido causado por um problema temporário de rede ou por dados de mensagem corrompidos.",
"chat.errorBoundary.sessionLabel": "Sessão",
+13
View File
@@ -1368,6 +1368,19 @@ export const dict: Record<I18nKey, string> = {
"chat.statusRow.tasksTitle": "завдання",
"chat.statusRow.summary.activeLeft": "Активних: {active} · залишилось: {left}",
"chat.statusRow.aborted": "Перервано",
"chat.revertIndicator.redo": "Повторити",
"chat.revertIndicator.redoAria": "Повторити — відновити відкочені повідомлення",
"chat.revertPopover.title": "Відкочено",
"chat.revertPopover.noTextContent": "Немає текстового змісту",
"chat.revertPopover.forkFromHere": "Розгалуження тут",
"chat.revertPopover.forkFromMessage": "Розгалуження від цього повідомлення",
"chat.revertPopover.restoreAll": "Відновити всі",
"chat.revertPopover.restore": "Відновити",
"chat.revertPopover.revert": "Відкотити",
"chat.revertPopover.fork": "Розгалуження",
"chat.revert.toast.undo": "Відкочено до {preview}",
"chat.revert.toast.redo": "Повторено",
"chat.revert.toast.restored": "Всі повідомлення відновлено",
"chat.errorBoundary.title": "Помилка чату",
"chat.errorBoundary.description": "В інтерфейсі чату сталася помилка. Причиною може бути тимчасова проблема з мережею або пошкоджені дані повідомлення.",
"chat.errorBoundary.sessionLabel": "Сесія",
@@ -1368,6 +1368,19 @@ export const dict: Record<I18nKey, string> = {
'chat.statusRow.tasksTitle': '任务',
'chat.statusRow.summary.activeLeft': '{active} 个活跃 · 剩余 {left} 个',
'chat.statusRow.aborted': '已中止',
'chat.revertIndicator.redo': '重做',
'chat.revertIndicator.redoAria': '重做 — 恢复已撤回的消息',
'chat.revertPopover.title': '已撤回',
'chat.revertPopover.noTextContent': '无文本内容',
'chat.revertPopover.forkFromHere': '从此处分支',
'chat.revertPopover.forkFromMessage': '从此消息分支',
'chat.revertPopover.restoreAll': '恢复全部',
'chat.revertPopover.restore': '恢复',
'chat.revertPopover.revert': '撤回',
'chat.revertPopover.fork': '分叉',
'chat.revert.toast.undo': '已撤回至 {preview}',
'chat.revert.toast.redo': '已重做',
'chat.revert.toast.restored': '已恢复全部消息',
'chat.errorBoundary.title': '聊天错误',
'chat.errorBoundary.description': '聊天界面发生错误,可能是临时网络问题或消息数据损坏导致。',
'chat.errorBoundary.sessionLabel': '会话',