From 4dea516a408f47d1484ef8a8af7ec0fac82a890b Mon Sep 17 00:00:00 2001 From: Ian Minoso Date: Mon, 5 Dec 2016 11:47:10 -0500 Subject: [PATCH 1/2] 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(
From 92db3e542cb5340231361de297a232117f6dc78c Mon Sep 17 00:00:00 2001 From: Ian Minoso Date: Mon, 5 Dec 2016 12:50:28 -0500 Subject: [PATCH 2/2] Slice Tags --- .../js/directives/components/pages/repo-page/sidebar.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/directives/components/pages/repo-page/sidebar.tsx b/static/js/directives/components/pages/repo-page/sidebar.tsx index 99bf58321..743c306f3 100644 --- a/static/js/directives/components/pages/repo-page/sidebar.tsx +++ b/static/js/directives/components/pages/repo-page/sidebar.tsx @@ -45,19 +45,19 @@ class repoSidebar extends React.Component { return b.lastModified - a.lastModified; }); - for (let i = 0; i < 5; i++){ + sortedTags.slice(0,5).forEach(function(el, i){ tagRows.push( - {sortedTags[i].name} + {el.name} - {moment(sortedTags[i].lastModified).fromNow()} + {moment(el.lastModified).fromNow()} ); - } + }); return(