refactor(ui): extract switch controls logic into reusable hook and terminal restoration utility

Extracts duplicated exit/switch confirmation handling from CodexDisplay and RemoteModeDisplay into a custom useSwitchControls hook. Centralizes terminal state restoration (raw mode, keyboard protocol cleanup) into a restoreTerminalState utility function used across codex modules. Improves code reusability and maintainability.
This commit is contained in:
weishu
2025-12-22 23:12:24 +08:00
parent 360e3a9919
commit 93810689ad
10 changed files with 316 additions and 139 deletions
+2 -1
View File
@@ -64,7 +64,8 @@
"ts-node": "^10",
"tsx": "^4.20.6",
"typescript": "^5",
"vitest": "^3.2.4"
"vitest": "^3.2.4",
"react-test-renderer": "^19.2.0"
},
"resolutions": {
"whatwg-url": "14.2.0",