@@ -9,15 +9,15 @@ type PreferenceNavigationProperties = {
9
9
} ;
10
10
11
11
export default class PreferenceNavigation {
12
- navigationItems : NavigationItem [ ] ;
12
+ navigationItems : Array < { navigationItem : NavigationItem ; label : string } > ;
13
13
$el : Element ;
14
14
constructor ( private readonly properties : PreferenceNavigationProperties ) {
15
15
this . navigationItems = [
16
- "General" ,
17
- "Network" ,
18
- "AddServer" ,
19
- "Organizations" ,
20
- "Shortcuts" ,
16
+ { navigationItem : "General" , label : t . __ ( "General" ) } ,
17
+ { navigationItem : "Network" , label : t . __ ( "Network" ) } ,
18
+ { navigationItem : "AddServer" , label : t . __ ( "Add Organization" ) } ,
19
+ { navigationItem : "Organizations" , label : t . __ ( "Organizations" ) } ,
20
+ { navigationItem : "Shortcuts" , label : t . __ ( "Shortcuts" ) } ,
21
21
] ;
22
22
23
23
this . $el = generateNodeFromHtml ( this . templateHtml ( ) ) ;
@@ -28,11 +28,8 @@ export default class PreferenceNavigation {
28
28
templateHtml ( ) : Html {
29
29
const navigationItemsHtml = html `` . join (
30
30
this . navigationItems . map (
31
- ( navigationItem ) => html `
32
- < div class ="nav " id ="nav- ${ navigationItem } ">
33
- ${ t . __ ( navigationItem ) }
34
- </ div >
35
- ` ,
31
+ ( { navigationItem, label} ) =>
32
+ html `< div class ="nav " id ="nav- ${ navigationItem } "> ${ label } </ div > ` ,
36
33
) ,
37
34
) ;
38
35
@@ -45,7 +42,7 @@ export default class PreferenceNavigation {
45
42
}
46
43
47
44
registerListeners ( ) : void {
48
- for ( const navigationItem of this . navigationItems ) {
45
+ for ( const { navigationItem} of this . navigationItems ) {
49
46
const $item = this . $el . querySelector (
50
47
`#nav-${ CSS . escape ( navigationItem ) } ` ,
51
48
) ! ;
@@ -56,7 +53,7 @@ export default class PreferenceNavigation {
56
53
}
57
54
58
55
select ( navigationItemToSelect : NavigationItem ) : void {
59
- for ( const navigationItem of this . navigationItems ) {
56
+ for ( const { navigationItem} of this . navigationItems ) {
60
57
if ( navigationItem === navigationItemToSelect ) {
61
58
this . activate ( navigationItem ) ;
62
59
} else {
0 commit comments