Create standalone browser port of LTX Athena with authenticated native API transport

This commit is contained in:
Mikei386 committed 2026-09-29 17:59:23 +02:00
commit 1333b0c36b
202 files changed
+63054

No files matched your search

@@ -0,0 +1,40 @@
import { useCallback, useRef, useState } from 'react'
import type { PanelImperativeHandle } from 'react-resizable-panels'
import {
DEFAULT_PROMPT_BAR_HEIGHT,
PROMPT_BAR_HEIGHT_LIMITS,
clampPromptBarHeight,
loadPromptBarHeight,
savePromptBarHeight,
} from '../../lib/genspace-layout'
export function useGenSpacePromptBarHeight() {
const initialHeightRef = useRef(loadPromptBarHeight())
const heightRef = useRef(initialHeightRef.current)
const panelRef = useRef<PanelImperativeHandle | null>(null)
const [promptBarHeight, setPromptBarHeight] = useState(initialHeightRef.current)
const persistHeight = useCallback((inPixels: number) => {
const next = clampPromptBarHeight(inPixels)
if (next === heightRef.current) return
heightRef.current = next
setPromptBarHeight(next)
savePromptBarHeight(next)
}, [])
const resetHeight = useCallback(() => {
heightRef.current = DEFAULT_PROMPT_BAR_HEIGHT
setPromptBarHeight(DEFAULT_PROMPT_BAR_HEIGHT)
savePromptBarHeight(DEFAULT_PROMPT_BAR_HEIGHT)
panelRef.current?.resize(DEFAULT_PROMPT_BAR_HEIGHT)
}, [])
return {
initialHeight: initialHeightRef.current,
promptBarHeight,
panelRef,
persistHeight,
resetHeight,
limits: PROMPT_BAR_HEIGHT_LIMITS,
}
}