diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c80900c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +code/secret.js \ No newline at end of file diff --git a/README.md b/README.md index 1613a3b0..8b63597c 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,8 @@ # GitHub Tracker - -Replace this readme with your own information about your project. - -Start by briefly describing the assignment in a sentence or two. Keep it short and to the point. +The assignment was to create a GitHub tracker of all my Technigo-repos using GitHub API. ## The problem - -Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next? +Problem description and code comments will be added soon... ## View it live - -Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about. +https://lisen-github-tracker.netlify.app/ diff --git a/code/chart.js b/code/chart.js index 92e85a30..a4ad2b4e 100644 --- a/code/chart.js +++ b/code/chart.js @@ -1,4 +1,34 @@ +//Font-family for the chart +Chart.defaults.font.family = 'Source Code Pro, monospace'; + //DOM-selector for the canvas 👇 const ctx = document.getElementById('chart').getContext('2d') //"Draw" the chart here 👇 +const activateChart = (projects) => { + const labels = [ + 'Projects done', + 'Projects to do' + ] + + const data = { + labels: labels, + datasets: [{ + + data: [projects, 19-projects], + label: 'Projects', + backgroundColor: ['rgb(244, 132, 95)', 'rgb(220, 220, 220)'] + }] + } + + const config = { + type: 'doughnut', + data: data, + options: {} + } + + const myChart = new Chart(document.getElementById('chart'),config); + } + + + diff --git a/code/index.html b/code/index.html index 2fb5e0ae..5eb6f754 100644 --- a/code/index.html +++ b/code/index.html @@ -6,15 +6,23 @@
Repo link: here
+Default branch: ${repo.default_branch}
+Recent update: ${new Date(repo.pushed_at).toLocaleDateString('sv-SE')}
+Pull request: here
` + } else { + document.getElementById(`${repo.name}`).innerHTML += ` +Pull request by team member
` + } + if (filterPullRequests) { + getCommits(filterPullRequests.commits_url, repo.name) + } else { + document.getElementById(`${repo.name}`).innerHTML += ` +Commits by team member
` + } + }) + }) +} + +const getCommits = (commitsURL, repoName) => { + fetch(commitsURL) + .then((res) => res.json()) + .then (data => { + document.getElementById(repoName).innerHTML += ` +Commits: ${data.length}
` + }) +}} + +getUser() diff --git a/code/style.css b/code/style.css index 7c8ad447..733ad988 100644 --- a/code/style.css +++ b/code/style.css @@ -1,3 +1,62 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; + text-decoration: none; +} + body { - background: #FFECE9; -} \ No newline at end of file + background: #EEE; + font-family: 'Source Code Pro', monospace; +} + +.profile-img { + border-radius: 50%; + width: 10rem; + margin: 1rem; +} + +.user-container { + display: flex; + flex-direction: column; + align-items: center; +} + +.repo-container { + display: flex; + justify-content: center; + flex-direction: column; + align-items: stretch; + gap: 2rem; + padding: 2rem; +} + +.repo-name { + background-color: #FFF; + padding: 1rem; + width: 20rem; +} + +.repo-name a { + color: #F4845F; +} + +.chart-container { + margin: auto; + width: 20rem; + padding: 1rem; +} + +@media (min-width: 668px) { + .repo-container { + flex-direction: row; + flex-wrap: wrap; + } +} + +@media (min-width: 1025px) { + .repo-container { + flex-direction: row; + flex-wrap: wrap; + } +}