Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

move graphiql to api docs section

Alaister Young7102791900f6
diff --git a/studio/components/layouts/DocsLayout/DocsLayout.tsx b/studio/components/layouts/DocsLayout/DocsLayout.tsx
index c172f2c7a88..f4d677f2669 100644
--- a/studio/components/layouts/DocsLayout/DocsLayout.tsx
+++ b/studio/components/layouts/DocsLayout/DocsLayout.tsx
@@ -14,6 +14,8 @@ function DocsLayout({ title, children }: { title: string; children: ReactElement
const { data, isLoading, error } = meta.openApi
const getPage = () => {
+ if (router.pathname.endsWith('graphiql')) return 'graphiql'
+
const { page, resource } = router.query
if (!page && !resource) return 'introduction'
return (page || resource || '') as string
diff --git a/studio/components/layouts/DocsLayout/DocsLayout.utils.tsx b/studio/components/layouts/DocsLayout/DocsLayout.utils.tsx
index c97284cf3e1..13b4c097599 100644
--- a/studio/components/layouts/DocsLayout/DocsLayout.utils.tsx
+++ b/studio/components/layouts/DocsLayout/DocsLayout.utils.tsx
@@ -1,4 +1,5 @@
import { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
+import SVG from 'react-inlinesvg'
import { IconBook, IconBookOpen } from 'ui'
export const generateDocsMenu = (
@@ -58,6 +59,25 @@ export const generateDocsMenu = (
}),
],
},
+ {
+ title: 'GraphQL',
+ items: [
+ {
+ name: 'GraphiQL',
+ key: 'graphiql',
+ url: `/project/${ref}/api/graphiql`,
+ icon: (
+ <SVG
+ src="/img/graphql.svg"
+ style={{ width: `${16}px`, height: `${16}px` }}
+ className="text-scale-1200"
+ preProcessor={(code) => code.replace(/svg/, 'svg class="m-auto text-color-inherit"')}
+ />
+ ),
+ items: [],
+ },
+ ],
+ },
{
title: 'More Resources',
items: [
diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
index c16b3374c95..5a2c1a7bac5 100644
--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
@@ -50,20 +50,6 @@ export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[]
ref &&
(isProjectPaused ? homeUrl : isProjectBuilding ? buildingUrl : `/project/${ref}/sql`),
},
- {
- key: 'graphiql',
- label: 'GraphiQL',
- icon: (
- <SVG
- src="/img/graphql.svg"
- style={{ width: `${18}px`, height: `${18}px` }}
- preProcessor={(code) => code.replace(/svg/, 'svg class="m-auto text-color-inherit"')}
- />
- ),
- link:
- ref &&
- (isProjectPaused ? homeUrl : isProjectBuilding ? buildingUrl : `/project/${ref}/graphiql`),
- },
]
}
export const generateProductRoutes = (ref?: string, project?: ProjectBase): Route[] => {
diff --git a/studio/pages/project/[ref]/graphiql/index.tsx b/studio/pages/project/[ref]/api/graphiql.tsx
similarity index 94%
rename from studio/pages/project/[ref]/graphiql/index.tsx
rename to studio/pages/project/[ref]/api/graphiql.tsx
index ed285275815..4e11726744f 100644
--- a/studio/pages/project/[ref]/graphiql/index.tsx
+++ b/studio/pages/project/[ref]/api/graphiql.tsx
@@ -3,7 +3,7 @@ import { createGraphiQLFetcher } from '@graphiql/toolkit'
import ExtensionCard from 'components/interfaces/Database/Extensions/ExtensionCard'
import GraphiQL from 'components/interfaces/GraphQL/GraphiQL'
-import { ProjectLayoutWithAuth } from 'components/layouts'
+import { DocsLayout } from 'components/layouts'
import Connecting from 'components/ui/Loading/Loading'
import { useParams, useStore } from 'hooks'
import { useProjectApiQuery } from 'data/config/project-api-query'
@@ -84,8 +84,6 @@ const GraphiQLPage: NextPageWithLayout = () => {
return <GraphiQL fetcher={fetcher} theme={ui.theme} />
}
-GraphiQLPage.getLayout = (page) => (
- <ProjectLayoutWithAuth title="GraphiQL">{page}</ProjectLayoutWithAuth>
-)
+GraphiQLPage.getLayout = (page) => <DocsLayout title="GraphiQL">{page}</DocsLayout>
export default observer(GraphiQLPage)