@@ -7,7 +7,7 @@ const PreferencesInput = props => (
7
7
< section >
8
8
< input type = "checkbox" id = { props . prefName } name = { props . prefName } checked = { props . value } onChange = { props . onChange } className = { props . className } />
9
9
< label htmlFor = { props . prefName } >
10
- < FormattedMessage id = { props . titleStringId } />
10
+ < FormattedMessage id = { props . titleStringId } values = { props . titleStringValues } />
11
11
</ label >
12
12
{ props . descStringId && < p className = "prefs-input-description" > < FormattedMessage id = { props . descStringId } /> </ p > }
13
13
</ section >
@@ -20,6 +20,13 @@ class PreferencesPane extends React.Component {
20
20
this . handleClickOutside = this . handleClickOutside . bind ( this ) ;
21
21
this . handleChange = this . handleChange . bind ( this ) ;
22
22
this . togglePane = this . togglePane . bind ( this ) ;
23
+
24
+ // TODO This is temporary until sections register their PreferenceInput component automatically
25
+ try {
26
+ this . topStoriesOptions = JSON . parse ( props . Prefs . values [ "feeds.section.topstories.options" ] ) ;
27
+ } catch ( e ) {
28
+ console . error ( "Problem parsing feeds.section.topstories.options" , e ) ; // eslint-disable-line no-console
29
+ }
23
30
}
24
31
componentDidMount ( ) {
25
32
document . addEventListener ( "click" , this . handleClickOutside ) ;
@@ -66,9 +73,10 @@ class PreferencesPane extends React.Component {
66
73
< PreferencesInput className = "showTopSites" prefName = "showTopSites" value = { prefs . showTopSites } onChange = { this . handleChange }
67
74
titleStringId = "settings_pane_topsites_header" descStringId = "settings_pane_topsites_body" />
68
75
69
- < PreferencesInput className = "showTopStories" prefName = "feeds.section.topstories" value = { prefs [ "feeds.section.topstories" ] } onChange = { this . handleChange }
70
- titleStringId = "settings_pane_pocketstories_header" descStringId = "settings_pane_pocketstories_body" />
71
-
76
+ { this . topStoriesOptions && < PreferencesInput className = "showTopStories" prefName = "feeds.section.topstories"
77
+ value = { prefs [ "feeds.section.topstories" ] } onChange = { this . handleChange }
78
+ titleStringId = "header_recommended_by" titleStringValues = { { provider : this . topStoriesOptions . provider_name } }
79
+ descStringId = { this . topStoriesOptions . provider_description } /> }
72
80
</ div >
73
81
< section className = "actions" >
74
82
< button className = "done" onClick = { this . togglePane } >
0 commit comments