@@ -5,6 +5,7 @@ import { Meta, Title } from '@angular/platform-browser';
5
5
import { AbstractDataService } from '../../../common/abstract-data/abstract-data.service' ;
6
6
import { ActivatedRoute } from '@angular/router' ;
7
7
import { FretMapService } from '../../../common/fret-map/fret-map.service' ;
8
+ import { MetaService } from '../../../common/meta/meta.service' ;
8
9
9
10
@Component ( {
10
11
selector : 'app-home-index' ,
@@ -20,24 +21,21 @@ export class HomeIndexComponent implements OnInit {
20
21
modeSelectorObjects = ModeSelectorObjects ;
21
22
octave = Octave ;
22
23
showHowTo ;
23
- metaExtender ;
24
-
24
+
25
25
constructor (
26
26
private title : Title ,
27
27
private meta : Meta ,
28
28
private localStorage : AbstractDataService ,
29
29
private activatedRoute : ActivatedRoute ,
30
- private fretMapService : FretMapService
31
- ) { }
30
+ private fretMapService : FretMapService ,
31
+ private metaService : MetaService
32
+ ) {
33
+ }
32
34
33
35
ngOnInit ( ) : void {
34
36
this . activatedRoute . params . subscribe ( ( ) => this . onRouteChange ( ) ) ;
35
-
36
- this . title . setTitle ( 'Fretonator - the ultimate interactive free guitar theory tool' + this . metaExtender ) ;
37
- this . meta . updateTag ( {
38
- name : 'description' ,
39
- content : 'The ultimate interactive free guitar theory tool. Choose a starting note, pick a mode, check out the fretboard and have a jam!'
40
- } ) ;
37
+ this . setHomePageTitle ( ) ;
38
+ this . setHomePageMetaDescription ( ) ;
41
39
42
40
const _showHowTo = this . localStorage . getItem ( 'showHowTo' ) ;
43
41
switch ( _showHowTo ) {
@@ -71,21 +69,25 @@ export class HomeIndexComponent implements OnInit {
71
69
this . noteExtender = NoteExtenderSymbol . natural ;
72
70
}
73
71
74
- this . metaExtender =
75
- ' | ' +
76
- this . fretMapService . convertFretMapConfigurationToDisplayString (
77
- this . note ,
78
- this . noteExtenderString ,
79
- this . mode
80
- ) ;
81
- this . title . setTitle (
82
- 'Fretonator - the ultimate interactive free guitar theory tool' +
83
- this . metaExtender
84
- ) ;
72
+ this . setHomePageTitle ( ) ;
73
+ this . setHomePageMetaDescription ( ) ;
85
74
}
86
75
87
76
toggleHowTo ( ) {
88
77
this . showHowTo = ! this . showHowTo ;
89
78
this . localStorage . setItem ( 'showHowTo' , this . showHowTo ) ;
90
79
}
80
+
81
+ setHomePageTitle ( ) {
82
+ this . title . setTitle (
83
+ this . metaService . generateHomePageTitle ( this . note , this . noteExtenderString , this . mode )
84
+ ) ;
85
+ }
86
+
87
+ setHomePageMetaDescription ( ) {
88
+ this . meta . updateTag ( {
89
+ name : 'description' ,
90
+ content : this . metaService . generateHomePageMetaDescription ( this . note , this . noteExtenderString , this . mode )
91
+ } ) ;
92
+ }
91
93
}
0 commit comments