diff --git a/src-web/components/GraphQLDocsExplorer.tsx b/src-web/components/GraphQLDocsExplorer.tsx index 2ab85361..26dedc6e 100644 --- a/src-web/components/GraphQLDocsExplorer.tsx +++ b/src-web/components/GraphQLDocsExplorer.tsx @@ -17,6 +17,7 @@ import { useAtomValue } from 'jotai'; import { ReactNode, useState } from 'react'; import { graphqlDocStateAtom, graphqlSchemaAtom } from '../atoms/graphqlSchemaAtom'; import { jotaiStore } from '../lib/jotai'; +import { CountBadge } from './core/CountBadge'; import { Icon } from './core/Icon'; import { IconButton } from './core/IconButton'; import { Markdown } from './Markdown'; @@ -76,7 +77,9 @@ export function GraphQLDocsExplorer() { setItem={setActiveItem} className="!my-0" /> - All Schema Types + + All Schema Types + {graphqlSchema.description ?? null}
{Object.keys(allTypes).map((typeName) => { @@ -144,6 +147,11 @@ function GqlTypeInfo({ if (isScalarType(item.type)) { return heading; + } else if (isNonNullType(item.type) || isListType(item.type)) { + // kinda a hack, but we'll just unwrap there and show the named type + return ( + + ); } else if (isInterfaceType(item.type)) { const fields = item.type.getFields(); const possibleTypes = graphqlSchema?.getPossibleTypes(item.type) ?? []; @@ -152,7 +160,9 @@ function GqlTypeInfo({
{heading} - Fields + + Fields + {Object.keys(fields).map((fieldName) => { const field = fields[fieldName]!; const fieldItem: ExplorerItem = { kind: 'field', type: field, from: item }; @@ -249,7 +259,9 @@ function GqlTypeInfo({
{heading} - Fields + + Fields + {Object.keys(fields).map((fieldName) => { const field = fields[fieldName]; if (field == null) return null; @@ -276,7 +288,9 @@ function GqlTypeInfo({
{heading} - Fields + + Fields + {Object.keys(fields).map((fieldName) => { const field = fields[fieldName]; if (field == null) return null; @@ -299,12 +313,27 @@ function GqlTypeInfo({ ); } else if (item.kind === 'type' && isObjectType(item.type)) { const fields = item.type.getFields(); + const interfaces = item.type.getInterfaces(); return (
{heading} + {interfaces.length > 0 && ( + <> + Implements + {interfaces.map((i) => ( + + ))} + + )} - Fields + + Fields + {Object.keys(fields).map((fieldName) => { const field = fields[fieldName]; if (field == null) return null; @@ -415,7 +444,7 @@ function GqlTypeRow({ child = ( <>
- {name && {name.value}:}{' '} + {name && {name.value}:}{' '}
{item.type.description ?? null} @@ -492,9 +521,9 @@ function GqlTypeLabel({ item, children }: { item: ExplorerItem; children?: strin } function Subheading({ children }: { children: ReactNode }) { - return

{children}

; + return

{children}

; } function Heading({ children }: { children: ReactNode }) { - return

{children}

; + return

{children}

; }