diff --git a/frontend/src/components/CodeEditor.tsx b/frontend/src/components/CodeEditor.tsx index 3d3c53d0a0..5e35805775 100644 --- a/frontend/src/components/CodeEditor.tsx +++ b/frontend/src/components/CodeEditor.tsx @@ -78,7 +78,15 @@ export const CodeEditor = ({ initialState, onTextChanged }: { initialState: Init const state = EditorState.create({ doc: initialState.initialText, - extensions: [commonExtensions, isDarkMode ? atomone : githubLight, json5(), editingExtensions], + extensions: [ + ...commonExtensions, + isDarkMode ? atomone : githubLight, + json5(), + editingExtensions, + EditorView.theme({ + '&': { height: '100%' }, + }), + ], }) const view = new EditorView({ @@ -94,5 +102,5 @@ export const CodeEditor = ({ initialState, onTextChanged }: { initialState: Init } }, [initialState, isDarkMode]) - return
+ return
} diff --git a/frontend/src/components/ResizeableVerticalPanels.tsx b/frontend/src/components/ResizeableVerticalPanels.tsx index 10661ef39e..7861378b05 100644 --- a/frontend/src/components/ResizeableVerticalPanels.tsx +++ b/frontend/src/components/ResizeableVerticalPanels.tsx @@ -44,12 +44,14 @@ export const ResizableVerticalPanels: React.FC = ( } const onDrag = (e: React.MouseEvent) => { - if (isDragging) { - const newHeight = e.clientY - const maxHeight = window.innerHeight - minBottomPanelHeight - if (newHeight >= minTopPanelHeight && newHeight <= maxHeight) { - setTopPanelHeight(newHeight - 44) - } + if (!isDragging || !containerRef.current) { + return + } + const containerDims = containerRef.current.getBoundingClientRect() + const newHeight = e.clientY - containerDims.top + const maxHeight = containerDims.height - minBottomPanelHeight + if (newHeight >= minTopPanelHeight && newHeight <= maxHeight) { + setTopPanelHeight(newHeight) } } diff --git a/frontend/src/features/verbs/VerbFormInput.tsx b/frontend/src/features/verbs/VerbFormInput.tsx index f96c597223..23488ee58e 100644 --- a/frontend/src/features/verbs/VerbFormInput.tsx +++ b/frontend/src/features/verbs/VerbFormInput.tsx @@ -27,7 +27,7 @@ export const VerbFormInput = ({ return (
- {requestType} + {requestType} setPath(event.target.value)} /> -
diff --git a/frontend/src/features/verbs/VerbRequestForm.tsx b/frontend/src/features/verbs/VerbRequestForm.tsx index b81d2b9e6a..7ed2d80bbb 100644 --- a/frontend/src/features/verbs/VerbRequestForm.tsx +++ b/frontend/src/features/verbs/VerbRequestForm.tsx @@ -1,5 +1,6 @@ import { useEffect, useState } from 'react' import { CodeEditor, type InitialState } from '../../components/CodeEditor' +import { ResizableVerticalPanels } from '../../components/ResizeableVerticalPanels' import { useClient } from '../../hooks/use-client' import type { Module, Verb } from '../../protos/xyz/block/ftl/v1/console/console_pb' import { VerbService } from '../../protos/xyz/block/ftl/v1/ftl_connect' @@ -101,8 +102,19 @@ export const VerbRequestForm = ({ module, verb }: { module?: Module; verb?: Verb const bottomText = response ?? error ?? '' + const bodyEditor = + const bodyPanels = + bottomText === '' ? ( + bodyEditor + ) : ( + } + /> + ) + return ( -
+
-
-
- {activeTabId === 'body' && } +
+ {activeTabId === 'body' && bodyPanels} {activeTabId === 'verbschema' && } {activeTabId === 'jsonschema' && } {activeTabId === 'headers' && }
- -
-
- -
)