File tree Expand file tree Collapse file tree 8 files changed +471
-262
lines changed Expand file tree Collapse file tree 8 files changed +471
-262
lines changed Original file line number Diff line number Diff line change 1
- declare module "*developer-docs-links.yaml " {
2
- import { DeveloperDocsLink } from "./src/types"
3
- const content : Array < DeveloperDocsLink >
4
- export default content
5
- }
1
+ // declare module "./src/data/developerDocsLinks.json " {
2
+ // import { DeveloperDocsLink } from "./src/types"
3
+ // const content: Array<DeveloperDocsLink>
4
+ // export default content
5
+ // }
6
6
7
7
declare module "*.mp4" {
8
8
const src : string
Original file line number Diff line number Diff line change @@ -2,15 +2,17 @@ import React from "react"
2
2
import { ListItem , UnorderedList } from "@chakra-ui/react"
3
3
import Translation from "./Translation"
4
4
import Link from "./Link"
5
- import docLinks from "../data/developer-docs-links.yaml"
5
+ import { DeveloperDocsLink } from "../types"
6
+
7
+ import docLinks from "../data/developerDocsLinks.json"
6
8
7
9
export interface IProps {
8
10
headerId : string
9
11
}
10
12
11
13
const DeveloperDocsLinks : React . FC < IProps > = ( { headerId } ) => (
12
14
< React . Fragment >
13
- { docLinks
15
+ { ( docLinks as Array < DeveloperDocsLink > )
14
16
. filter ( ( { id } ) => id . includes ( headerId ) )
15
17
. map ( ( { items, id } ) => (
16
18
< UnorderedList ml = { 6 } spacing = { 3 } key = { id } >
@@ -26,7 +28,7 @@ const DeveloperDocsLinks: React.FC<IProps> = ({ headerId }) => (
26
28
) }
27
29
< i >
28
30
{ " – " }
29
- < Translation id = { description } />
31
+ < Translation id = { description ! } />
30
32
</ i >
31
33
< UnorderedList
32
34
ml = { 6 }
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import Link from "./Link"
13
13
import Emoji from "./Emoji"
14
14
import Translation from "./Translation"
15
15
16
- import docLinks from "../data/developer-docs-links.yaml "
16
+ import docLinks from "../data/developerDocsLinks.json "
17
17
import { DeveloperDocsLink } from "../types"
18
18
import { TranslationKey } from "../utils/translations"
19
19
@@ -102,13 +102,13 @@ const DocsNav: React.FC<IProps> = ({ relativePath }) => {
102
102
getDocs ( item . items )
103
103
} else {
104
104
// If object has no further 'items', add and continue
105
- docsArray . push ( { to : item . to , id : item . id } )
105
+ docsArray . push ( { to : item . to ! , id : item . id } )
106
106
}
107
107
}
108
108
}
109
109
110
- // Initiate recursive loop with full docLinks yaml
111
- getDocs ( docLinks )
110
+ // Initiate recursive loop with full docLinks json
111
+ getDocs ( docLinks as Array < DeveloperDocsLink > )
112
112
113
113
// Find index that matches current page
114
114
let currentIndex = 0
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import Link from "./Link"
8
8
import Translation from "./Translation"
9
9
import { dropdownIconContainerVariant } from "./SharedStyledComponents"
10
10
11
- import docLinks from "../data/developer-docs-links.yaml "
11
+ import docLinks from "../data/developerDocsLinks.json "
12
12
import { translateMessageId } from "../utils/translations"
13
13
import { DeveloperDocsLink } from "../types"
14
14
@@ -87,7 +87,7 @@ export interface IPropsNavLink {
87
87
}
88
88
89
89
const NavLink : React . FC < IPropsNavLink > = ( { item, path } ) => {
90
- const isLinkInPath = path . includes ( item . to ) || path . includes ( item . path )
90
+ const isLinkInPath = path . includes ( item . to ! ) || path . includes ( item . path )
91
91
const [ isOpen , setIsOpen ] = useState < boolean > ( isLinkInPath )
92
92
93
93
useEffect ( ( ) => {
@@ -158,7 +158,7 @@ const SideNav: React.FC<IProps> = ({ path }) => {
158
158
159
159
return (
160
160
< Nav aria-label = { translateMessageId ( "nav-developers-docs" , intl ) } >
161
- { docLinks . map ( ( item , idx ) => (
161
+ { ( docLinks as Array < DeveloperDocsLink > ) . map ( ( item , idx ) => (
162
162
< NavLink item = { item } path = { path } key = { idx } />
163
163
) ) }
164
164
</ Nav >
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { isLang } from "../utils/languages"
9
9
import { dropdownIconContainerVariant } from "./SharedStyledComponents"
10
10
import { IPropsNavLink as INavLinkProps } from "./SideNav"
11
11
12
- import docLinks from "../data/developer-docs-links.yaml "
12
+ import docLinks from "../data/developerDocsLinks.json "
13
13
import { DeveloperDocsLink } from "../types"
14
14
import { TranslationKey } from "../utils/translations"
15
15
@@ -182,7 +182,10 @@ const SideNavMobile: React.FC<IProps> = ({ path }) => {
182
182
if ( isLang ( pagePath . split ( "/" ) [ 1 ] ) ) {
183
183
pagePath = pagePath . substring ( 3 )
184
184
}
185
- let pageTitleId = getPageTitleId ( pagePath , docLinks )
185
+ let pageTitleId = getPageTitleId (
186
+ pagePath ,
187
+ docLinks as Array < DeveloperDocsLink >
188
+ )
186
189
if ( ! pageTitleId ) {
187
190
console . warn ( `No id found for "pagePath": ` , pagePath )
188
191
pageTitleId = `Change page` as TranslationKey
@@ -219,7 +222,7 @@ const SideNavMobile: React.FC<IProps> = ({ path }) => {
219
222
} ,
220
223
} }
221
224
>
222
- { docLinks . map ( ( item , idx ) => (
225
+ { ( docLinks as Array < DeveloperDocsLink > ) . map ( ( item , idx ) => (
223
226
< NavLink
224
227
item = { item }
225
228
path = { path }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments