fix(mobile): navigation back behavior, scroll button position

- New Chat → Chat uses replaceState so back skips new chat screen
- Active tab persisted to sessionStorage, restored on back navigation
- Scroll-to-bottom button positioned relative to footer (not hardcoded)
- overscroll-behavior: none to prevent iOS rubber-band

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kuannnn
2026-03-29 09:50:38 +08:00
parent 10c38ad2e4
commit e2bf3512c9
4 changed files with 28 additions and 14 deletions
+7 -3
View File
@@ -36,7 +36,7 @@ function persistView(view: View) {
sessionStorage.setItem('currentView', JSON.stringify(view));
}
function navigateTo(view: View) {
function navigateTo(view: View, replace = false) {
persistView(view);
let url = '/';
if (view.name === 'chat' && view.sessionId) {
@@ -45,7 +45,11 @@ function navigateTo(view: View) {
} else if (view.name === 'settings') {
url = '/?view=settings';
}
window.history.pushState({ view }, '', url);
if (replace) {
window.history.replaceState({ view }, '', url);
} else {
window.history.pushState({ view }, '', url);
}
}
export function App() {
@@ -225,7 +229,7 @@ export function App() {
// Navigate to chat view with cwd — ChatView will pick up globals and send the prompt
const chatCwd = view.name === 'newchat' ? view.cwd : undefined;
const v: View = { name: 'chat', cwd: chatCwd, initialPrompt: options.prompt, adapter: options.adapter };
navigateTo(v);
navigateTo(v, true); // replace newchat → chat so back goes to session list
setView(v);
}, [view]);