From b8b7cd6876f72c6de16e47e8f5b5c4a3f5674560 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 24 Mar 2021 20:51:40 +0100 Subject: feat: add repo page --- src/router.js | 7 ++++++ src/sass/_commit.sass | 2 ++ src/sass/main.sass | 3 +++ src/store.js | 10 ++++++++ src/views/Repository.vue | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 src/views/Repository.vue (limited to 'src') diff --git a/src/router.js b/src/router.js index 9be8616..0cfdc1e 100644 --- a/src/router.js +++ b/src/router.js @@ -3,6 +3,7 @@ import VueRouter from 'vue-router' import Home from '@/views/Home.vue' import Commit from '@/views/Commit.vue' +import Repository from '@/views/Repository.vue' import Search from '@/views/Search.vue' Vue.use(VueRouter) @@ -19,6 +20,12 @@ const routes = [ component: Commit, props: true }, + { + path: '/repo/:user/:name', + name: 'Repository', + component: Repository, + props: true + }, { path: '/search', name: 'Search', diff --git a/src/sass/_commit.sass b/src/sass/_commit.sass index e3f3b2a..cc7312d 100644 --- a/src/sass/_commit.sass +++ b/src/sass/_commit.sass @@ -6,6 +6,8 @@ margin: 0 &:not(.no-hover):hover background-color: darken(#fbfcfc, 3%) + span.secondary + color: $secondary .head > div span diff --git a/src/sass/main.sass b/src/sass/main.sass index deab05d..ed7484c 100644 --- a/src/sass/main.sass +++ b/src/sass/main.sass @@ -11,3 +11,6 @@ body flex-direction: column-reverse > div margin-bottom: 42px + +.open-github + float: right diff --git a/src/store.js b/src/store.js index 1afad67..1483402 100644 --- a/src/store.js +++ b/src/store.js @@ -111,6 +111,16 @@ export default new Vuex.Store({ commit('load_commit', await response.json()); }) }, + // Get all commits from a repository + async get_repo_commits({commit}, data) { + commit('loading_state', true) + let path = `${this.state.api}/commit/?repository_user=${data.user}&repository_name=${data.name}` + await fetch(path) + .then(async response => { + commit('load_commits', await response.json()); + }) + commit('loading_state', false) + }, // Get email async get_email({commit}, data) { await fetch(`${this.state.api}/email/search/?q=${data.email}`) diff --git a/src/views/Repository.vue b/src/views/Repository.vue new file mode 100644 index 0000000..ade55d3 --- /dev/null +++ b/src/views/Repository.vue @@ -0,0 +1,59 @@ + + + -- cgit v1.2.3-18-g5258