diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..7f18d07f Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..8c916a81 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +// .gitignore file +code/secret.js \ No newline at end of file diff --git a/README.md b/README.md index 1613a3b0..7bb4494a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,27 @@ # GitHub Tracker -Replace this readme with your own information about your project. +The assignment was to build a website that holds all Technigo-projects on Github. We should fetch these by API, and using filter to display the correct ones. -Start by briefly describing the assignment in a sentence or two. Keep it short and to the point. +Furthermore the website should include some information from each repository, such as default branch and number of commit messages. + +The website should also include a chart that showed how many projects was done in the Bootcamp. ## 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? +I started with fetching the Github API for my user and my repositories. Then I could display my username and profile pic as well as filter out the repositories so only the forked ones marked as "project-" was displayed. + +I continued with building up info about push date, default branch etc in innerHTML. Then I fetched all pullrequests and filtered out so only my own was left by comparing "pull.user.login" with "repo.owner.login". I used a dynamic ID for the innerHTML-element to display the number of commits in the panel. + +Then I created a chart using chart.js and called the function for it in script-file. To be able to style the chart I put it in a div-element in the HTML-file. + +For this project I used a personal API token from Github, and making it secret by using secret.js and gitignore. + +Lastly I styled the webpage and made it responsive. I'm happy with the accordion and the way the flex/grid is responsive, but the headers in the user-section doesn't look quite right in desktop-size. I think it is because of the position: absolute and how the headers are positioned in relation to the profile pic and the chart. + +If I had more time I would give the styling of the website a little more love. I would also make another chart. + + ## 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://confident-brattain-b7ba85.netlify.app/ diff --git a/code/chart.js b/code/chart.js index 92e85a30..4493502e 100644 --- a/code/chart.js +++ b/code/chart.js @@ -1,4 +1,32 @@ -//DOM-selector for the canvas 👇 -const ctx = document.getElementById('chart').getContext('2d') -//"Draw" the chart here 👇 +//DOM-selector for the canvas +const ctx = document.getElementById('chart').getContext("2d"); + +//drawing the chart +const drawChart = (projects) => { +const labels = [ + 'Finished projects', + 'Upcoming projects', +]; + +const data = { + labels: labels, + datasets: [{ + data: [projects, 19-projects], + label: 'Bootcamp progress', + backgroundColor: ['rgb(255, 99, 132)', 'rgb(104, 131, 180)'], + }] +}; + +const config = { + type: 'doughnut', + data: data, + options: {} +}; + +// new Chart(document.getElementById('chart'),config); +const myChart = new Chart( + document.getElementById('chart'), + config + ); +} diff --git a/code/images/GitHub-Mark-32px.png b/code/images/GitHub-Mark-32px.png new file mode 100644 index 00000000..8b25551a Binary files /dev/null and b/code/images/GitHub-Mark-32px.png differ diff --git a/code/index.html b/code/index.html index 2fb5e0ae..436414ea 100644 --- a/code/index.html +++ b/code/index.html @@ -4,18 +4,39 @@ -