From 492d614b993bf8e5cbb4e165bff751047452617f Mon Sep 17 00:00:00 2001 From: gatzjames Date: Wed, 8 Jan 2025 16:56:05 +0100 Subject: [PATCH] Resizable sections for parameters in request panes --- .../editors/request-parameters-editor.tsx | 2 +- .../src/ui/components/panes/request-pane.tsx | 164 +++++++++--------- .../websockets/websocket-request-pane.tsx | 97 ++++++----- 3 files changed, 138 insertions(+), 125 deletions(-) diff --git a/packages/insomnia/src/ui/components/editors/request-parameters-editor.tsx b/packages/insomnia/src/ui/components/editors/request-parameters-editor.tsx index a027693326c..e79cc4fbf3a 100644 --- a/packages/insomnia/src/ui/components/editors/request-parameters-editor.tsx +++ b/packages/insomnia/src/ui/components/editors/request-parameters-editor.tsx @@ -65,7 +65,7 @@ export const RequestParametersEditor: FC = ({ return ( = ({ -
-
-
- Query parameters -
- - { - patchSettings({ - useBulkParametersEditor: isSelected, - }); - }} - isSelected={settings.useBulkParametersEditor} - className="w-[14ch] flex flex-shrink-0 gap-2 items-center justify-start px-2 py-1 h-full rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-colors text-sm" - > - {({ isSelected }) => ( - - - { - isSelected ? 'Regular Edit' : 'Bulk Edit' - } - - )} - + + +
+
+ Query parameters +
+ + { + patchSettings({ + useBulkParametersEditor: isSelected, + }); + }} + isSelected={settings.useBulkParametersEditor} + className="w-[14ch] flex flex-shrink-0 gap-2 items-center justify-start px-2 py-1 h-full rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-colors text-sm" + > + {({ isSelected }) => ( + + + { + isSelected ? 'Regular Edit' : 'Bulk Edit' + } + + )} + +
+ + +
- - - -
-
- Path parameters - {pathParameters.length > 0 && ( -
-
- {pathParameters.map(pathParameter => ( - - - {pathParameter.name} - -
- { - onPathParameterChange(pathParameters.map(p => p.name === pathParameter.name ? { ...p, value: name } : p)); - }} - /> -
-
- ))} + + + +
+ Path parameters + {pathParameters.length > 0 && ( +
+
+ {pathParameters.map(pathParameter => ( + + + {pathParameter.name} + +
+ { + onPathParameterChange(pathParameters.map(p => p.name === pathParameter.name ? { ...p, value: name } : p)); + }} + /> +
+
+ ))} +
-
- )} - {pathParameters.length === 0 && !dismissPathParameterTip && ( -
- - Path parameters are url path segments that start with a colon ':' e.g. ':id' - -
- )} -
-
+ )} + {pathParameters.length === 0 && !dismissPathParameterTip && ( +
+ + Path parameters are url path segments that start with a colon ':' e.g. ':id' + +
+ )} +
+ + = ({ environment }) => { {disabled && } +
@@ -339,53 +341,57 @@ export const WebSocketRequestPane: FC = ({ environment }) => {
-
-
-
- Query parameters -
- - { - patchSettings({ - useBulkParametersEditor: isSelected, - }); - }} - isSelected={settings.useBulkParametersEditor} - className="w-[14ch] flex flex-shrink-0 gap-2 items-center justify-start px-2 py-1 h-full rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-colors text-sm" - > - {({ isSelected }) => ( - - - { - isSelected ? 'Regular Edit' : 'Bulk Edit' - } - - )} - + + +
+
+ Query parameters +
+ + { + patchSettings({ + useBulkParametersEditor: isSelected, + }); + }} + isSelected={settings.useBulkParametersEditor} + className="w-[14ch] flex flex-shrink-0 gap-2 items-center justify-start px-2 py-1 h-full rounded-sm text-[--color-font] hover:bg-[--hl-xs] focus:ring-inset ring-1 ring-transparent focus:ring-[--hl-md] transition-colors text-sm" + > + {({ isSelected }) => ( + + + { + isSelected ? 'Regular Edit' : 'Bulk Edit' + } + + )} + +
+ + +
- - - -
-
- Path parameters + + + +
+ Path parameters {pathParameters.length > 0 && ( -
+
{pathParameters.map(pathParameter => ( @@ -422,7 +428,8 @@ export const WebSocketRequestPane: FC = ({ environment }) => {
)}
-
+ +