GraphQL Documentation explorer (#208)

This commit is contained in:
Mr0Bread
2025-06-18 03:08:39 +03:00
committed by GitHub
parent aadfbfdfca
commit b8e6dbc7c7
5 changed files with 913 additions and 87 deletions

View File

@@ -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} />
)
}
/>
);
}