mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
refactor(settings): redesign OpenCode settings with shared collapsible sections
- Replace bordered cards with compact flat rows and maintenance sections - Add shared SettingsDisclosure for config, maintenance, and sandbox sections - Auto-scroll expanded sections into view when outside the scrollport - Make agent file editor and agent form full-height and keyboard-aware on mobile
This commit is contained in:
1 parent
295d24ced7
commit
2a4fa956b4
18 files changed
+1013
-742
No files matched your search
@@ -0,0 +1,31 @@
|
||||
interface RectLike {
|
||||
top: number
|
||||
bottom: number
|
||||
}
|
||||
|
||||
export function isSectionFullyVisible(section: RectLike, scroller: RectLike): boolean {
|
||||
return section.top >= scroller.top && section.bottom <= scroller.bottom
|
||||
}
|
||||
|
||||
function findScrollContainer(element: HTMLElement): HTMLElement | null {
|
||||
let node = element.parentElement
|
||||
while (node) {
|
||||
const { overflowY } = getComputedStyle(node)
|
||||
if ((overflowY === 'auto' || overflowY === 'scroll') && node.scrollHeight > node.clientHeight) {
|
||||
return node
|
||||
}
|
||||
node = node.parentElement
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export function scrollSectionIntoView(header: HTMLElement | null) {
|
||||
if (!header) return
|
||||
const section = header.parentElement
|
||||
if (!section) return
|
||||
const scroller = findScrollContainer(section)
|
||||
if (scroller && isSectionFullyVisible(section.getBoundingClientRect(), scroller.getBoundingClientRect())) {
|
||||
return
|
||||
}
|
||||
header.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
}
|
||||
Reference in new issue
Block a user