diff --git a/src/pages/Notifications/index.js b/src/pages/Notifications/index.js index f1e1624..3289a05 100644 --- a/src/pages/Notifications/index.js +++ b/src/pages/Notifications/index.js @@ -23,7 +23,8 @@ export const Sort = { TYPE: 1, TITLE: 0, REPOSITORY: 2, - SCORE: 3 + SCORE: 3, + DATE: 4 }; export const View = { @@ -388,6 +389,13 @@ class NotificationsPage extends React.Component { scoredAndSortedNotifications.sort((a, b) => b.type.localeCompare(a.type)); } } + if (this.state.sort === Sort.DATE) { + if (this.state.descending) { + scoredAndSortedNotifications.sort((a, b) => moment(a.updated_at).diff(b.updated_at)); + } else { + scoredAndSortedNotifications.sort((a, b) => moment(b.updated_at).diff(a.updated_at)); + } + } // We gotta make sure to search notifications before we paginate. // Otherwise we'd just end up searching on the current page, which is bad. diff --git a/src/pages/Notifications/redesign/Scene.js b/src/pages/Notifications/redesign/Scene.js index 794d704..9b8d5e8 100644 --- a/src/pages/Notifications/redesign/Scene.js +++ b/src/pages/Notifications/redesign/Scene.js @@ -577,6 +577,7 @@ const NotificationByline = styled('span')` const ProfileContainer = styled('div')` display: flex; + height: 100%; justify-content: center; align-items: center; border-left: 1px solid #edeef0; @@ -700,8 +701,9 @@ function SortingItem ({children, selected, onChange, descending, setDescending, } onChange(props.sort) }} + {...props} > - + {children} window.scrollTo(0, 0)} @@ -892,7 +894,7 @@ export default function Scene ({ - +
{ event.stopPropagation(); onFetchNotifications(); @@ -1120,7 +1122,16 @@ export default function Scene ({ {/* Actions */} -   + + {'Date'} + {loading ? ( diff --git a/src/styles/index.css b/src/styles/index.css index e9a8b05..9498c9e 100644 --- a/src/styles/index.css +++ b/src/styles/index.css @@ -87,7 +87,6 @@ p { } div { - height: 100%; vertical-align: top; }