File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
packages/core-theme-documentation-generator/src Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 1
1
import {
2
2
DefaultTheme ,
3
3
DefaultThemeRenderContext ,
4
- JSX , // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
5
+ JSX ,
5
6
PageEvent ,
6
7
Reflection ,
7
8
ReflectionCategory ,
9
+ ReflectionKind ,
8
10
} from "typedoc" ;
9
11
10
12
class SdkThemeContext extends DefaultThemeRenderContext {
11
13
override primaryNavigation = ( props : PageEvent < Reflection > ) => {
12
- const defaultGroup = this . options . getValue ( "defaultGroup" ) as string ;
13
- const { categories } = props . model ?. [ "groups" ] ?. find ( ( value ) => value . title === defaultGroup ) ?? { } ;
14
+ const categories = [ ] ;
15
+ try {
16
+ const defaultGroup = this . options . getValue ( "defaultGroup" ) as string ;
17
+ const group = props . model ?. [ "groups" ] ?. find ( ( value ) => value . title === defaultGroup ) ?? { } ;
18
+ categories . push ( ...( group . categories || [ ] ) ) ;
19
+ } catch ( err ) {
20
+ console . warn ( "No value was set for `defaultGroup` options" ) ;
21
+ if ( props . model . isProject ( ) ) {
22
+ const category = new ReflectionCategory ( "Modules" ) ;
23
+ category . children . push ( ...props . model . getChildrenByKind ( ReflectionKind . SomeModule ) ) ;
24
+ categories . push ( category ) ;
25
+ }
26
+ }
14
27
if ( categories ?. length ) {
15
28
const selected = props . model . isProject ( ) ;
16
29
You can’t perform that action at this time.
0 commit comments