Files
opencode-manager/frontend/src/lib/editorScroll.ts
T
Chris Scott a73ac19bbc feat(frontend): mobile-friendly config editor with find bar and unsaved-changes guard (#326)
* feat(frontend): mobile-friendly config editor with find bar and unsaved-changes guard

* refactor: remove retry-clone flow and share destructive-confirm dialog

Backend drops POST /:id/retry-clone and the supporting retryCloneRepo service
and claimRepoForRetry query; failed clones now delete the repo row rather than
lingering in error state. Frontend extracts ConfirmDestructiveDialog shared by
Delete/Discard/UnsavedChanges dialogs, memoizes CodeEditor rows, fixes scroll
jump while typing away from the active match, and aligns the responsive
breakpoint to 768px.
2026-07-27 16:46:12 -04:00

13 lines
396 B
TypeScript

interface RowScrollInput {
rowTop: number
rowHeight: number
viewportHeight: number
maxScrollTop: number
}
export function computeScrollTopForRow({ rowTop, rowHeight, viewportHeight, maxScrollTop }: RowScrollInput): number {
const centred = rowTop - viewportHeight / 2 + rowHeight / 2
const upperBound = Math.max(0, maxScrollTop)
return Math.min(Math.max(0, centred), upperBound)
}