1
- import React from ' react' ;
1
+ import React from " react" ;
2
2
import Layout from "@theme/Layout" ;
3
3
import ParserOpenRPC from "@site/src/components/ParserOpenRPC" ;
4
- import DocSidebar from ' @theme/DocSidebar' ;
4
+ import DocSidebar from " @theme/DocSidebar" ;
5
5
import { useLocation } from "@docusaurus/router" ;
6
- import { prepareLinkItems , MM_REF_PATH } from ' @site/src/plugins/plugin-json-rpc' ;
6
+ import { prepareLinkItems , MM_REF_PATH } from " @site/src/plugins/plugin-json-rpc" ;
7
7
import styles from "./styles.module.css" ;
8
8
const sidebar = require ( "../../../wallet-sidebar.js" ) ;
9
9
@@ -29,39 +29,48 @@ function transformItems(items, dynamicItems) {
29
29
}
30
30
}
31
31
if ( newItem . href ) {
32
+ if ( ! newItem . href . startsWith ( "/" ) ) {
33
+ newItem . href = `/${ newItem . href } ` ;
34
+ }
32
35
if ( newItem . href . endsWith ( "/index" ) ) {
33
36
newItem . href = newItem . href . slice ( 0 , - 5 ) ;
34
37
}
35
- if ( ! newItem . href . startsWith ( "/" ) ) {
36
- newItem . href = `/${ newItem . href } ` ;
38
+ if ( newItem . href === "/" ) {
39
+ newItem . href = "/wallet/" ;
40
+ } else {
41
+ newItem . href = `/wallet${ newItem . href } ` ;
37
42
}
38
- newItem . href = `/wallet${ newItem . href } ` ;
39
43
}
40
44
return newItem ;
41
45
} ) ;
42
46
}
43
47
44
- const CustomReferencePage = ( props ) => {
48
+ const CustomReferencePage = props => {
45
49
const customData = props . route . customData ;
46
50
const { pathname } = useLocation ( ) ;
47
- const refItems = prepareLinkItems ( props . methodsData , MM_REF_PATH ) . map ( item => ( { ...item , href : item . href . replace ( "/wallet" , "" ) } ) )
51
+ const refItems = prepareLinkItems ( props . methodsData , MM_REF_PATH ) . map ( item => ( {
52
+ ...item ,
53
+ href : item . href . replace ( "/wallet" , "" ) ,
54
+ } ) ) ;
48
55
const updatedSidebar = transformItems ( sidebar . walletSidebar , refItems ) ;
49
56
return (
50
57
< Layout >
51
58
< div className = { styles . pageWrapper } >
52
59
< aside >
53
60
< div className = { styles . sidebarViewport } >
54
61
< div className = { styles . sidebar } >
55
- < DocSidebar sidebar = { updatedSidebar } path = { pathname } onCollapse = { ( ) => { } } isHidden = { false } />
62
+ < DocSidebar
63
+ sidebar = { updatedSidebar }
64
+ path = { pathname }
65
+ onCollapse = { ( ) => { } }
66
+ isHidden = { false }
67
+ />
56
68
</ div >
57
69
</ div >
58
70
</ aside >
59
71
< div className = { styles . mainContainer } >
60
72
< div className = { styles . contentWrapper } >
61
- < ParserOpenRPC
62
- network = { customData . networkName }
63
- method = { customData . name }
64
- />
73
+ < ParserOpenRPC network = { customData . networkName } method = { customData . name } />
65
74
</ div >
66
75
</ div >
67
76
</ div >
0 commit comments