chore: permissions ux
This commit is contained in:
parent
2e972b3fdc
commit
1b5bf32ce5
4 changed files with 56 additions and 10 deletions
|
|
@ -328,6 +328,12 @@ export function SessionTurn(
|
|||
}
|
||||
})
|
||||
|
||||
createEffect(() => {
|
||||
if (permissionParts().length > 0) {
|
||||
autoScroll.forceScrollToBottom()
|
||||
}
|
||||
})
|
||||
|
||||
createEffect(() => {
|
||||
if (working() || !isLastUserMessage()) return
|
||||
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue