feat: add viewport height tracking and improve scroll behavior on mobile

This commit is contained in:
weishu
2025-12-17 21:44:12 +08:00
parent 1b99c9422b
commit 3c7387f684
3 changed files with 36 additions and 19 deletions
+18 -16
View File
@@ -106,7 +106,7 @@ export function SessionChat(props: {
</div>
) : null}
<div ref={scrollRef} className="flex-1 overflow-y-auto">
<div ref={scrollRef} className="relative flex min-h-0 flex-1 flex-col overflow-y-auto">
<div className="mx-auto w-full max-w-[720px] p-3">
{props.messagesWarning ? (
<div className="mb-3 rounded-md bg-amber-500/10 p-2 text-xs">
@@ -183,22 +183,24 @@ export function SessionChat(props: {
</>
)}
</div>
</div>
<ChatInput
disabled={props.isSending || controlsDisabled}
onSend={props.onSend}
sessionId={props.session.id}
permissionMode={props.session.permissionMode}
modelMode={props.session.modelMode}
active={props.session.active}
thinking={props.session.thinking}
agentState={props.session.agentState}
contextSize={reduced.latestUsage?.contextSize}
onPermissionModeChange={handlePermissionModeChange}
onModelModeChange={handleModelModeChange}
onAbort={handleAbort}
/>
<div className="sticky bottom-0 z-10 mt-auto w-full overflow-visible">
<ChatInput
disabled={props.isSending || controlsDisabled}
onSend={props.onSend}
sessionId={props.session.id}
permissionMode={props.session.permissionMode}
modelMode={props.session.modelMode}
active={props.session.active}
thinking={props.session.thinking}
agentState={props.session.agentState}
contextSize={reduced.latestUsage?.contextSize}
onPermissionModeChange={handlePermissionModeChange}
onModelModeChange={handleModelModeChange}
onAbort={handleAbort}
/>
</div>
</div>
</div>
)
}