Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/insomnia/src/ui/components/panes/request-pane.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { FC, Fragment, useState } from 'react';
import { Button, Heading, ToggleButton } from 'react-aria-components';
import { useParams, useRouteLoaderData } from 'react-router-dom';
import { useLocalStorage } from 'react-use';
import styled from 'styled-components';

import { getContentTypeFromHeaders } from '../../../common/constants';
Expand Down Expand Up @@ -77,6 +78,8 @@ export const RequestPane: FC<Props> = ({
useState(false);
const patchRequest = useRequestPatcher();

const [dismissPathParameterTip, setDismissPathParameterTip] = useLocalStorage('dismissPathParameterTip', '');

const handleImportQueryFromUrl = () => {
let query;

Expand Down Expand Up @@ -230,10 +233,16 @@ export const RequestPane: FC<Props> = ({
</div>
</div>
)}
{pathParameters.length === 0 && (
{pathParameters.length === 0 && !dismissPathParameterTip && (
<div className='text-sm text-[--hl] rounded-sm border border-solid border-[--hl-md] p-2 flex items-center gap-2'>
<Icon icon='info-circle' />
<span>Path parameters are url path segments that start with a colon ':' e.g. ':id' </span>
<Button
className="flex flex-shrink-0 items-center justify-center aspect-square h-6 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] ml-auto"
onPress={() => setDismissPathParameterTip('true')}
>
<Icon icon='close' />
</Button>
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { FC, Fragment, useEffect, useRef, useState } from 'react';
import { Heading } from 'react-aria-components';
import { Button, Heading } from 'react-aria-components';
import { useParams, useRouteLoaderData } from 'react-router-dom';
import { useLocalStorage } from 'react-use';
import styled from 'styled-components';

import { CONTENT_TYPE_JSON } from '../../../common/constants';
Expand Down Expand Up @@ -217,6 +218,8 @@ export const WebSocketRequestPane: FC<Props> = ({ environment }) => {

const [previewMode, setPreviewMode] = useState(CONTENT_TYPE_JSON);

const [dismissPathParameterTip, setDismissPathParameterTip] = useLocalStorage('dismissPathParameterTip', '');

useEffect(() => {
let isMounted = true;
const fn = async () => {
Expand Down Expand Up @@ -347,10 +350,16 @@ export const WebSocketRequestPane: FC<Props> = ({ environment }) => {
</div>
</div>
)}
{pathParameters.length === 0 && (
{pathParameters.length === 0 && !dismissPathParameterTip && (
<div className='text-sm text-[--hl] rounded-sm border border-solid border-[--hl-md] p-2 flex items-center gap-2'>
<Icon icon='info-circle' />
<span>Path parameters are url path segments that start with a colon ':' e.g. ':id' </span>
<Button
className="flex flex-shrink-0 items-center justify-center aspect-square h-6 aria-pressed:bg-[--hl-sm] rounded-sm text-[--color-font] hover:bg-[--hl-xs] ml-auto"
onPress={() => setDismissPathParameterTip('true')}
>
<Icon icon='close' />
</Button>
</div>
)}
</div>
Expand Down