-
Notifications
You must be signed in to change notification settings - Fork 131
project-github-tracker Kriss #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
silvertejp89
wants to merge
12
commits into
Technigo:main
Choose a base branch
from
silvertejp89:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
48898ee
Finished codealong with mondays lecture
silvertejp89 06ddb04
Added recent push, name of branch and URL to repos
silvertejp89 4dc9b69
completed api fetches, started styling
silvertejp89 a00e08e
added font and styled the cards
silvertejp89 9899fc9
styled with colors and footer
silvertejp89 40c2383
Cleaned up the code
silvertejp89 bb06f1e
Fox face
silvertejp89 a98733b
Added README
silvertejp89 a0bc61d
removed console.logs
silvertejp89 929f2b6
Update README.md
silvertejp89 908153e
Update chart.js
silvertejp89 49505b2
Update chart.js
silvertejp89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,11 @@ | ||
| # 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 task was to create a place to keep track of the GitHub repos that we are using at Technigo using fetch 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? | ||
| I struggled with time as usual but the biggest challenge was all the new information and techniques I got to learn. | ||
|
|
||
| ## 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. | ||
| Look! https://kriss-github-tracker.netlify.app/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| TODO: | ||
|
|
||
| 1) fetch the repos and console log them | ||
| 2) get them in the browser | ||
| 3) FILTHER OUT THE Technogo repos | ||
| 4) test chart library |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,30 @@ | ||
| //DOM-selector for the canvas 👇 | ||
|
|
||
| const ctx = document.getElementById('chart').getContext('2d') | ||
|
|
||
| //"Draw" the chart here 👇 | ||
| console.log ('chart is heart') | ||
|
|
||
| Chart.defaults.color = "#ff0000"; | ||
| Chart.defaults.font.size = 18; | ||
|
|
||
| const drawChart = (amount) => { | ||
| const config = { | ||
| type: 'doughnut', | ||
| data: { | ||
| labels: [ | ||
| 'Finished Projects', | ||
| 'Projects Left' | ||
| ], | ||
| datasets: [{ | ||
| label: 'My First Dataset', | ||
| data: [amount, Math.max(18 - amount, 0)], | ||
| backgroundColor: [ | ||
| 'rgb(226, 176, 9)', | ||
| 'white' | ||
| ], | ||
| hoverOffset: 4 | ||
| }] | ||
| }, | ||
| }; | ||
|
|
||
| const myChart = new Chart(ctx, config) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| const USER = 'silvertejp89' | ||
| const REPOS_URL = `https://api.github.com/users/${USER}/repos` | ||
| const PROFILE_URL = `https://api.github.com/users/${USER}` | ||
| const projectContainer = document.getElementById('projects') | ||
| const profileInfo = document.getElementById("profile"); | ||
|
|
||
| const getProfile = () => { | ||
| fetch(PROFILE_URL) | ||
| .then(Response => Response.json()) | ||
| .then(data => { | ||
| // console.log('Profiluris', data) | ||
| profileInfo.innerHTML += ` | ||
| <img src=${data.avatar_url}></img> | ||
| <h5>${USER}</h5> | ||
| ` | ||
| }) | ||
| } | ||
| getProfile() //invoking | ||
|
|
||
|
|
||
| const getRepos = () => { | ||
| fetch(REPOS_URL) | ||
| .then(response => response.json()) | ||
| .then(data => { | ||
| // console.log("Here we are!", data) | ||
|
|
||
| const forkedRepos = data.filter( | ||
| (repo) => repo.name.includes('project-') && repo.fork | ||
| ); | ||
|
|
||
| forkedRepos.forEach(repo => projectContainer.innerHTML += ` | ||
| <div class='card'> | ||
| <a href="${repo.html_url}"><h3>${repo.name}</h3></a> | ||
| <p> Default branch: ${repo.default_branch}</p> | ||
| <p> Recent push: ${new Date(repo.pushed_at).toDateString()}</p> | ||
| <p id='commit-${repo.name}'> Number of commits:</p> | ||
| </div> | ||
|
|
||
| `) | ||
|
|
||
| fetchPullRequestsArray(forkedRepos); | ||
|
|
||
| drawChart(forkedRepos.length) | ||
|
|
||
| }) | ||
|
|
||
| } | ||
|
|
||
| const fetchPullRequestsArray = (allRepositories) => { | ||
| allRepositories.forEach((repo) => { | ||
| const PULL_URL = `https://api.github.com/repos/Technigo/${repo.name}/pulls?per_page=100`; | ||
|
|
||
| fetch(PULL_URL) | ||
| .then(response => response.json()) | ||
| .then(data => { | ||
| console.log(data) | ||
| const myPullRequest = data.find( | ||
| (pull) => pull.user.login === repo.owner.login | ||
| ); | ||
| console.log('pull request', myPullRequest) | ||
|
|
||
| if (myPullRequest) { | ||
| fetchCommits(myPullRequest.commits_url, repo.name); | ||
| } else { | ||
| document.getElementById(`commit-${repo.name}`).innerHTML = | ||
| 'No pull request done yet'; | ||
| } | ||
| }) | ||
| }) | ||
| } | ||
| const fetchCommits = (myCommitsUrl, myRepoName) => { | ||
| fetch(myCommitsUrl) | ||
| .then(res => res.json()) | ||
| .then(data => { | ||
| document.getElementById(`commit-${myRepoName}`).innerHTML += data.length; | ||
| }); | ||
| }; | ||
|
|
||
| getRepos() //invoking getRepos | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,78 @@ | ||
| *{box-sizing: border-box; | ||
| text-align: center; | ||
| } | ||
|
|
||
|
|
||
| body { | ||
| background: #FFECE9; | ||
| background:black; | ||
| font-family: 'Roboto', sans-serif; | ||
| } | ||
|
|
||
| h1 { | ||
| color:rgb(226, 176, 9) | ||
| } | ||
|
|
||
| h2 { | ||
| color: white | ||
| } | ||
|
|
||
| h3 { | ||
| color:rgb(226, 176, 9) | ||
| } | ||
|
|
||
| h5{ | ||
| color: #1e7699; | ||
| font-size: 18px; | ||
| font-style: italic; | ||
| } | ||
|
|
||
| p { | ||
| color: black; | ||
| } | ||
|
|
||
| img { | ||
| border-radius: 50%; | ||
| height: 200px; | ||
| width: 200px; | ||
| } | ||
|
|
||
| .card { | ||
| background-color: #1e7699; | ||
| width: 300px; | ||
| padding-top: 25px; | ||
| padding-bottom: 20px; | ||
| margin: auto; | ||
| border-radius: 7px; | ||
| } | ||
|
|
||
| a:link { | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| a:visited { | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| a:hover { | ||
| background-color: transparent; | ||
| text-decoration: underline; | ||
| } | ||
|
|
||
| .chart { | ||
| width: 250px; | ||
| height: 250px; | ||
| margin: auto; | ||
| padding-top: 50px; | ||
| } | ||
|
|
||
| .project-grid { | ||
| display: grid; | ||
| grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); | ||
| grid-gap: 1.5rem; | ||
| } | ||
|
|
||
| footer { | ||
| background: black; | ||
| padding: 10px; | ||
| margin-top: 20px; | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to remove some console logs :)