Skip to content

4/4 move pages to src/pages #734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ module.exports = {
// Only lint the English pages because the Markdown for the other languages is auto-generated from English (via Crowdin).
// But include all languages when running the ESLint extension in VS Code (in case the user has "eslint.validate": ["mdx"]),
// otherwise there will be random errors since the non-English files don't match any ruleset.
files: [`website/pages/${isVSCode ? '' : 'en/'}**/*.{md,mdx}`],
files: [`website/src/pages/${isVSCode ? '' : 'en/'}**/*.{md,mdx}`],
excludedFiles: [
`website/pages/${isVSCode ? '' : 'en/'}developing/graph-ts/*.md`,
`website/pages/${isVSCode ? '' : 'en/'}querying/graph-client/*.md`,
`website/src/pages/${isVSCode ? '' : 'en/'}developing/graph-ts/*.md`,
`website/src/pages/${isVSCode ? '' : 'en/'}querying/graph-client/*.md`,
],
parser: 'eslint-mdx',
processor: 'mdx/remark',
Expand Down
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ dist/
website/.graphclient/

# ignore below md since they are fetched from GitHub
website/pages/en/developing/graph-ts/*.md
website/pages/en/querying/graph-client/*.md
website/src/pages/en/developing/graph-ts/*.md
website/src/pages/en/querying/graph-client/*.md
48 changes: 24 additions & 24 deletions website/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { Locale, type NestedStrings, type Translations, useI18n as _useI18n } from '@edgeandnode/gds'

import ar from '@/pages/ar/translations'
import cs from '@/pages/cs/translations'
import de from '@/pages/de/translations'
import en from '@/pages/en/translations'
import es from '@/pages/es/translations'
import fr from '@/pages/fr/translations'
import ha from '@/pages/ha/translations'
import hi from '@/pages/hi/translations'
import it from '@/pages/it/translations'
import ja from '@/pages/ja/translations'
import ko from '@/pages/ko/translations'
import mr from '@/pages/mr/translations'
import nl from '@/pages/nl/translations'
import pl from '@/pages/pl/translations'
import pt from '@/pages/pt/translations'
import ro from '@/pages/ro/translations'
import ru from '@/pages/ru/translations'
import sv from '@/pages/sv/translations'
import tr from '@/pages/tr/translations'
import uk from '@/pages/uk/translations'
import ur from '@/pages/ur/translations'
import vi from '@/pages/vi/translations'
import yo from '@/pages/yo/translations'
import zh from '@/pages/zh/translations'
import ar from '@/src/pages/ar/translations'
import cs from '@/src/pages/cs/translations'
import de from '@/src/pages/de/translations'
import en from '@/src/pages/en/translations'
import es from '@/src/pages/es/translations'
import fr from '@/src/pages/fr/translations'
import ha from '@/src/pages/ha/translations'
import hi from '@/src/pages/hi/translations'
import it from '@/src/pages/it/translations'
import ja from '@/src/pages/ja/translations'
import ko from '@/src/pages/ko/translations'
import mr from '@/src/pages/mr/translations'
import nl from '@/src/pages/nl/translations'
import pl from '@/src/pages/pl/translations'
import pt from '@/src/pages/pt/translations'
import ro from '@/src/pages/ro/translations'
import ru from '@/src/pages/ru/translations'
import sv from '@/src/pages/sv/translations'
import tr from '@/src/pages/tr/translations'
import uk from '@/src/pages/uk/translations'
import ur from '@/src/pages/ur/translations'
import vi from '@/src/pages/vi/translations'
import yo from '@/src/pages/yo/translations'
import zh from '@/src/pages/zh/translations'

const appLocales = [
Locale.ARABIC,
Expand Down
27 changes: 1 addition & 26 deletions website/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,31 +153,6 @@ export default withNextra({
},
i18n: {
defaultLocale: 'en',
locales: [
'ar',
'de',
'en',
'es',
'fr',
'hi',
'it',
'ja',
'ko',
'mr',
'nl',
'pl',
'pt',
'ru',
'sv',
'tr',
'uk',
'ur',
'vi',
'zh',
'cs',
'ha',
'ro',
'yo',
],
locales: Object.keys(translations),
},
})
4 changes: 2 additions & 2 deletions website/scripts/fetch-remote-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ await fetchRemoteDocs({
repo: 'graph-client',
branch: 'main',
docsPath: 'docs/',
outputPath: path.join(CWD, 'pages', 'en', 'querying', 'graph-client'),
outputPath: path.join(CWD, 'src', 'pages', 'en', 'querying', 'graph-client'),
})

await fetchRemoteDocs({
user: 'graphprotocol',
repo: 'graph-tooling',
branch: 'main',
docsPath: 'packages/ts/',
outputPath: path.join(CWD, 'pages', 'en', 'developing', 'graph-ts'),
outputPath: path.join(CWD, 'src', 'pages', 'en', 'developing', 'graph-ts'),
})
9 changes: 0 additions & 9 deletions website/src/buildGetStaticProps.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import path from 'path'

import type { GetStaticProps, GetStaticPropsResult } from 'next'

import { Locale } from '@edgeandnode/gds'

import { getSupportedNetworks } from '@/src/supportedNetworks'

export const buildGetStaticProps = (fileName: string, overrides?: GetStaticProps) => {
const getStaticProps: GetStaticProps = async (context) => {
const overrideStaticProps: GetStaticPropsResult<Record<string, any>> = overrides
? await overrides(context)
: { props: {} }

const pagesDir = path.join(process.cwd(), '.next', 'server', 'pages')
const pagePath = path.relative(pagesDir, fileName)
const locale = pagePath.slice(0, 2) as Locale

return {
...overrideStaticProps,
props: {
Expand Down
22 changes: 10 additions & 12 deletions website/src/contracts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@ export function ProtocolContractsTable({ networkId }: { networkId: number }) {
<Table>
<tbody>
<tr>
<th>{'Contract'}</th>
<th>{'Address'}</th>
<th>Contract</th>
<th>Address</th>
</tr>
{contracts.map((contract) => {
return (
<tr key={contract.name}>
<td>{contract.name}</td>
<td>
<Link href={getAddressLink(contract.address, networkId)}>{contract.address}</Link>
</td>
</tr>
)
})}
{contracts.map((contract) => (
<tr key={contract.name}>
<td>{contract.name}</td>
<td>
<Link href={getAddressLink(contract.address, networkId)}>{contract.address}</Link>
</td>
</tr>
))}
</tbody>
</Table>
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading