From 4dea516a408f47d1484ef8a8af7ec0fac82a890b Mon Sep 17 00:00:00 2001 From: Ian Minoso Date: Mon, 5 Dec 2016 11:47:10 -0500 Subject: [PATCH] Sort Tags By most recent, show only top 5 --- .../directives/components/pages/repo-page/sidebar.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/js/directives/components/pages/repo-page/sidebar.tsx b/static/js/directives/components/pages/repo-page/sidebar.tsx index ed8a716eb..99bf58321 100644 --- a/static/js/directives/components/pages/repo-page/sidebar.tsx +++ b/static/js/directives/components/pages/repo-page/sidebar.tsx @@ -42,22 +42,22 @@ class repoSidebar extends React.Component { } sortedTags = sortedTags.sort(function(a, b) { - return a.lastModified - b.lastModified; + return b.lastModified - a.lastModified; }); - sortedTags.forEach(function(el, i){ + for (let i = 0; i < 5; i++){ tagRows.push( - {el.name} + {sortedTags[i].name} - {moment(el.lastModified).fromNow()} + {moment(sortedTags[i].lastModified).fromNow()} ); - }); + } return(