diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-03-19 20:27:26 +0100 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-03-19 20:27:26 +0100 |
commit | 5c29f010cf52f3ba5ee597a50df97219d8dc04a7 (patch) | |
tree | 447f697a5cafda82e57ffc7b98c5360c48c9076b /src | |
parent | a70a62d2f7188a36a08314ac2151dec7152fffa7 (diff) |
feat: commits list
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Commit.vue | 53 | ||||
-rw-r--r-- | src/main.js | 1 | ||||
-rw-r--r-- | src/sass/_commit.sass | 88 | ||||
-rw-r--r-- | src/sass/main.sass | 1 | ||||
-rw-r--r-- | src/views/Home.vue | 17 |
5 files changed, 157 insertions, 3 deletions
diff --git a/src/components/Commit.vue b/src/components/Commit.vue new file mode 100644 index 0000000..63e1764 --- /dev/null +++ b/src/components/Commit.vue @@ -0,0 +1,53 @@ +<template lang="pug"> + .commit(:id="data.hash") + .repo + a( + :href="'/repo/'+data.repository_url" :title="data.repository_url" + ) {{ data.repository_url }} + + .head + h5 + a(:href="'/commit/'+data.hash") {{ data.hash }} + div + span.tree tree: + h6 + a(:href="'/commit/'+data.tree") {{ data.tree }} + + .author_committer + div + img.avatar( + :src="'https://gravatar.com/avatar/'+author" + :alt="data.author_email" + ) + p Author: + b(:title="data.author_email") {{ data.author_name }} + | <{{data.author_email}}></b> + div + img.avatar( + :src="'https://gravatar.com/avatar/'+committer" + :alt="data.committer_email" + ) + p Committer: + b(:title="data.committer_email") {{ data.committer_name }} + | <{{data.committer_email}}></b> + + .text + p + | {{ first_line(data.text) }} + span.middot ยท + span.date {{ data.date | moment("ddd, D MMM YYYY HH:mm:ss ZZ") }} +</template> + +<script> +export default { + name: 'Commit', + // `author` is the hash md5 of the author's gravatar + // `committer` is the hash md5 of the committer's gravatar + props: ['data', 'author', 'committer'], + methods: { + first_line(text) { + return text.split('\n')[0] + } + } +} +</script> diff --git a/src/main.js b/src/main.js index 838c5f3..a05771b 100644 --- a/src/main.js +++ b/src/main.js @@ -7,6 +7,7 @@ import { BootstrapVue } from 'bootstrap-vue'; Vue.config.productionTip = false; Vue.use(BootstrapVue); +Vue.use(require('vue-moment')); new Vue({ router, diff --git a/src/sass/_commit.sass b/src/sass/_commit.sass new file mode 100644 index 0000000..e9e0e06 --- /dev/null +++ b/src/sass/_commit.sass @@ -0,0 +1,88 @@ +@import "_bootstrap.sass"; + +.commit + border-bottom: #ccc 1px solid + padding: 20px 10px + margin: 0 + &:hover + background-color: darken(#fbfcfc, 3%) + .head + > div + span + color: #9f9ca5 + @include breakpoint(phablet) + margin-right: 8px + h6 a + color: $secondary + font-weight: 100 + span + float: left + .author_committer + display: grid + grid-template-columns: 50% 50% + align-items: center + justify-items: center + @include breakpoint(phablet) + grid-template-columns: 100% + div + width: 100% + @include breakpoint(phablet) + &:first-child + padding-bottom: 10px + .avatar + width: 30px + float: left + margin-right: 5px + p + margin: 0 + line-height: 30px + overflow: hidden + height: 30px + text-overflow: ellipsis + white-space: nowrap + padding-right: 5px + h5, h6 + font-weight: bold + font-family: $font-family-mono + font-size: 2em + a + color: $primary + text-decoration: underline + @include breakpoint(phablet) + overflow: hidden + width: 111px + display: block + + h6 + font-size: 1em + a + line-height: 24px + margin-left: 5px + @include breakpoint(phablet) + width: 56px + + + .text + p + margin: 5px 0 0 + span.middot + margin: 0 10px + color: #ccc + span.date + color: $secondary + white-space: pre + display: inline-block + + .repo a + color: #fff + text-decoration: none !important + background: $primary + padding: 3px + float: right + max-width: 200px + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + border-radius: 2px + @include breakpoint(phablet) + width: 180px diff --git a/src/sass/main.sass b/src/sass/main.sass index 18b025a..09acd39 100644 --- a/src/sass/main.sass +++ b/src/sass/main.sass @@ -1,4 +1,5 @@ @import "_header.sass"; +@import "_commit.sass"; body color: #2c3e50 diff --git a/src/views/Home.vue b/src/views/Home.vue index b5fbda0..c1d9420 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -2,26 +2,37 @@ main header-blue b-container - h2 List of commits + b-row + b-col(md="8" sm="12") + h2 List of commits + section#commits + commit-card( + v-for="i in commits" :key="i.hash" :data="i" + :author="emails[i.author_email]" + :committer="emails[i.committer_email]" + ) + b-col </template> <script> import HeaderBlue from '@/components/HeaderBlue'; +import Commit from '@/components/Commit'; export default { name: "Home", components: { 'header-blue': HeaderBlue, + 'commit-card': Commit, }, mounted() { this.$store.dispatch('get_commits'); this.$store.dispatch('get_emails'); }, computed: { - commits: () => { + commits: function() { return this.$store.getters.commits; }, - emails: () => { + emails: function() { return this.$store.getters.emails; }, } |