@@ -24,14 +24,6 @@ export const AppContainer = ({ slides: originalSlides, hash }) => {
24
24
AddSidebarComponent ( Sidebar ) ;
25
25
} ;
26
26
27
- const changeSidebarState = ( ) => {
28
- const isSidebar =
29
- params . get ( 'sidebar' ) === 'false' || ! process . env . SIDEBAR || mode !== 'common' ? false : true ;
30
-
31
- updateOpenSidebarStatus ( false ) ;
32
- updateSidebarStatus ( isSidebar ) ;
33
- } ;
34
-
35
27
const setContentViewComponent = async ( ) => {
36
28
if ( mode === 'common' ) {
37
29
AddContentComponent ( Base ) ;
@@ -77,17 +69,17 @@ export const AppContainer = ({ slides: originalSlides, hash }) => {
77
69
const [ mode , updateMode ] = useState ( initialMode ) ; // common, view, host
78
70
const [ slides , updateSlides ] = useState ( createdProps . slides ) ;
79
71
const [ contentsList , updateContentsList ] = useState ( createdProps . contentsList ) ;
80
- const [ isSidebar , updateSidebarStatus ] = useState ( true ) ;
81
72
const [ isOpenSidebar , updateOpenSidebarStatus ] = useState ( false ) ;
82
73
const [ currentIndex , updateCurrentIndex ] = useState ( index ) ;
83
74
const [ SidebarComponent , AddSidebarComponent ] = useState ( null ) ; // for lazyload
84
75
const [ ContentComponent , AddContentComponent ] = useState ( mode === 'common' ? Base : undefined ) ;
85
76
const [ CommentsListComponent , AddCommentsListComponents ] = useState ( null ) ; // for lazyload
86
77
87
78
useEffect ( ( ) => {
88
- changeSidebarState ( ) ;
79
+ const isSidebar =
80
+ params . get ( 'sidebar' ) === 'false' || ! process . env . SIDEBAR || mode !== 'common' ? false : true ;
89
81
90
- if ( ! SidebarComponent ) {
82
+ if ( isSidebar && ! SidebarComponent ) {
91
83
setSidebarComponent ( ) ;
92
84
}
93
85
@@ -117,19 +109,17 @@ export const AppContainer = ({ slides: originalSlides, hash }) => {
117
109
118
110
return (
119
111
< >
120
- { isSidebar && (
112
+ { SidebarComponent && (
121
113
< >
122
- { SidebarComponent && (
123
- < SidebarComponent
124
- goTo = { goTo }
125
- isOpen = { isOpenSidebar }
126
- terminate = { terminate }
127
- contents = { contentsList }
128
- onStateChange = { onSetSidebarOpen }
129
- currentIndex = { currentIndex }
130
- runPresentationMode = { onRunPresentationMode }
131
- />
132
- ) }
114
+ < SidebarComponent
115
+ goTo = { goTo }
116
+ isOpen = { isOpenSidebar }
117
+ terminate = { terminate }
118
+ contents = { contentsList }
119
+ onStateChange = { onSetSidebarOpen }
120
+ currentIndex = { currentIndex }
121
+ runPresentationMode = { onRunPresentationMode }
122
+ />
133
123
< MdMenu className = "btn-sidebar" onClick = { ( ) => onSetSidebarOpen ( { isOpen : true } ) } />
134
124
</ >
135
125
) }
0 commit comments