Skip to content

Commit

Permalink
Merge branch 'master' into quochuy-author_desc_ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
roadscape authored May 20, 2019
2 parents dab806d + 5f1db7e commit 3b3940d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/app/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,30 @@ class App extends React.Component {
this.setState({ gptBannerHeight: height });
}

toggleBodyNightmode(nightmodeEnabled) {
if (nightmodeEnabled) {
document.body.classList.remove('theme-light');
document.body.classList.add('theme-dark');
} else {
document.body.classList.remove('theme-dark');
document.body.classList.add('theme-light');
}
}

componentWillReceiveProps(nextProps) {
const { nightmodeEnabled } = nextProps;
this.toggleBodyNightmode(nightmodeEnabled);
}

componentWillMount() {
if (process.env.BROWSER) localStorage.removeItem('autopost'); // July 14 '16 compromise, renamed to autopost2
this.props.loginUser();
}

componentDidMount() {
const { nightmodeEnabled } = this.props;
this.toggleBodyNightmode(nightmodeEnabled);

window.addEventListener('gptadshown', this.gptadshownListener);
}

Expand Down

0 comments on commit 3b3940d

Please sign in to comment.