Skip to content

Commit ef753e3

Browse files
authored
Update dependencies (#279)
1 parent b74df7b commit ef753e3

File tree

6 files changed

+186
-161
lines changed

6 files changed

+186
-161
lines changed

i18n.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,22 @@ import vi from '@/pages/vi/translations'
99
import zh from '@/pages/zh/translations'
1010

1111
const appLocales = [
12-
Locale.ENGLISH,
1312
Locale.ARABIC,
13+
Locale.ENGLISH,
1414
Locale.SPANISH,
1515
Locale.JAPANESE,
1616
Locale.KOREAN,
1717
Locale.VIETNAMESE,
1818
Locale.CHINESE,
1919
] as const
2020

21-
export type AppLocale = (typeof appLocales)[number]
21+
type Mutable<T> = {
22+
-readonly [P in keyof T]: T[P]
23+
}
24+
25+
export const supportedLocales = appLocales as Mutable<typeof appLocales>
26+
27+
export type AppLocale = (typeof supportedLocales)[number]
2228

2329
export type AppTranslations = Translations & {
2430
[key in AppLocale]: {
@@ -27,11 +33,9 @@ export type AppTranslations = Translations & {
2733
}
2834
}
2935

30-
export const supportedLocales = appLocales as unknown as Locale[]
31-
3236
export const translations = {
33-
en,
3437
ar,
38+
en,
3539
es,
3640
ja,
3741
ko,

layout/MDXLayoutNav.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as Collapsible from '@radix-ui/react-collapsible'
33
import { useRouter } from 'next/router'
44
import { Fragment, PropsWithChildren, useContext, useEffect, useState } from 'react'
55

6-
import { BorderRadius, buildTransition, Flex, Icon, Spacing, Text } from '@edgeandnode/components'
6+
import { BorderRadius, buildTransition, Flex, Icon, NestedStrings, Spacing, Text } from '@edgeandnode/components'
77

88
import { DocSearch, Link, NavTree } from '@/components'
99
import { useI18n } from '@/i18n'
@@ -166,7 +166,7 @@ export const MDXLayoutNav = ({ mobile = false }: { mobile?: boolean }) => {
166166
window.open(itemUrl, '_blank', 'noopener')
167167
},
168168
}}
169-
translations={translations.docsearch}
169+
translations={translations.docsearch as NestedStrings}
170170
placeholder={t('docsearch.button.buttonText')}
171171
/>
172172
</div>

navigation/navigation.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { translate } from '@edgeandnode/components'
2+
13
import { AppLocale, translations } from '@/i18n'
24

35
import { NavItemDefinition } from './types'
@@ -13,7 +15,7 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [
1315
slug: 'about',
1416
},
1517
{
16-
title: translations[locale].global.navigation.theGraphNetwork,
18+
title: translate(translations, locale, 'global.navigation.theGraphNetwork'),
1719
slug: 'network',
1820
children: [
1921
{
@@ -58,10 +60,10 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [
5860
divider: true,
5961
},
6062
{
61-
heading: translations[locale].global.navigation.subgraphs,
63+
heading: translate(translations, locale, 'global.navigation.subgraphs'),
6264
},
6365
{
64-
title: translations[locale].global.navigation.developing,
66+
title: translate(translations, locale, 'global.navigation.developing'),
6567
slug: 'developing',
6668
children: [
6769
{
@@ -85,7 +87,7 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [
8587
],
8688
},
8789
{
88-
title: translations[locale].global.navigation.deploying,
90+
title: translate(translations, locale, 'global.navigation.deploying'),
8991
slug: 'deploying',
9092
children: [
9193
{
@@ -106,7 +108,7 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [
106108
],
107109
},
108110
{
109-
title: translations[locale].global.navigation.publishing,
111+
title: translate(translations, locale, 'global.navigation.publishing'),
110112
slug: 'publishing',
111113
children: [
112114
{
@@ -115,7 +117,7 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [
115117
],
116118
},
117119
{
118-
title: translations[locale].global.navigation.managing,
120+
title: translate(translations, locale, 'global.navigation.managing'),
119121
slug: 'managing',
120122
children: [
121123
{
@@ -127,7 +129,7 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [
127129
],
128130
},
129131
{
130-
title: translations[locale].global.navigation.querying,
132+
title: translate(translations, locale, 'global.navigation.querying'),
131133
slug: 'querying',
132134
children: [
133135
{
@@ -154,7 +156,7 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [
154156
],
155157
},
156158
{
157-
title: translations[locale].global.navigation.cookbook,
159+
title: translate(translations, locale, 'global.navigation.cookbook'),
158160
slug: 'cookbook',
159161
children: [
160162
{
@@ -187,7 +189,7 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [
187189
divider: true,
188190
},
189191
{
190-
heading: translations[locale].global.navigation.indexing,
192+
heading: translate(translations, locale, 'global.navigation.indexing'),
191193
},
192194
{
193195
slug: 'operating-graph-node',
@@ -202,7 +204,7 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [
202204
divider: true,
203205
},
204206
{
205-
title: translations[locale].global.navigation.releaseNotes,
207+
title: translate(translations, locale, 'global.navigation.releaseNotes'),
206208
slug: 'release-notes',
207209
children: [
208210
{

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
},
2222
"dependencies": {
2323
"@docsearch/react": "^3.3.3",
24-
"@edgeandnode/components": "^25.1.0",
24+
"@edgeandnode/components": "^25.2.0",
2525
"@emotion/react": "^11.10.5",
26-
"@mdx-js/loader": "^2.2.1",
27-
"@mdx-js/react": "^2.2.1",
26+
"@mdx-js/loader": "^2.3.0",
27+
"@mdx-js/react": "^2.3.0",
2828
"@next/mdx": "^12.3.4",
2929
"@radix-ui/react-collapsible": "1.0.1",
3030
"@radix-ui/react-popover": "^1.0.3",
@@ -36,10 +36,10 @@
3636
"prism-react-renderer": "^1.3.5",
3737
"react": "^17.0.2",
3838
"react-dom": "^17.0.2",
39-
"react-intersection-observer": "^9.4.1",
39+
"react-intersection-observer": "^9.4.2",
4040
"react-use": "^17.4.0",
4141
"remark-gfm": "^3.0.1",
42-
"theme-ui": "^0.15.4",
42+
"theme-ui": "^0.15.5",
4343
"use-bus": "^2.5.2"
4444
},
4545
"devDependencies": {
@@ -53,11 +53,11 @@
5353
"@types/react-dom": "^17.0.18",
5454
"acorn": "^8.8.2",
5555
"acorn-jsx": "^5.3.2",
56-
"eslint": "^8.33.0",
56+
"eslint": "^8.34.0",
5757
"husky": "^8.0.3",
58-
"lint-staged": "^13.1.0",
58+
"lint-staged": "^13.1.1",
5959
"path": "^0.12.7",
60-
"prettier": "^2.8.3",
60+
"prettier": "^2.8.4",
6161
"remark-frontmatter": "^4.0.1",
6262
"remark-mdx-frontmatter": "^2.1.1",
6363
"serialize-as-code": "^2.0.2",

pages/[locale]/index.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
import { GetStaticPaths, GetStaticProps, NextPage } from 'next'
22
import { useMemo } from 'react'
33

4-
import { BorderRadius, buildBorder, buildShadow, buildTransition, Flex, Spacing, Text } from '@edgeandnode/components'
4+
import {
5+
BorderRadius,
6+
buildBorder,
7+
buildShadow,
8+
buildTransition,
9+
Flex,
10+
Spacing,
11+
Text,
12+
translate,
13+
} from '@edgeandnode/components'
514

615
import { Heading, Image, Link, LinkInline, Paragraph } from '@/components'
716
import { AppLocale, supportedLocales, translations, useI18n } from '@/i18n'
817
import { Frontmatter, MDXLayout, OutlineItem } from '@/layout'
918
import { getNavItems, NavItem } from '@/navigation'
1019

1120
export const frontmatter = (locale: AppLocale): Frontmatter => ({
12-
title: translations[locale].index.title,
21+
title: translate(translations, locale, 'index.title'),
1322
})
1423

1524
// TODO: Make DRY

0 commit comments

Comments
 (0)