From bd3f346e27c3413d52feae7204f3f69c5b58e200 Mon Sep 17 00:00:00 2001 From: Nicholas Zuber Date: Tue, 6 Nov 2018 00:19:20 -0500 Subject: [PATCH] Title updater and minor changes --- src/pages/Notifications/SceneAlt.js | 13 ++++++------- src/providers/Storage.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/pages/Notifications/SceneAlt.js b/src/pages/Notifications/SceneAlt.js index 43b742f..9456b17 100644 --- a/src/pages/Notifications/SceneAlt.js +++ b/src/pages/Notifications/SceneAlt.js @@ -69,9 +69,7 @@ const NavigationContainer = styled('div')({ boxSizing: 'border-box', margin: '0 auto', width: '100%', - background: 'none', height: 60, - backgroundColor: '#24292e', color: 'hsla(0,0%,100%,.75)', paddingBottom: '12px', paddingTop: '12px', @@ -397,12 +395,13 @@ const SmallLink = styled('a')({ display: 'block', marginRight: 10, cursor: 'pointer', - fontSize: 12, + fontSize: 10, lineHeight: '20px', - fontWeight: 600, - textDecoration: 'none', + fontWeight: 400, + textDecoration: 'underline', + transition: 'all 0.12s ease-in-out', ':hover': { - textDecoration: 'underline' + opacity: 0.75 } }); @@ -459,7 +458,7 @@ export default function Scene ({ return (
- +
this.setTitle(this.originalTitle); + } + + setTitle = title => { + if (document.title.indexOf('(1)') === -1 && document.title !== title) { + document.title = title; + } + } + /** * Loads up the notifications state with the cache. */ @@ -55,6 +72,18 @@ class StorageProvider extends React.Component { } return acc; }, []); + + // Document is out of focus, the we had notifications before this update, + // and there was a change in notifications in the most recent update. + if (!document.hasFocus() && + this.state.notifications.length > 0 && + notifications.length !== this.state.notifications.length + ) { + this.setTitle('(1) ' + this.originalTitle); + } else { + this.setTitle(this.originalTitle); + } + this.setState({ notifications }); // this.setState({ notifications: mockNotifications }); }