mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix: layout badness
This commit is contained in:
parent
20e3a74bad
commit
89219a77f7
2 changed files with 5 additions and 13 deletions
|
|
@ -27,7 +27,8 @@
|
|||
align-items: flex-start;
|
||||
align-self: stretch;
|
||||
min-width: 0;
|
||||
gap: clamp(8px, calc(42px - var(--scroll-y) * 0.48), 42px);
|
||||
gap: 42px;
|
||||
/* gap: clamp(8px, calc(42px - var(--scroll-y) * 0.48), 42px); */
|
||||
overflow-anchor: none;
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +60,7 @@
|
|||
}
|
||||
|
||||
[data-slot="session-turn-message-content"] {
|
||||
margin-top: -24px;
|
||||
margin-top: -18px;
|
||||
}
|
||||
|
||||
[data-slot="session-turn-message-title"] {
|
||||
|
|
|
|||
|
|
@ -57,17 +57,12 @@ export function SessionTurn(
|
|||
userScrolled: false,
|
||||
stickyHeaderHeight: 0,
|
||||
scrollY: 0,
|
||||
autoScrolling: false,
|
||||
})
|
||||
|
||||
function handleScroll() {
|
||||
if (!scrollRef) return
|
||||
if (state.autoScrolling) return
|
||||
const { scrollTop, scrollHeight, clientHeight } = scrollRef
|
||||
const scrollRoom = scrollHeight - clientHeight
|
||||
if (scrollRoom > 100) {
|
||||
setState("scrollY", scrollTop)
|
||||
}
|
||||
setState("scrollY", scrollTop)
|
||||
const atBottom = scrollHeight - scrollTop - clientHeight < 50
|
||||
if (!atBottom && working()) {
|
||||
setState("userScrolled", true)
|
||||
|
|
@ -81,13 +76,9 @@ export function SessionTurn(
|
|||
}
|
||||
|
||||
function scrollToBottom() {
|
||||
if (!scrollRef || state.userScrolled || !working() || state.autoScrolling) return
|
||||
setState("autoScrolling", true)
|
||||
if (!scrollRef || state.userScrolled || !working()) return
|
||||
requestAnimationFrame(() => {
|
||||
scrollRef?.scrollTo({ top: scrollRef.scrollHeight, behavior: "instant" })
|
||||
requestAnimationFrame(() => {
|
||||
setState("autoScrolling", false)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue