diff --git a/src-web/components/ResponseHeaders.tsx b/src-web/components/ResponseHeaders.tsx index 27ff0e9e..9464a0eb 100644 --- a/src-web/components/ResponseHeaders.tsx +++ b/src-web/components/ResponseHeaders.tsx @@ -1,8 +1,5 @@ -import { open } from '@tauri-apps/plugin-shell'; import type { HttpResponse } from '../lib/models'; -import { IconButton } from './core/IconButton'; import { KeyValueRow, KeyValueRows } from './core/KeyValueRow'; -import { Separator } from './core/Separator'; interface Props { response: HttpResponse; @@ -13,33 +10,9 @@ export function ResponseHeaders({ response }: Props) {
{response.headers.map((h, i) => ( - + ))} - Other Info - - - - - URL - open(response.url)} - title="Open in browser" - /> -
- } - value={ -
- {response.url} -
- } - /> - ); } diff --git a/src-web/components/ResponseInfo.tsx b/src-web/components/ResponseInfo.tsx new file mode 100644 index 00000000..91f2ba57 --- /dev/null +++ b/src-web/components/ResponseInfo.tsx @@ -0,0 +1,39 @@ +import { open } from '@tauri-apps/plugin-shell'; +import type { HttpResponse } from '../lib/models'; +import { IconButton } from './core/IconButton'; +import { KeyValueRow, KeyValueRows } from './core/KeyValueRow'; + +interface Props { + response: HttpResponse; +} + +export function ResponseInfo({ response }: Props) { + return ( +
+ + + + + URL + open(response.url)} + title="Open in browser" + /> +
+ } + value={ +
+ {response.url} +
+ } + /> + + + ); +} diff --git a/src-web/components/ResponsePane.tsx b/src-web/components/ResponsePane.tsx index c38f56b0..a90bf05a 100644 --- a/src-web/components/ResponsePane.tsx +++ b/src-web/components/ResponsePane.tsx @@ -20,6 +20,7 @@ import { TabContent, Tabs } from './core/Tabs/Tabs'; import { EmptyStateText } from './EmptyStateText'; import { RecentResponsesDropdown } from './RecentResponsesDropdown'; import { ResponseHeaders } from './ResponseHeaders'; +import { ResponseInfo } from './ResponseInfo'; import { AudioViewer } from './responseViewers/AudioViewer'; import { CsvViewer } from './responseViewers/CsvViewer'; import { ImageViewer } from './responseViewers/ImageViewer'; @@ -46,7 +47,7 @@ export const ResponsePane = memo(function ResponsePane({ style, className, activ () => [ { value: 'body', - label: 'Preview', + label: 'Preview Mode', options: { value: viewMode, onChange: setViewMode, @@ -67,6 +68,10 @@ export const ResponsePane = memo(function ResponsePane({ style, className, activ ), value: 'headers', }, + { + label: 'Info', + value: 'info', + }, ], [activeResponse?.headers, contentType, setViewMode, viewMode], ); @@ -148,6 +153,9 @@ export const ResponsePane = memo(function ResponsePane({ style, className, activ + + + {!activeResponse.contentLength ? (
@@ -166,6 +174,8 @@ export const ResponsePane = memo(function ResponsePane({ style, className, activ ) : viewMode === 'pretty' && contentType?.includes('html') ? ( ) : ( + // ) : viewMode === 'pretty' && contentType?.includes('json') ? ( + // { +export const JsonAttributeTree = ({ + depth = 0, + attrKey, + attrValue, + attrKeyJsonPath, + className, +}: Props) => { attrKeyJsonPath = attrKeyJsonPath ?? `${attrKey}`; const [isExpanded, setIsExpanded] = useState(true); @@ -59,7 +66,7 @@ export const JsonAttributeTree = ({ depth = 0, attrKey, attrValue, attrKeyJsonPa : null, isExpandable: attrValue.length > 0, label: isExpanded ? `[${attrValue.length || ' '}]` : `[⋯]`, - labelClassName: 'text-subtler', + labelClassName: 'text-fg-subtler', }; } else { return { @@ -77,10 +84,18 @@ export const JsonAttributeTree = ({ depth = 0, attrKey, attrValue, attrKeyJsonPa }, [attrValue, attrKeyJsonPath, isExpanded, depth]); const labelEl = ( - {label} + + {label} + ); return ( -
+
{isExpandable ? (