@@ -13,6 +13,7 @@ import { setMainPanelContent, toggleAutoRefresh } from '../../actions/ui'
13
13
import { findStop , findStopTimesForStop } from '../../actions/api'
14
14
import { forgetStop , rememberStop , setLocation } from '../../actions/map'
15
15
import { routeComparator } from '../../util/itinerary'
16
+ import { getShowUserSettings } from '../../util/state'
16
17
import { formatDuration , formatStopTime , getTimeFormat } from '../../util/time'
17
18
18
19
class StopViewer extends Component {
@@ -110,9 +111,10 @@ class StopViewer extends Component {
110
111
111
112
render ( ) {
112
113
const {
113
- stopData,
114
114
hideBackButton,
115
115
homeTimezone,
116
+ showUserSettings,
117
+ stopData,
116
118
stopViewerArriving,
117
119
timeFormat
118
120
} = this . props
@@ -166,17 +168,20 @@ class StopViewer extends Component {
166
168
? < span > { stopData . name } </ span >
167
169
: < span > Loading Stop...</ span >
168
170
}
169
- < Button
170
- onClick = { this . _toggleFavorite }
171
- bsSize = 'large'
172
- style = { {
173
- color : this . _isFavorite ( ) ? 'yellow' : 'black' ,
174
- padding : 0 ,
175
- marginLeft : '5px'
176
- } }
177
- bsStyle = 'link' >
178
- < Icon type = { this . _isFavorite ( ) ? 'star' : 'star-o' } />
179
- </ Button >
171
+ { showUserSettings
172
+ ? < Button
173
+ onClick = { this . _toggleFavorite }
174
+ bsSize = 'large'
175
+ style = { {
176
+ color : this . _isFavorite ( ) ? 'yellow' : 'black' ,
177
+ padding : 0 ,
178
+ marginLeft : '5px'
179
+ } }
180
+ bsStyle = 'link' >
181
+ < Icon type = { this . _isFavorite ( ) ? 'star' : 'star-o' } />
182
+ </ Button >
183
+ : null
184
+ }
180
185
</ div >
181
186
< div style = { { clear : 'both' } } />
182
187
</ div >
@@ -376,7 +381,11 @@ class PatternRow extends Component {
376
381
377
382
const ONE_HOUR_IN_SECONDS = 3600
378
383
379
- function getHomeTime ( homeTimezone ) {
384
+ /**
385
+ * @param {string } [homeTimezone='America/New_York'] Timezone string
386
+ * @return {number } Current time in home timezone in seconds since midnight
387
+ */
388
+ function getHomeTime ( homeTimezone = 'America/New_York' ) {
380
389
const now = moment ( )
381
390
return now . tz ( homeTimezone ) . diff ( now . clone ( ) . startOf ( 'day' ) , 'seconds' )
382
391
}
@@ -475,11 +484,13 @@ function getStatusLabel (delay) {
475
484
// connect to redux store
476
485
477
486
const mapStateToProps = ( state , ownProps ) => {
487
+ const showUserSettings = getShowUserSettings ( state . otp )
478
488
return {
479
489
autoRefreshStopTimes : state . otp . user . autoRefreshStopTimes ,
480
490
favoriteStops : state . otp . user . favoriteStops ,
481
491
homeTimezone : state . otp . config . homeTimezone ,
482
492
viewedStop : state . otp . ui . viewedStop ,
493
+ showUserSettings,
483
494
stopData : state . otp . transitIndex . stops [ state . otp . ui . viewedStop . stopId ] ,
484
495
stopViewerArriving : state . otp . config . language . stopViewerArriving ,
485
496
timeFormat : getTimeFormat ( state . otp . config )
0 commit comments