Skip to content

Commit 9bcb728

Browse files
author
Dimitri POSTOLOV
authored
fix hidden sidebar (#581)
* fix * allright
1 parent 3b3662a commit 9bcb728

30 files changed

+112
-71
lines changed

website/next.config.js

+12-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import nextra from 'nextra'
22

3-
import { defaultLocale, extractLocaleFromPath } from '@edgeandnode/gds'
4-
53
const env = {
64
ENVIRONMENT: process.env.ENVIRONMENT,
75
BASE_PATH: process.env.NODE_ENV === 'production' ? '/docs' : '',
@@ -23,27 +21,24 @@ const withNextra = nextra({
2321
codeHighlight: false,
2422
defaultShowCopyCode: false,
2523
transform(result, { route }) {
26-
if (!route) return result
27-
28-
const { locale } = extractLocaleFromPath(route)
24+
if (route && !result.includes('getStaticProps')) {
25+
const banner = `
26+
import { getPageMap } from '@/src/getPageMap'
2927
30-
result = `
31-
globalThis.__graph_docs_locale = '${locale ?? defaultLocale}'
32-
${result}
33-
`
34-
35-
if (!result.includes('getStaticProps')) {
36-
result = `
37-
import { buildGetStaticProps } from '@/src/buildGetStaticProps'
38-
${result}
39-
export const getStaticProps = buildGetStaticProps()
40-
`
28+
export const getStaticProps = async context => ({
29+
props: {
30+
__nextra_pageMap: await getPageMap('${route.split('/')[1]}')
31+
}
32+
})`
33+
result += banner
4134
}
42-
4335
return result
4436
},
4537
})
4638

39+
/**
40+
* @type {import('next').NextConfig}
41+
*/
4742
export default withNextra({
4843
env,
4944
output: 'export',

website/pages/ar/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: الشبكات المدعومة
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/cs/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Supported Networks
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/de/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Supported Networks
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/en/developing/graph-ts/[[...slug]].mdx

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RemoteContent } from 'nextra/data'
22
import { buildDynamicMDX } from 'nextra/remote'
3-
import { getPageMap } from '@/src/getPageMap'
3+
import { buildGetStaticProps } from '@/src/buildGetStaticProps'
44
import { remarkReplaceLinks } from '@/src/remarkReplaceLinks'
55
import { Mermaid } from 'nextra/components'
66
import { visit } from 'unist-util-visit'
@@ -15,9 +15,7 @@ export const getStaticPaths = () => ({
1515
})),
1616
})
1717

18-
{/* Only in dynamic route we can't use `buildGetStaticProps` function, because route is based on filename of mdx page */}
19-
20-
export async function getStaticProps({ params }) {
18+
export const getStaticProps = buildGetStaticProps(__filename, async ({ params }) => {
2119
const { filePaths, user, repo, branch, docsPath } = json
2220
const paths = params?.slug?.join('/')
2321
const foundPath = filePaths.find((filePath) => filePath.startsWith(paths))
@@ -28,13 +26,12 @@ export async function getStaticProps({ params }) {
2826
mdxOptions: {
2927
format: 'md',
3028
remarkPlugins: [
31-
() => (tree, _file, done) => {
29+
() => (tree, _file) => {
3230
visit(tree, 'link', (node) => {
3331
if (node.url.startsWith('../')) {
3432
node.url = node.url.replace('../', `https://github.com/${user}/${repo}/tree/${branch}/`)
3533
}
3634
})
37-
done()
3835
},
3936
[remarkReplaceLinks, { foundPath, basePath: '/developing/graph-ts/' }],
4037
],
@@ -44,11 +41,10 @@ export async function getStaticProps({ params }) {
4441
return {
4542
props: {
4643
...mdx,
47-
__nextra_pageMap: await getPageMap('en'),
4844
hideLocaleSwitcher: true,
4945
remoteFilePath: `https://github.com/${user}/${repo}/tree/${branch}/${docsPath}${foundPath}`,
5046
},
5147
}
52-
}
48+
})
5349

5450
<RemoteContent components={{ Mermaid }} />

website/pages/en/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Supported Networks
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/en/querying/graph-client/[[...slug]].mdx

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RemoteContent } from 'nextra/data'
22
import { buildDynamicMDX } from 'nextra/remote'
3-
import { getPageMap } from '@/src/getPageMap'
3+
import { buildGetStaticProps } from '@/src/buildGetStaticProps'
44
import { remarkReplaceLinks } from '@/src/remarkReplaceLinks'
55
import { Mermaid } from 'nextra/components'
66
import { visit } from 'unist-util-visit'
@@ -15,9 +15,7 @@ export const getStaticPaths = () => ({
1515
})),
1616
})
1717

18-
{/* Only in dynamic route we can't use `buildGetStaticProps` function, because route is based on filename of mdx page */}
19-
20-
export async function getStaticProps({ params }) {
18+
export const getStaticProps = buildGetStaticProps(__filename, async ({ params }) => {
2119
const { filePaths, user, repo, branch, docsPath } = json
2220
const paths = params?.slug?.join('/')
2321
const foundPath = filePaths.find((filePath) => filePath.startsWith(paths))
@@ -28,13 +26,12 @@ export async function getStaticProps({ params }) {
2826
mdxOptions: {
2927
format: 'md',
3028
remarkPlugins: [
31-
() => (tree, _file, done) => {
29+
() => (tree, _file) => {
3230
visit(tree, 'link', (node) => {
3331
if (node.url.startsWith('../')) {
3432
node.url = node.url.replace('../', `https://github.com/${user}/${repo}/tree/${branch}/`)
3533
}
3634
})
37-
done()
3835
},
3936
[remarkReplaceLinks, { foundPath, basePath: '/querying/graph-client/' }],
4037
],
@@ -44,11 +41,10 @@ export async function getStaticProps({ params }) {
4441
return {
4542
props: {
4643
...mdx,
47-
__nextra_pageMap: await getPageMap('en'),
4844
hideLocaleSwitcher: true,
4945
remoteFilePath: `https://github.com/${user}/${repo}/tree/${branch}/${docsPath}${foundPath}`,
5046
},
5147
}
52-
}
48+
})
5349

5450
<RemoteContent components={{ Mermaid }} />

website/pages/es/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Redes admitidas
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/fr/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Réseaux supportés
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/ha/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Supported Networks
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/hi/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: समर्थित नेटवर्क्स
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/it/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Reti supportate
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/ja/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: サポートされているネットワーク
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/ko/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: 지원되는 네트워크들
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/mr/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: समर्थित नेटवर्क
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/nl/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Supported Networks
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/pl/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Wspierane sieci
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/pt/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Redes Apoiadas
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/ro/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Rețele suportate
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/ru/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Поддерживаемые сети
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/sv/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Stödda Nätverk
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

website/pages/tr/developing/supported-networks.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Desteklenen Ağlar
33
---
44

5-
export { getStaticPropsForSupportedNetworks as getStaticProps } from '@/src/buildGetStaticProps'
5+
import { getStaticPropsForSupportedNetworks } from '@/src/buildGetStaticProps'
66
import { SupportedNetworksTable } from '@/src/supportedNetworks'
77

8+
export const getStaticProps = getStaticPropsForSupportedNetworks(__filename)
9+
810
<SupportedNetworksTable networks={props.networks} />
911

1012
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.

0 commit comments

Comments
 (0)