diff --git a/src/pages/Notifications/SceneAlt.js b/src/pages/Notifications/SceneAlt.js index 0b554f0..43b742f 100644 --- a/src/pages/Notifications/SceneAlt.js +++ b/src/pages/Notifications/SceneAlt.js @@ -38,6 +38,9 @@ function getRelativeTime (time) { } const FixedContainer = styled('div')({ + height: '80%', + maxWidth: 270, + display: 'block', position: 'fixed' }); @@ -167,10 +170,22 @@ const NavTab = styled('a')({ ':hover': { background: 'rgba(190, 197, 208, 0.25)', }, -}, ({ active, color }) => active && ({ +}, ({ number }) => ({ + ':after': number > 0 && { + content: `"${number}"`, + color: '#ffffff', + background: '#a8a8a9', + fontSize: '10px', + verticalAlign: 'text-top', + padding: '1px 8px', + borderRadius: '4px', + marginLeft: '6px', + display: 'inline-block', + } +}), ({ active, color, number }) => active && ({ color, opacity: 1, - ':after': { + ':before': { content: '""', position: 'absolute', background: color, @@ -180,6 +195,17 @@ const NavTab = styled('a')({ left: '5%', borderTopLeftRadius: '4px', borderTopRightRadius: '4px', + }, + ':after': number > 0 && { + content: `"${number}"`, + color: '#ffffff', + background: color, + fontSize: '10px', + verticalAlign: 'text-top', + padding: '1px 8px', + borderRadius: '4px', + marginLeft: '6px', + display: 'inline-block', } })); @@ -249,7 +275,7 @@ const SearchField = styled('div')({ const Message = styled('div')({ display: 'block', textAlign: 'center', - marginTop: 96, + marginTop: 24 * 5, 'p': { paddingTop: 24, userSelect: 'none', @@ -367,9 +393,21 @@ const TableItem = styled('td')({ flex })); +const SmallLink = styled('a')({ + display: 'block', + marginRight: 10, + cursor: 'pointer', + fontSize: 12, + lineHeight: '20px', + fontWeight: 600, + textDecoration: 'none', + ':hover': { + textDecoration: 'underline' + } +}); + function getPRIssueIcon (type, reasons) { const grow = 1.0; - switch (type) { case 'PullRequest': return ( @@ -385,6 +423,9 @@ function getPRIssueIcon (type, reasons) { } export default function Scene ({ + queuedCount, + stagedCount, + closedCount, first, last, lastPage, @@ -416,12 +457,6 @@ export default function Scene ({ console.warn('before render in scene', notifications) - if (query) { - notifications = notifications.filter(n => ( - n.name.toLowerCase().indexOf(query.toLowerCase()) > -1) - ) - } - return (
@@ -505,14 +540,14 @@ export default function Scene ({ }}>{moment().format('dddd, MMMM Do')} You've triaged {stagedTodayCount} notifications today
onSetActiveFilter(Filters.ALL)}> {activeFilter === Filters.ALL ? ( @@ -535,7 +570,7 @@ export default function Scene ({ onSetActiveFilter(Filters.COMMENT)}> {activeFilter === Filters.COMMENT ? ( @@ -544,6 +579,24 @@ export default function Scene ({ )} commented +
+ bar chart, statistics, etc +
+
+ Report bugs + Submit feedback + See source code +
@@ -560,14 +613,18 @@ export default function Scene ({ onClearCache()) : undefined} + onClick={!isLoading ? (() => { + const response = window.confirm('Are you sure you want to clear the cache?'); + if (response) { + onClearCache(); + } + }) : undefined} /> {query ? (
onSetActiveStatus(Status.QUEUED)} - href="#"> + href="javascript:void(0);"> Queued onSetActiveStatus(Status.STAGED)} - href="#"> + href="javascript:void(0);"> Staged onSetActiveStatus(Status.CLOSED)} - href="#"> + href="javascript:void(0);"> Closed diff --git a/src/pages/Notifications/index.js b/src/pages/Notifications/index.js index 81b07db..4b5e30c 100644 --- a/src/pages/Notifications/index.js +++ b/src/pages/Notifications/index.js @@ -32,7 +32,7 @@ const PER_PAGE = 15; * - REVIEW_REQUESTED -> 20 * - SUBSCRIBED -> 3 * - COMMENT -> 3 - * - AUTHOR -> 6 + * - AUTHOR -> 10 * - OTHER -> 2 * * There are some rules that go to giving out these scores, primarily being the @@ -82,13 +82,14 @@ function badgesOf (notification) { // If there's a lot of activity going on within the thread in general. // The specific nunmber should be relative to average number of thread lengths. // We can track a running statistic as we see notifications update. - if (len > 8) { + if (len > 6) { badges.push(Badges.COMMENTS); } // If you've been tagged in for review and the most recent update happened over // 4 hours ago, that specific time is subject to change. + // @TODO i changed this to 1 for testing, that's def too early. if (notification.reasons.some(r => r.reason === Reasons.REVIEW_REQUESTED) && - moment().diff(moment(notification.reasons[notification.reasons.length - 1].time).hours, 'hours') > 4) { + moment().diff(moment(notification.reasons[notification.reasons.length - 1].time).hours, 'hours') > 1) { badges.push(Badges.OLD); } return badges; @@ -96,7 +97,7 @@ function badgesOf (notification) { const scoreOfReason = { [Reasons.ASSIGN]: 14, - [Reasons.AUTHOR]: 6, + [Reasons.AUTHOR]: 10, [Reasons.MENTION]: 8, [Reasons.OTHER]: 2, [Reasons.REVIEW_REQUESTED]: 20, @@ -231,10 +232,18 @@ class NotificationsPage extends React.Component { notificationsToRender = notificationsQueued; } - const scoredAndSortedNotifications = notificationsToRender + let scoredAndSortedNotifications = notificationsToRender .map(decorateWithScore) .sort((a, b) => b.score - a.score); + // We gotta make sure to search notifications before we paginate. + // Otherwise we'd just end up searching on the current page, which is bad. + if (this.state.query) { + scoredAndSortedNotifications = scoredAndSortedNotifications.filter(n => ( + n.name.toLowerCase().indexOf(this.state.query.toLowerCase()) > -1) + ) + } + let firstIndex = (this.state.currentPage - 1) * PER_PAGE; let lastIndex = (this.state.currentPage * PER_PAGE); let notificationsOnPage = scoredAndSortedNotifications.slice(firstIndex, lastIndex); @@ -255,6 +264,9 @@ class NotificationsPage extends React.Component { return (