diff --git a/packages/bruno-app/src/components/RequestPane/Assertions/StyledWrapper.js b/packages/bruno-app/src/components/RequestPane/Assertions/StyledWrapper.js index 4d7aafe3..773dbae5 100644 --- a/packages/bruno-app/src/components/RequestPane/Assertions/StyledWrapper.js +++ b/packages/bruno-app/src/components/RequestPane/Assertions/StyledWrapper.js @@ -1,6 +1,16 @@ import styled from 'styled-components'; const Wrapper = styled.div` + .scroll { + ::-webkit-scrollbar { + width: 0px; + } + + ::-webkit-scrollbar-button { + display: none; + } + } + table { width: 100%; border-collapse: collapse; diff --git a/packages/bruno-app/src/components/RequestPane/Assertions/index.js b/packages/bruno-app/src/components/RequestPane/Assertions/index.js index 1805a632..fab0db33 100644 --- a/packages/bruno-app/src/components/RequestPane/Assertions/index.js +++ b/packages/bruno-app/src/components/RequestPane/Assertions/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import get from 'lodash/get'; import cloneDeep from 'lodash/cloneDeep'; import { useDispatch } from 'react-redux'; @@ -6,11 +6,23 @@ import { addAssertion, updateAssertion, deleteAssertion } from 'providers/ReduxS import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collections/actions'; import AssertionRow from './AssertionRow'; import StyledWrapper from './StyledWrapper'; +import { useTheme } from 'providers/Theme/index'; const Assertions = ({ item, collection }) => { const dispatch = useDispatch(); + const { theme } = useTheme(); const assertions = item.draft ? get(item, 'draft.request.assertions') : get(item, 'request.assertions'); + const [countItems, setCountItems] = useState(assertions.length); + const ref = useRef(); + + useEffect(() => { + setCountItems(assertions.length); + if (assertions.length > countItems) { + ref.current.scrollIntoView(); + } + }, [assertions]); + const handleAddAssertion = () => { dispatch( addAssertion({ @@ -59,34 +71,37 @@ const Assertions = ({ item, collection }) => { return ( - - - - - - - - - - - {assertions && assertions.length - ? assertions.map((assertion) => { - return ( - - ); - }) - : null} - -
ExprOperatorValue
+
+ + + + + + + + + + + {assertions && assertions.length + ? assertions.map((assertion) => { + return ( + + ); + }) + : null} + +
ExprOperatorValue
+
+
diff --git a/packages/bruno-app/src/components/RequestPane/QueryParams/StyledWrapper.js b/packages/bruno-app/src/components/RequestPane/QueryParams/StyledWrapper.js index d3dc58d5..f45263ff 100644 --- a/packages/bruno-app/src/components/RequestPane/QueryParams/StyledWrapper.js +++ b/packages/bruno-app/src/components/RequestPane/QueryParams/StyledWrapper.js @@ -1,6 +1,16 @@ import styled from 'styled-components'; const Wrapper = styled.div` + .scroll { + ::-webkit-scrollbar { + width: 0px; + } + + ::-webkit-scrollbar-button { + display: none; + } + } + table { width: 100%; border-collapse: collapse; diff --git a/packages/bruno-app/src/components/RequestPane/QueryParams/index.js b/packages/bruno-app/src/components/RequestPane/QueryParams/index.js index 54e3ee0b..51d46a36 100644 --- a/packages/bruno-app/src/components/RequestPane/QueryParams/index.js +++ b/packages/bruno-app/src/components/RequestPane/QueryParams/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import get from 'lodash/get'; import cloneDeep from 'lodash/cloneDeep'; import { IconTrash } from '@tabler/icons'; @@ -12,8 +12,17 @@ import StyledWrapper from './StyledWrapper'; const QueryParams = ({ item, collection }) => { const dispatch = useDispatch(); - const { storedTheme } = useTheme(); + const { storedTheme, theme } = useTheme(); const params = item.draft ? get(item, 'draft.request.params') : get(item, 'request.params'); + const [countItems, setCountItems] = useState(params.length); + const ref = useRef(); + + useEffect(() => { + setCountItems(params.length); + if (params.length > countItems) { + ref.current.scrollIntoView(); + } + }, [params]); const handleAddParam = () => { dispatch( @@ -65,71 +74,74 @@ const QueryParams = ({ item, collection }) => { return ( - - - - - - - - - - {params && params.length - ? params.map((param, index) => { - return ( - - - - + + + + ); + }) + : null} + +
NameValue
- handleParamChange(e, param, 'name')} - /> - - - handleParamChange( - { - target: { - value: newValue - } - }, - param, - 'value' - ) - } - onRun={handleRun} - collection={collection} - /> - -
+
+ + + + + + + + + + {params && params.length + ? params.map((param, index) => { + return ( + + - - ); - }) - : null} - -
NameValue
handleParamChange(e, param, 'enabled')} + type="text" + autoComplete="off" + autoCorrect="off" + autoCapitalize="off" + spellCheck="false" + value={param.name} + className="mousetrap" + onChange={(e) => handleParamChange(e, param, 'name')} /> - - -
+
+ + handleParamChange( + { + target: { + value: newValue + } + }, + param, + 'value' + ) + } + onRun={handleRun} + collection={collection} + /> + +
+ handleParamChange(e, param, 'enabled')} + /> + +
+
+
+
diff --git a/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js b/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js index 0a45f1a7..d1fad07d 100644 --- a/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js +++ b/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js @@ -9,6 +9,8 @@ import { IconDeviceFloppy, IconArrowRight } from '@tabler/icons'; import SingleLineEditor from 'components/SingleLineEditor'; import { isMacOS } from 'utils/common/platform'; import StyledWrapper from './StyledWrapper'; +import { showDocs } from 'providers/ReduxStore/slices/docs'; +import { IconFileDescription } from '@tabler/icons'; const QueryUrl = ({ item, collection, handleRun }) => { const { theme, storedTheme } = useTheme(); @@ -49,6 +51,10 @@ const QueryUrl = ({ item, collection, handleRun }) => { ); }; + const onDocsClick = () => { + dispatch(showDocs()); + }; + return (
@@ -92,6 +98,11 @@ const QueryUrl = ({ item, collection, handleRun }) => {
+
); }; diff --git a/packages/bruno-app/src/components/RequestPane/RequestHeaders/StyledWrapper.js b/packages/bruno-app/src/components/RequestPane/RequestHeaders/StyledWrapper.js index 9f723cb8..497a6a10 100644 --- a/packages/bruno-app/src/components/RequestPane/RequestHeaders/StyledWrapper.js +++ b/packages/bruno-app/src/components/RequestPane/RequestHeaders/StyledWrapper.js @@ -1,6 +1,16 @@ import styled from 'styled-components'; const Wrapper = styled.div` + .scroll { + ::-webkit-scrollbar { + width: 0px; + } + + ::-webkit-scrollbar-button { + display: none; + } + } + table { width: 100%; border-collapse: collapse; diff --git a/packages/bruno-app/src/components/RequestPane/RequestHeaders/index.js b/packages/bruno-app/src/components/RequestPane/RequestHeaders/index.js index db8b20f5..c6bb9f62 100644 --- a/packages/bruno-app/src/components/RequestPane/RequestHeaders/index.js +++ b/packages/bruno-app/src/components/RequestPane/RequestHeaders/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import get from 'lodash/get'; import cloneDeep from 'lodash/cloneDeep'; import { IconTrash } from '@tabler/icons'; @@ -13,9 +13,19 @@ const headerAutoCompleteList = StandardHTTPHeaders.map((e) => e.header); const RequestHeaders = ({ item, collection }) => { const dispatch = useDispatch(); - const { storedTheme } = useTheme(); + const { storedTheme, theme } = useTheme(); const headers = item.draft ? get(item, 'draft.request.headers') : get(item, 'request.headers'); + const [countItems, setCountItems] = useState(headers.length); + const ref = useRef(); + + useEffect(() => { + setCountItems(headers.length); + if (headers.length > countItems) { + ref.current.scrollIntoView(); + } + }, [headers]); + const addHeader = () => { dispatch( addRequestHeader({ @@ -64,80 +74,83 @@ const RequestHeaders = ({ item, collection }) => { return ( - - - - - - - - - - {headers && headers.length - ? headers.map((header) => { - return ( - - - - + + + + ); + }) + : null} + +
+
NameValue
- - handleHeaderValueChange( - { - target: { - value: newValue - } - }, - header, - 'name' - ) - } - autocomplete={headerAutoCompleteList} - onRun={handleRun} - collection={collection} - /> - - - handleHeaderValueChange( - { - target: { - value: newValue - } - }, - header, - 'value' - ) - } - onRun={handleRun} - collection={collection} - /> - -
- handleHeaderValueChange(e, header, 'enabled')} +
+ + + + + + + + + + {headers && headers.length + ? headers.map((header) => { + return ( + + - - ); - }) - : null} - -
NameValue
+ + handleHeaderValueChange( + { + target: { + value: newValue + } + }, + header, + 'name' + ) + } + autocomplete={headerAutoCompleteList} + onRun={handleRun} + collection={collection} /> - - -
+
+ + handleHeaderValueChange( + { + target: { + value: newValue + } + }, + header, + 'value' + ) + } + onRun={handleRun} + collection={collection} + /> + +
+ handleHeaderValueChange(e, header, 'enabled')} + /> + +
+
+ diff --git a/packages/bruno-app/src/components/RequestPane/Script/index.js b/packages/bruno-app/src/components/RequestPane/Script/index.js index 75ee3d36..750c12a4 100644 --- a/packages/bruno-app/src/components/RequestPane/Script/index.js +++ b/packages/bruno-app/src/components/RequestPane/Script/index.js @@ -38,7 +38,7 @@ const Script = ({ item, collection }) => { const onSave = () => dispatch(saveRequest(item.uid, collection.uid)); return ( - +
Pre Request
{
-
+