mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 10:21:37 +01:00
GraphQL Documentation explorer (#208)
This commit is contained in:
@@ -4,6 +4,11 @@ import type { HttpRequest } from '@yaakapp-internal/models';
|
||||
import { SplitLayout } from './core/SplitLayout';
|
||||
import { HttpRequestPane } from './HttpRequestPane';
|
||||
import { HttpResponsePane } from './HttpResponsePane';
|
||||
import { GraphQLDocsExplorer } from "./GraphQLDocsExplorer";
|
||||
import {
|
||||
useAtomValue
|
||||
} from 'jotai';
|
||||
import { graphqlDocStateAtom } from "../atoms/graphqlSchemaAtom";
|
||||
|
||||
interface Props {
|
||||
activeRequest: HttpRequest;
|
||||
@@ -11,6 +16,11 @@ interface Props {
|
||||
}
|
||||
|
||||
export function HttpRequestLayout({ activeRequest, style }: Props) {
|
||||
const {
|
||||
bodyType,
|
||||
} = activeRequest;
|
||||
const isDocOpen = useAtomValue(graphqlDocStateAtom);
|
||||
|
||||
return (
|
||||
<SplitLayout
|
||||
name="http_layout"
|
||||
@@ -23,7 +33,24 @@ export function HttpRequestLayout({ activeRequest, style }: Props) {
|
||||
fullHeight={orientation === 'horizontal'}
|
||||
/>
|
||||
)}
|
||||
secondSlot={({ style }) => <HttpResponsePane activeRequestId={activeRequest.id} style={style} />}
|
||||
secondSlot={
|
||||
bodyType === 'graphql' && isDocOpen
|
||||
? () => (
|
||||
<SplitLayout
|
||||
name="http_response_layout"
|
||||
className="gap-1.5"
|
||||
firstSlot={
|
||||
({ style }) => <HttpResponsePane activeRequestId={activeRequest.id} style={style} />
|
||||
}
|
||||
secondSlot={
|
||||
() => <GraphQLDocsExplorer />
|
||||
}
|
||||
/>
|
||||
)
|
||||
: (
|
||||
({ style }) => <HttpResponsePane activeRequestId={activeRequest.id} style={style} />
|
||||
)
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user