From 45e5a794ae423e81afa7fdde329f34e3d4a0bcd3 Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Sat, 20 Mar 2021 18:01:09 +0100
Subject: feat: add top authors section

---
 src/views/Home.vue | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

(limited to 'src/views/Home.vue')

diff --git a/src/views/Home.vue b/src/views/Home.vue
index 3ca1445..49e42b3 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -2,7 +2,7 @@
   main
     header-blue
     b-container
-      b-row
+      b-row#home
         b-col(md="8" sm="12")
           h2 List of commits
           section#commits
@@ -14,22 +14,37 @@
               :author="emails[i.author_email]"
               :committer="emails[i.committer_email]"
             )
-        b-col
+        b-col(md="4" sm="12")
+          h2 Top authors
+          b-list-group
+            b-list-group-item(v-if="loading_top_authors")
+              b-overlay(:show="true" spinner-large)
+            b-list-group-item(
+              v-else v-for="author in top_authors.slice(0, 7)" :key="author.email"
+              button
+            )
+              author(
+                :data="author"
+                :avatar="emails[author.author_email]"
+              )
 </template>
 
 <script>
 import HeaderBlue from '@/components/HeaderBlue';
 import Commit from '@/components/Commit';
+import TopAuthor from '@/components/TopAuthor';
 
 export default {
   name: "Home",
   components: {
     'header-blue': HeaderBlue,
     'commit-card': Commit,
+    'author': TopAuthor,
   },
   mounted() {
     this.$store.dispatch('get_commits');
     this.$store.dispatch('get_emails');
+    this.$store.dispatch('get_top_authors');
   },
   computed: {
     commits: function() {
@@ -38,8 +53,14 @@ export default {
     emails: function() {
       return this.$store.getters.emails;
     },
+    top_authors: function() {
+      return this.$store.getters.top_authors;
+    },
     loading: function() {
       return this.$store.getters.loading;
+    },
+    loading_top_authors: function() {
+      return this.$store.getters.loading_top_authors;
     }
   }
 }
-- 
cgit v1.2.3-18-g5258

