diff --git a/packages/ui/src/components/prompt-input.tsx b/packages/ui/src/components/prompt-input.tsx index 6bd83631..792b7880 100644 --- a/packages/ui/src/components/prompt-input.tsx +++ b/packages/ui/src/components/prompt-input.tsx @@ -46,10 +46,28 @@ export default function PromptInput(props: PromptInputProps) { const [pasteCount, setPasteCount] = createSignal(0) const [imageCount, setImageCount] = createSignal(0) const [mode, setMode] = createSignal<"normal" | "shell">("normal") + const [expandState, setExpandState] = createSignal<"normal" | "fifty" | "eighty">("normal") const SELECTION_INSERT_MAX_LENGTH = 2000 let textareaRef: HTMLTextAreaElement | undefined let containerRef: HTMLDivElement | undefined + const calculateContainerHeight = () => { + if (!containerRef) return 0 + const rect = containerRef.getBoundingClientRect() + const root = containerRef.closest(".session-view") + if (!root) return 0 + const rootRect = root.getBoundingClientRect() + return rootRect.height - rect.top + } + + const getExpandedHeight = (): string => { + const state = expandState() + if (state === "normal") return "auto" + const containerHeight = calculateContainerHeight() + if (state === "fifty") return `${containerHeight * 0.5}px` + return `${containerHeight * 0.8}px` + } +