From 9486f7fda828cc668b592bae31aea1d88f3192c6 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 19 Mar 2021 15:08:10 +0100 Subject: style: size bootstrap headers --- src/sass/_bootstrap.sass | 8 +++++++- src/sass/_header.sass | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sass/_bootstrap.sass b/src/sass/_bootstrap.sass index 755ffb1..c83c1eb 100644 --- a/src/sass/_bootstrap.sass +++ b/src/sass/_bootstrap.sass @@ -1,8 +1,14 @@ @import "_variables.sass"; -h1 +h1, h2, h3 font-family: $font-family-big +h1 + font-size: 3em + +h2 + font-size: 2em + @mixin breakpoint($point) @if $point == desktop @media (min-width: 70em) diff --git a/src/sass/_header.sass b/src/sass/_header.sass index 33f9271..e64a031 100644 --- a/src/sass/_header.sass +++ b/src/sass/_header.sass @@ -5,6 +5,7 @@ header color: $color-w padding: 10px 0 box-shadow: rgba(0, 0, 0, 0.2) 0 2px 0px + margin-bottom: 30px h1 font-size: 3em margin: 0 -- cgit v1.2.3-18-g5258 From a686db800f50db4f6585fcdf1110873f577bfaeb Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 19 Mar 2021 15:13:27 +0100 Subject: conf: move router and store folders --- src/main.js | 4 ++-- src/router.js | 22 ++++++++++++++++++++++ src/router/index.js | 22 ---------------------- src/store.js | 17 +++++++++++++++++ src/store/index.js | 15 --------------- 5 files changed, 41 insertions(+), 39 deletions(-) create mode 100644 src/router.js delete mode 100644 src/router/index.js create mode 100644 src/store.js delete mode 100644 src/store/index.js (limited to 'src') diff --git a/src/main.js b/src/main.js index 1329a63..838c5f3 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import App from './App.vue'; -import router from './router'; -import store from './store'; +import router from '@/router.js'; +import store from '@/store.js'; import { BootstrapVue } from 'bootstrap-vue'; diff --git a/src/router.js b/src/router.js new file mode 100644 index 0000000..5dc4e51 --- /dev/null +++ b/src/router.js @@ -0,0 +1,22 @@ +import Vue from 'vue' +import VueRouter from 'vue-router' + +import Home from '@/views/Home.vue' + +Vue.use(VueRouter) + +const routes = [ + { + path: '/', + name: 'Home', + component: Home, + } +] + +const router = new VueRouter({ + mode: 'history', + base: process.env.BASE_URL, + routes +}) + +export default router diff --git a/src/router/index.js b/src/router/index.js deleted file mode 100644 index 5dc4e51..0000000 --- a/src/router/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import Vue from 'vue' -import VueRouter from 'vue-router' - -import Home from '@/views/Home.vue' - -Vue.use(VueRouter) - -const routes = [ - { - path: '/', - name: 'Home', - component: Home, - } -] - -const router = new VueRouter({ - mode: 'history', - base: process.env.BASE_URL, - routes -}) - -export default router diff --git a/src/store.js b/src/store.js new file mode 100644 index 0000000..0e96ac7 --- /dev/null +++ b/src/store.js @@ -0,0 +1,17 @@ +import Vue from 'vue' +import Vuex from 'vuex' + +Vue.use(Vuex) + +export default new Vuex.Store({ + state: { + api: process.env.VUE_APP_BACKEND_URL, + commits: [], + }, + mutations: { + }, + actions: { + }, + modules: { + } +}) diff --git a/src/store/index.js b/src/store/index.js deleted file mode 100644 index 332b916..0000000 --- a/src/store/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import Vue from 'vue' -import Vuex from 'vuex' - -Vue.use(Vuex) - -export default new Vuex.Store({ - state: { - }, - mutations: { - }, - actions: { - }, - modules: { - } -}) -- cgit v1.2.3-18-g5258 From 4410f2e46cbf961f2100038b53426bd07aebc4e9 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 19 Mar 2021 15:51:04 +0100 Subject: feat: get all commits --- src/store.js | 15 +++++++++++++++ src/views/Home.vue | 10 ++++++++++ 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/store.js b/src/store.js index 0e96ac7..9080bd0 100644 --- a/src/store.js +++ b/src/store.js @@ -8,9 +8,24 @@ export default new Vuex.Store({ api: process.env.VUE_APP_BACKEND_URL, commits: [], }, + get: { + commits: state => { + return state.commits + }, + }, mutations: { + load_commits: (state, value) => { + state.commits = value + }, }, actions: { + // Get all commits from the api backend + async get_commits({commit}) { + await fetch(`${this.state.api}/commit/`) + .then(async response => { + commit('load_commits', await response.json()); + }) + }, }, modules: { } diff --git a/src/views/Home.vue b/src/views/Home.vue index 55c3c08..28da86b 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,6 +1,8 @@ -- cgit v1.2.3-18-g5258 From d383bd08f0266406d4b0c9eb68c76e62c9d4a460 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 19 Mar 2021 16:06:10 +0100 Subject: feat: get emails --- src/store.js | 22 ++++++++++++++++++++++ src/views/Home.vue | 6 +++++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/store.js b/src/store.js index 9080bd0..888add2 100644 --- a/src/store.js +++ b/src/store.js @@ -7,16 +7,24 @@ export default new Vuex.Store({ state: { api: process.env.VUE_APP_BACKEND_URL, commits: [], + emails: {}, }, get: { commits: state => { return state.commits }, + emails: state => { + return state.emails + }, }, mutations: { load_commits: (state, value) => { state.commits = value }, + load_emails: (state, value) => { + console.log(JSON.stringify(value)) + state.emails = value + }, }, actions: { // Get all commits from the api backend @@ -26,6 +34,20 @@ export default new Vuex.Store({ commit('load_commits', await response.json()); }) }, + // Get all emails and map them like an hash + async get_emails({commit}) { + await fetch(`${this.state.api}/email/`) + .then(async response => { + const emails_list = await response.json(); + const emails_obj = emails_list + .reduce((dict, elem) => { + dict[elem['email']] = elem['hash_md5'] + return dict; + }, {}) + + commit('load_emails', emails_obj); + }) + }, }, modules: { } diff --git a/src/views/Home.vue b/src/views/Home.vue index 28da86b..e507ef8 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -15,11 +15,15 @@ export default { }, mounted() { this.$store.dispatch('get_commits'); + this.$store.dispatch('get_emails'); }, computed: { commits: () => { return this.$store.get.commits; - } + }, + emails: () => { + return this.$store.get.emails; + }, } } -- cgit v1.2.3-18-g5258 From 0d6bd4aefc4e651be3f2fff15043d598e852df54 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 19 Mar 2021 16:22:41 +0100 Subject: feat: add loading --- src/components/HeaderBlue.vue | 19 +++++++++++++++++++ src/components/design/HeaderBlue.vue | 12 ------------ src/sass/_header.sass | 14 ++++++++++++++ src/store.js | 14 ++++++++++++-- src/views/Home.vue | 6 +++--- 5 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 src/components/HeaderBlue.vue delete mode 100644 src/components/design/HeaderBlue.vue (limited to 'src') diff --git a/src/components/HeaderBlue.vue b/src/components/HeaderBlue.vue new file mode 100644 index 0000000..d4ffa9f --- /dev/null +++ b/src/components/HeaderBlue.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/components/design/HeaderBlue.vue b/src/components/design/HeaderBlue.vue deleted file mode 100644 index fd6d731..0000000 --- a/src/components/design/HeaderBlue.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/src/sass/_header.sass b/src/sass/_header.sass index e64a031..21f11bb 100644 --- a/src/sass/_header.sass +++ b/src/sass/_header.sass @@ -6,6 +6,20 @@ header padding: 10px 0 box-shadow: rgba(0, 0, 0, 0.2) 0 2px 0px margin-bottom: 30px + &.active + z-index: 1044 + #big-loading + top: 0 + width: 100% + height: 100% + position: fixed + z-index: 1045 + .b-overlay-wrap + height: 100% + background-color: rgba(0, 0, 0, .8) + .spinner-border + border-color: $primary + border-right-color: transparent h1 font-size: 3em margin: 0 diff --git a/src/store.js b/src/store.js index 888add2..dab3529 100644 --- a/src/store.js +++ b/src/store.js @@ -6,10 +6,14 @@ Vue.use(Vuex) export default new Vuex.Store({ state: { api: process.env.VUE_APP_BACKEND_URL, + loading: false, commits: [], emails: {}, }, - get: { + getters: { + loading: state => { + return state.loading + }, commits: state => { return state.commits }, @@ -18,24 +22,29 @@ export default new Vuex.Store({ }, }, mutations: { + loading_state: (state, value) => { + state.loading = value + }, load_commits: (state, value) => { state.commits = value }, load_emails: (state, value) => { - console.log(JSON.stringify(value)) state.emails = value }, }, actions: { // Get all commits from the api backend async get_commits({commit}) { + commit('loading_state', true) await fetch(`${this.state.api}/commit/`) .then(async response => { commit('load_commits', await response.json()); }) + commit('loading_state', false) }, // Get all emails and map them like an hash async get_emails({commit}) { + commit('loading_state', true) await fetch(`${this.state.api}/email/`) .then(async response => { const emails_list = await response.json(); @@ -47,6 +56,7 @@ export default new Vuex.Store({ commit('load_emails', emails_obj); }) + commit('loading_state', false) }, }, modules: { diff --git a/src/views/Home.vue b/src/views/Home.vue index e507ef8..b5fbda0 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -6,7 +6,7 @@ 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 diff --git a/src/sass/_header.sass b/src/sass/_header.sass index 21f11bb..e64a031 100644 --- a/src/sass/_header.sass +++ b/src/sass/_header.sass @@ -6,20 +6,6 @@ header padding: 10px 0 box-shadow: rgba(0, 0, 0, 0.2) 0 2px 0px margin-bottom: 30px - &.active - z-index: 1044 - #big-loading - top: 0 - width: 100% - height: 100% - position: fixed - z-index: 1045 - .b-overlay-wrap - height: 100% - background-color: rgba(0, 0, 0, .8) - .spinner-border - border-color: $primary - border-right-color: transparent h1 font-size: 3em margin: 0 diff --git a/src/views/Home.vue b/src/views/Home.vue index c1d9420..3ca1445 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -6,7 +6,10 @@ 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]" @@ -35,6 +38,9 @@ export default { emails: function() { return this.$store.getters.emails; }, + loading: function() { + return this.$store.getters.loading; + } } } -- cgit v1.2.3-18-g5258 From 45e5a794ae423e81afa7fdde329f34e3d4a0bcd3 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sat, 20 Mar 2021 18:01:09 +0100 Subject: feat: add top authors section --- src/components/TopAuthor.vue | 16 ++++++++++++++++ src/sass/_commit.sass | 18 ++++++++++++++++++ src/sass/main.sass | 6 ++++++ src/store.js | 23 +++++++++++++++++++++++ src/views/Home.vue | 25 +++++++++++++++++++++++-- 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 src/components/TopAuthor.vue (limited to 'src') diff --git a/src/components/TopAuthor.vue b/src/components/TopAuthor.vue new file mode 100644 index 0000000..e8a0241 --- /dev/null +++ b/src/components/TopAuthor.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/sass/_commit.sass b/src/sass/_commit.sass index 64a315c..d59afa0 100644 --- a/src/sass/_commit.sass +++ b/src/sass/_commit.sass @@ -86,3 +86,21 @@ border-radius: 2px @include breakpoint(phablet) max-width: 180px + +.top-author + display: grid + grid-template-columns: 80% 20% + .user + display: flex + img + width: 30px + height: 30px + margin-right: 5px + strong + text-overflow: ellipsis + white-space: nowrap + overflow: hidden + + .number + justify-self: end + color: $secondary diff --git a/src/sass/main.sass b/src/sass/main.sass index 09acd39..deab05d 100644 --- a/src/sass/main.sass +++ b/src/sass/main.sass @@ -5,3 +5,9 @@ body color: #2c3e50 font-family: $font-family background-color: #fbfcfc + +#home + @include breakpoint(phablet) + flex-direction: column-reverse + > div + margin-bottom: 42px diff --git a/src/store.js b/src/store.js index 2fd04eb..79bdaff 100644 --- a/src/store.js +++ b/src/store.js @@ -7,16 +7,24 @@ export default new Vuex.Store({ state: { api: process.env.VUE_APP_BACKEND_URL, loading: false, + loading_top_authors: false, commits: [], + top_authors: [], emails: {}, }, getters: { loading: state => { return state.loading }, + loading_top_authors: state => { + return state.loading_top_authors + }, commits: state => { return state.commits }, + top_authors: state => { + return state.top_authors + }, emails: state => { return state.emails }, @@ -25,9 +33,15 @@ export default new Vuex.Store({ loading_state: (state, value) => { state.loading = value }, + loading_top_authors_state: (state, value) => { + state.loading_top_authors = value + }, load_commits: (state, value) => { state.commits = value }, + load_top_authors: (state, value) => { + state.top_authors = value + }, load_emails: (state, value) => { state.emails = value }, @@ -56,6 +70,15 @@ export default new Vuex.Store({ commit('load_emails', emails_obj); }) }, + /// Get the ranking of commits authors + async get_top_authors({commit}) { + commit('loading_top_authors_state', true) + await fetch(`${this.state.api}/commit/top/`) + .then(async response => { + commit('load_top_authors', await response.json()); + }) + commit('loading_top_authors_state', false) + } }, modules: { } 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]" + )