Skip to content

Commit

Permalink
Remove top-level categories on graphql queries page (github#29592)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachmari authored Aug 3, 2022
1 parent 8560ae7 commit 3cbd710
Show file tree
Hide file tree
Showing 16 changed files with 5,197 additions and 5,295 deletions.
25 changes: 1 addition & 24 deletions components/graphql/GraphqlPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'classnames'
import { LinkIcon } from '@primer/octicons-react'

import { Enum } from 'components/graphql/Enum'
import { InputObject } from 'components/graphql/InputObject'
Expand Down Expand Up @@ -36,29 +35,7 @@ export const GraphqlPage = ({ schema, pageName, objects }: Props) => {
// for each section.
if (pageName === 'queries') {
graphqlItems.push(
<h2 id="connections" key="query-connections-heading">
<a className="doctocat-link" href="#connections">
<LinkIcon className="octicon-link" size="small" />
</a>
Connections
</h2>
)
graphqlItems.push(
...(schema as QueryT).connections.map((item) => (
<Query item={item} key={item.id + item.name} />
))
)
graphqlItems.push(
<h2 id="fields" key="query-fields-heading">
<a className="doctocat-link" href="#fields">
<LinkIcon className="octicon-link" size="small" />
</a>
Fields
</h2>
)

graphqlItems.push(
...(schema as QueryT).fields.map((item) => <Query item={item} key={item.id + item.name} />)
...(schema as QueryT[]).map((item) => <Query item={item} key={item.id + item.name} />)
)
} else if (pageName === 'enums') {
graphqlItems.push(
Expand Down
4 changes: 2 additions & 2 deletions components/graphql/Query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Link } from 'components/Link'
import { GraphqlItem } from './GraphqlItem'
import { Table } from './Table'
import { useTranslation } from 'components/hooks/useTranslation'
import type { QueryItemT } from './types'
import type { QueryT } from './types'

type Props = {
item: QueryItemT
item: QueryT
}

export function Query({ item }: Props) {
Expand Down
4 changes: 1 addition & 3 deletions components/graphql/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ export type FieldT = GraphqlT & {
arguments?: ArgumentT[]
}

export type QueryItemT = GraphqlT & {
export type QueryT = GraphqlT & {
args: GraphqlT[]
}

export type QueryT = { connections: QueryItemT[]; fields: QueryItemT[] }

export type MutationT = GraphqlT & {
inputFields: FieldT[]
returnFields: FieldT[]
Expand Down
Loading

0 comments on commit 3cbd710

Please sign in to comment.