@@ -45,11 +45,29 @@ function LauncherBody(props: {
4545    props ; 
4646  const  [ query ,  updateQuery ]  =  React . useState < string > ( '' ) ; 
4747  const  [ ,  forceUpdate ]  =  React . useReducer ( x  =>  x  +  1 ,  0 ) ; 
48+   const  [ showCreateEmpty ,  updateCreateEmpty ]  =  React . useState < 
49+     ISettingsLayout [ 'createEmptySection' ] 
50+   > ( 
51+     props . settings . composite 
52+       . createEmptySection  as  ISettingsLayout [ 'createEmptySection' ] 
53+   ) ; 
4854  const  [ showStarred ,  updateShowStarred ]  =  React . useState < 
4955    ISettingsLayout [ 'starredSection' ] 
5056  > ( 
5157    props . settings . composite . starredSection  as  ISettingsLayout [ 'starredSection' ] 
5258  ) ; 
59+   const  [ showNotebookLauncher ,  updateShowNotebookLauncher ]  =  React . useState < 
60+     ISettingsLayout [ 'launchNotebookSection' ] 
61+   > ( 
62+     props . settings . composite 
63+       . launchNotebookSection  as  ISettingsLayout [ 'launchNotebookSection' ] 
64+   ) ; 
65+   const  [ showConsole ,  updateShowConsole ]  =  React . useState < 
66+     ISettingsLayout [ 'launchConsoleSection' ] 
67+   > ( 
68+     props . settings . composite 
69+       . launchConsoleSection  as  ISettingsLayout [ 'launchConsoleSection' ] 
70+   ) ; 
5371
5472  const  [ searchAll ,  updateSearchAll ]  =  React . useState < 
5573    ISettingsLayout [ 'searchAllSections' ] 
@@ -59,11 +77,27 @@ function LauncherBody(props: {
5977  ) ; 
6078
6179  const  syncSettings  =  ( )  =>  { 
80+     const  newShowCreateEmpty  =  props . settings . composite 
81+       . createEmptySection  as  ISettingsLayout [ 'createEmptySection' ] ; 
82+     if  ( showCreateEmpty  !==  newShowCreateEmpty )  { 
83+       updateCreateEmpty ( newShowCreateEmpty ) ; 
84+     } 
6285    const  newStarred  =  props . settings . composite 
6386      . starredSection  as  ISettingsLayout [ 'starredSection' ] ; 
6487    if  ( showStarred  !==  newStarred )  { 
6588      updateShowStarred ( newStarred ) ; 
6689    } 
90+     const  newShowConsole  =  props . settings . composite 
91+       . launchConsoleSection  as  ISettingsLayout [ 'launchConsoleSection' ] ; 
92+     if  ( showConsole  !==  newShowConsole )  { 
93+       updateShowConsole ( newShowConsole ) ; 
94+     } 
95+     const  newShowNotebook  =  props . settings . composite 
96+       . launchNotebookSection  as  ISettingsLayout [ 'launchNotebookSection' ] ; 
97+     if  ( showNotebookLauncher  !==  newShowNotebook )  { 
98+       updateShowNotebookLauncher ( newShowNotebook ) ; 
99+     } 
100+ 
67101    const  newSearchAll  =  props . settings . composite 
68102      . searchAllSections  as  ISettingsLayout [ 'searchAllSections' ] ; 
69103    if  ( searchAll  !==  newSearchAll )  { 
@@ -80,9 +114,18 @@ function LauncherBody(props: {
80114
81115  if  ( favouritesChanged )  { 
82116    const  updateIfNeeded  =  ( )  =>  { 
117+       if  ( showCreateEmpty )  { 
118+         forceUpdate ( ) ; 
119+       } 
83120      if  ( showStarred )  { 
84121        forceUpdate ( ) ; 
85122      } 
123+       if  ( showNotebookLauncher )  { 
124+         forceUpdate ( ) ; 
125+       } 
126+       if  ( showConsole )  { 
127+         forceUpdate ( ) ; 
128+       } 
86129    } ; 
87130    React . useEffect ( ( )  =>  { 
88131      favouritesChanged . connect ( updateIfNeeded ) ; 
@@ -110,8 +153,9 @@ function LauncherBody(props: {
110153  const  startCollapsed  =  props . settings . composite 
111154    . collapsedSections  as  ISettingsLayout [ 'collapsedSections' ] ; 
112155
113-   const  builtinSections : ISectionOptions [ ]  =  [ 
114-     { 
156+   const  builtinSections : ISectionOptions [ ]  =  [ ] ; 
157+   if  ( showCreateEmpty )  { 
158+     builtinSections . push ( { 
115159      className : 'jp-Launcher-openByType' , 
116160      title : trans . __ ( 'Create Empty' ) , 
117161      icon : fileIcon , 
@@ -125,8 +169,36 @@ function LauncherBody(props: {
125169              item . label . toLowerCase ( ) . indexOf ( query . toLowerCase ( ) )  !==  - 1 
126170          ) 
127171          . map ( item  =>  < TypeCard  item = { item }  trans = { trans }  /> ) 
128-     } , 
129-     { 
172+     } ) ; 
173+   } 
174+   if  ( showStarred )  { 
175+     builtinSections . push ( { 
176+       className : 'jp-Launcher-openByKernel' , 
177+       title : trans . __ ( 'Starred' ) , 
178+       icon : starIcon , 
179+       id : 'starred' , 
180+       rank : 2 , 
181+       render : ( )  => 
182+         starred . length  >  0  ? ( 
183+           < KernelTable 
184+             items = { starred } 
185+             commands = { props . commands } 
186+             showSearchBox = { ! searchAll } 
187+             showWidgetType = { true } 
188+             query = { query } 
189+             settings = { props . settings } 
190+             trans = { trans } 
191+             onClick = { item  =>  item . execute ( ) } 
192+             favouritesChanged = { props . favouritesChanged } 
193+             lastUsedChanged = { props . lastUsedChanged } 
194+           /> 
195+         )  : ( 
196+           trans . __ ( 'No starred items' ) 
197+         ) 
198+     } ) ; 
199+   } 
200+   if  ( showNotebookLauncher )  { 
201+     builtinSections . push ( { 
130202      className : 'jp-Launcher-openByKernel jp-Launcher-launchNotebook' , 
131203      title : trans . __ ( 'Launch New Notebook' ) , 
132204      icon : notebookIcon , 
@@ -145,8 +217,10 @@ function LauncherBody(props: {
145217          lastUsedChanged = { props . lastUsedChanged } 
146218        /> 
147219      ) 
148-     } , 
149-     { 
220+     } ) ; 
221+   } 
222+   if  ( showConsole )  { 
223+     builtinSections . push ( { 
150224      className : 'jp-Launcher-openByKernel jp-Launcher-launchConsole' , 
151225      title : trans . __ ( 'Launch New Console' ) , 
152226      icon : consoleIcon , 
@@ -165,32 +239,6 @@ function LauncherBody(props: {
165239          lastUsedChanged = { props . lastUsedChanged } 
166240        /> 
167241      ) 
168-     } 
169-   ] ; 
170-   if  ( showStarred )  { 
171-     builtinSections . push ( { 
172-       className : 'jp-Launcher-openByKernel' , 
173-       title : trans . __ ( 'Starred' ) , 
174-       icon : starIcon , 
175-       id : 'starred' , 
176-       rank : 2 , 
177-       render : ( )  => 
178-         starred . length  >  0  ? ( 
179-           < KernelTable 
180-             items = { starred } 
181-             commands = { props . commands } 
182-             showSearchBox = { ! searchAll } 
183-             showWidgetType = { true } 
184-             query = { query } 
185-             settings = { props . settings } 
186-             trans = { trans } 
187-             onClick = { item  =>  item . execute ( ) } 
188-             favouritesChanged = { props . favouritesChanged } 
189-             lastUsedChanged = { props . lastUsedChanged } 
190-           /> 
191-         )  : ( 
192-           'No starred items' 
193-         ) 
194242    } ) ; 
195243  } 
196244  const  allSections  =  [ ...builtinSections ,  ...props . sections ] ; 
0 commit comments