Skip to content

Commit

Permalink
feat: 🎸 Notifications sorted by modified, then created date (kolplatt…
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanObrink authored Oct 1, 2021
1 parent 4a0841a commit 91f63e8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/parse/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,11 @@ export const notification = ({
type,
})

const notificationsSort = (item1: Notification, item2: Notification): number => {
const m1 = item1.dateModified || item1.dateCreated
const m2 = item2.dateModified || item2.dateCreated
return m1 < m2 ? 1 : -1
}

export const notifications = (data: any): Notification[] =>
etjanst(data).map(notification)
etjanst(data).map(notification).sort(notificationsSort)

0 comments on commit 91f63e8

Please sign in to comment.