diff --git a/client/coral-admin/src/containers/Dashboard/Dashboard.js b/client/coral-admin/src/containers/Dashboard/Dashboard.js index 5b4a20282..00af443d0 100644 --- a/client/coral-admin/src/containers/Dashboard/Dashboard.js +++ b/client/coral-admin/src/containers/Dashboard/Dashboard.js @@ -15,9 +15,22 @@ const refreshIntervalSeconds = 60 * 5; class Dashboard extends React.Component { - state = { - noteHidden: false, - secondsUntilRefresh: refreshIntervalSeconds + constructor (props) { + super(props); + + try { + if (window.localStorage.getItem('coral:dashboardNote') === null) { + window.localStorage.setItem('coral:dashboardNote', 'show'); + } + } catch (e) { + + // above will fail in Private Mode in some browsers. + } + + this.state = { + secondsUntilRefresh: refreshIntervalSeconds, + dashboardNote: window.localStorage.getItem('coral:dashboardNote') || 'show' + }; } componentWillMount () { @@ -31,6 +44,16 @@ class Dashboard extends React.Component { }, 1000); } + dismissNote = () => { + try { + window.localStorage.setItem('coral:dashboardNote', 'hide'); + } catch (e) { + + // when setItem fails in Safari Private mode + this.setState({dashboardNote: 'hide'}); + } + } + formatTime = () => { const minutes = Math.floor(this.state.secondsUntilRefresh / 60); let seconds = (this.state.secondsUntilRefresh % 60).toString(); @@ -48,13 +71,15 @@ class Dashboard extends React.Component { } const {data: {assetsByLike, assetsByFlag}} = this.props; + const hideReloadNote = window.localStorage.getItem('coral:dashboardNote') === 'hide' || + this.state.dashboardNote === 'hide'; // for Safari Incognito return (

this.setState({noteHidden: true})}> + onClick={this.dismissNote}> × {lang.t('dashboard.next-update', this.formatTime())} {lang.t('dashboard.auto-update')}