chore: permissions ux

This commit is contained in:
Adam 2025-12-27 20:40:25 -06:00
commit 1b5bf32ce5
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
4 changed files with 56 additions and 10 deletions

View file

@ -328,6 +328,12 @@ export function SessionTurn(
}
})
createEffect(() => {
if (permissionParts().length > 0) {
autoScroll.forceScrollToBottom()
}
})
createEffect(() => {
if (working() || !isLastUserMessage()) return

View file

@ -92,7 +92,6 @@ export type ToastVariant = "default" | "success" | "error" | "loading"
export interface ToastAction {
label: string
onClick: "dismiss" | (() => void)
dismissAfter?: boolean
}
export interface ToastOptions {
@ -132,10 +131,8 @@ export function showToast(options: ToastOptions | string) {
onClick={() => {
if (typeof action.onClick === "function") {
action.onClick()
if (action.dismissAfter) toaster.dismiss(props.toastId)
} else {
toaster.dismiss(props.toastId)
}
toaster.dismiss(props.toastId)
}}
>
{action.label}

View file

@ -35,6 +35,22 @@ export function createAutoScroll(options: AutoScrollOptions) {
})
}
function forceScrollToBottom() {
if (!scrollRef) return
setStore("userScrolled", false)
isAutoScrolling = true
if (autoScrollTimeout) clearTimeout(autoScrollTimeout)
autoScrollTimeout = setTimeout(() => {
isAutoScrolling = false
}, 1000)
scrollRef.scrollTo({
top: scrollRef.scrollHeight,
behavior: "smooth",
})
}
function handleScroll() {
if (!scrollRef) return
@ -161,6 +177,7 @@ export function createAutoScroll(options: AutoScrollOptions) {
handleScroll,
handleInteraction,
scrollToBottom,
forceScrollToBottom,
userScrolled: () => store.userScrolled,
}
}