summaryrefslogtreecommitdiff
path: root/src/views/Home.vue
blob: 49e42b37e274dadc24e04d69fb75588ba718559e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<template lang="pug">
  main
    header-blue
    b-container
      b-row#home
        b-col(md="8" sm="12")
          h2 List of commits
          section#commits
            .commit(style="padding: 50px" v-if="loading")
              b-overlay(:show="true" spinner-large)
            commit-card(
              v-else
              v-for="i in commits" :key="i.hash" :data="i"
              :author="emails[i.author_email]"
              :committer="emails[i.committer_email]"
            )
        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() {
      return this.$store.getters.commits;
    },
    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;
    }
  }
}
</script>