@@ -13,6 +13,7 @@ import { setMainPanelContent, toggleAutoRefresh } from '../../actions/ui'
1313import { findStop , findStopTimesForStop } from '../../actions/api'
1414import { forgetStop , rememberStop , setLocation } from '../../actions/map'
1515import { routeComparator } from '../../util/itinerary'
16+ import { getShowUserSettings } from '../../util/state'
1617import { formatDuration , formatStopTime , getTimeFormat } from '../../util/time'
1718
1819class StopViewer extends Component {
@@ -110,9 +111,10 @@ class StopViewer extends Component {
110111
111112 render ( ) {
112113 const {
113- stopData,
114114 hideBackButton,
115115 homeTimezone,
116+ showUserSettings,
117+ stopData,
116118 stopViewerArriving,
117119 timeFormat
118120 } = this . props
@@ -166,17 +168,20 @@ class StopViewer extends Component {
166168 ? < span > { stopData . name } </ span >
167169 : < span > Loading Stop...</ span >
168170 }
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+ }
180185 </ div >
181186 < div style = { { clear : 'both' } } />
182187 </ div >
@@ -376,7 +381,11 @@ class PatternRow extends Component {
376381
377382const ONE_HOUR_IN_SECONDS = 3600
378383
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' ) {
380389 const now = moment ( )
381390 return now . tz ( homeTimezone ) . diff ( now . clone ( ) . startOf ( 'day' ) , 'seconds' )
382391}
@@ -475,11 +484,13 @@ function getStatusLabel (delay) {
475484// connect to redux store
476485
477486const mapStateToProps = ( state , ownProps ) => {
487+ const showUserSettings = getShowUserSettings ( state . otp )
478488 return {
479489 autoRefreshStopTimes : state . otp . user . autoRefreshStopTimes ,
480490 favoriteStops : state . otp . user . favoriteStops ,
481491 homeTimezone : state . otp . config . homeTimezone ,
482492 viewedStop : state . otp . ui . viewedStop ,
493+ showUserSettings,
483494 stopData : state . otp . transitIndex . stops [ state . otp . ui . viewedStop . stopId ] ,
484495 stopViewerArriving : state . otp . config . language . stopViewerArriving ,
485496 timeFormat : getTimeFormat ( state . otp . config )
0 commit comments