-
Notifications
You must be signed in to change notification settings - Fork 131
Github Tracker without image(will fix) #58
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,39 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Project GitHub Tracker</title> | ||
| <link rel="stylesheet" href="./style.css" /> | ||
| <meta charset="UTF-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Project GitHub Tracker</title> | ||
| <link rel="stylesheet" href="./style.css" /> | ||
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | ||
|
|
||
| </head> | ||
|
|
||
| <body> | ||
| <h1>GitHub Tracker</h1> | ||
| <h2>Projects:</h2> | ||
| <main id="projects"></main> | ||
| <header> | ||
| <h1>GitHub Tracker</h1> | ||
| </header> | ||
| <div class="wrapper"> | ||
| <div class="info-container"> | ||
| <div class="profile-container" id="profileInfo"></div> | ||
| <div class="chart-container"> | ||
| <h2>Progress</h2> | ||
| <canvas class="chart" id="chart"> </canvas> | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- This will be used to draw the chart 👇 --> | ||
| <canvas id="chart"></canvas> | ||
| <div class="projects-container"> | ||
| <h2>Projects</h2> | ||
| <div class="projects-list"> | ||
| <main class="projects" id="projects"></main> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <script src="./script.js"></script> | ||
| <script src="./chart.js"></script> | ||
| <script src="./script.js"></script> | ||
| <script src="./chart.js"></script> | ||
| </body> | ||
|
|
||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| const USER = 'Groovedharry' | ||
| const REPOS_URL = `https://api.github.com/users/${USER}/repos`; | ||
| const USER_API = `https://api.github.com/users/${USER}`; | ||
| const projectsContainerXXYT = document.getElementById('profileInfo'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, what does xxyt mean? |
||
| const projectsContainer = document.querySelector("#projects"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why you used a querySelector here instead of just use document.getElementById? If there isnt a particular reason i would try to make it coherent and use dockument.getElementById here aswell or just use the queryselector for targeting the elements =). |
||
|
|
||
|
|
||
| const getUser = () => { | ||
| fetch(USER_API) | ||
| .then((response) => response.json()) | ||
| .then((data) => { | ||
| profile.info.innerHTML += ` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would guess that this bit doesnt work since you havent targeted the correct id. you have used profile.info.innerhtml. Try to change that to profileInfo.innerHTML instead. |
||
| <h2> Profile info </h2> | ||
| <img src ="https://avatars.githubusercontent.com/u/83465217?v=4" alt="profile pic"> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This info is possible to pick up from the data So you dont have to hard code it. It is just a suggestion since you already use the api to pcick up the name! |
||
| <h4> ${data.name}</h4> | ||
| <h4> >a href =${data.html_url}>${data.login}</h4> | ||
| `; | ||
| }); | ||
| }; | ||
|
|
||
| // Repos // | ||
| const getRepos = () => { | ||
| fetch(REPOS_URL) | ||
| .then((response) => { | ||
| return response.json(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice solution to wait until the data is finished! =) |
||
| }) | ||
| .then((json) => { | ||
| const forkedRepos = json.filter((project) => project.fork && project.name.startsWith("project-")); | ||
| console.log(forkedRepos) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove this console log before pushing the final result, but since you have written that you arent entirely done with the project I understand that you left it =) |
||
| // commits // | ||
| forkedRepos.forEach((project) => { | ||
| const COMMIT_URL = `https://api.github.com/repos/${USER}/${project.name}/commits`; | ||
| fetch(COMMIT_URL) | ||
| .then((response) => { | ||
| return response.json(); | ||
| }) | ||
| .then((json) => { | ||
| const filteredCommits = json.filter((project) => project.commit.author.name === "Harry Bäcklin"); | ||
| // makes the first letter an upper case, Thank you Bruna // | ||
| const upperCaseName = project.name.charAt(0).toUpperCase() + project.name.slice(1); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice one! |
||
| projectsContainer.innerHTML += `<div class="projects-individual"> | ||
| <h3> Project Name: ${upperCaseName}</h3> | ||
| <a href = ${project.html_url}> ${upperCaseName} </a> | ||
| <p> Main branch: ${project.default_branch}</p> | ||
| <p> Number of commits: ${filteredCommits.length}</p> | ||
| <p> Latest push: ${project.pushed_at.slice(0, 10)}, ${project.pushed_at.slice(11, 16)}</p> | ||
| <p id="pull-${project.name}"></p> | ||
| </div>`; | ||
| }); | ||
| }); | ||
| getPulls(forkedRepos); | ||
| drawChart(forkedRepos.length); | ||
| }); | ||
| }; | ||
|
|
||
| // Getting Pull requests // | ||
| const getPulls = (forkedRepos) => { | ||
| forkedRepos.forEach((project) => { | ||
| fetch( | ||
| `https://api.github.com/repos/Technigo/${project.name}/pulls?per_page=100` | ||
| ) | ||
| .then((response) => response.json()) | ||
| .then((pulldata) => { | ||
| const myPullRequest = pulldata.find( | ||
| (pull) => pull.user.login === project.owner.login | ||
| ); | ||
| if (myPullRequest) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice solution =) |
||
| document.getElementById(`pull-${project.name}`).innerHTML = ` | ||
| <a href = ${myPullRequest.html_url}>Pull request</>`; | ||
| } else { | ||
| document.getElementById(`pull-${project.name}`).innerHTML = ` | ||
| No pull request available`; | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
|
|
||
| getUser(); | ||
| getRepos(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,141 @@ | ||
| body { | ||
| background: #FFECE9; | ||
| box-sizing: border-box; | ||
| min-width: 325px; | ||
| background-color:#53565A; | ||
| font-family: Arial, Helvetica, sans-serif | ||
| } | ||
|
|
||
| .wrapper { | ||
| margin: 5% 0; | ||
| } | ||
|
|
||
|
|
||
| h1 { | ||
| margin-top: 10%; | ||
| color: Black; | ||
| text-align: center; | ||
| font-size: 30px; | ||
| } | ||
|
|
||
|
|
||
| .profile-container { | ||
| text-align: center; | ||
| color: white; | ||
| align-items: center; | ||
| } | ||
|
|
||
| h4 { | ||
| margin: 2% 0; | ||
| font-size: 28px; | ||
| color:black; | ||
| } | ||
| /* not working prolly something in JS but I can't figure it out */ | ||
| img { | ||
| width: 50%; | ||
| height: 50%; | ||
| border-radius: 50%; | ||
| border: 1px solid white; | ||
|
|
||
| } | ||
|
|
||
| h2 { | ||
| text-align: center; | ||
| color: black; | ||
| } | ||
|
|
||
|
|
||
| .chart-container { | ||
| width: 70%; | ||
| margin: 0 0 10% 15%; | ||
| } | ||
|
|
||
|
|
||
| .projects-list { | ||
| border: 1px solid #b8c3bd; | ||
| padding: 4%; | ||
| height: 100%; | ||
| color: black; | ||
| font-size: 17px; | ||
| } | ||
| .projects-individual { | ||
| border-bottom: 1px solid #b8c3bd; | ||
| } | ||
|
|
||
|
|
||
| a:link { | ||
| color: white; | ||
| } | ||
|
|
||
|
|
||
| a:visited { | ||
| color: white; | ||
| } | ||
|
|
||
|
|
||
| a:hover { | ||
| color: black; | ||
| } | ||
|
|
||
|
|
||
| @media (min-width: 668px) and (max-width: 1024px) { | ||
|
|
||
| h1 { | ||
| font-size: 45px; | ||
| } | ||
|
|
||
| h4 { | ||
| font-size: 38px; | ||
| } | ||
|
|
||
| h2 { | ||
| font-size: 40px; | ||
| } | ||
|
|
||
| /* not working prolly something in JS but I can't figure it out */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment about it above =) |
||
| img { | ||
| width: 40%; | ||
| height: 40%; | ||
| } | ||
|
|
||
| .chart-container { | ||
| width: 50%; | ||
| margin: 5% 0 5% 27%; | ||
| } | ||
|
|
||
|
|
||
| .projects-list { | ||
| text-align: center; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| @media (min-width: 1025px) { | ||
| .big-container { | ||
| display: grid; | ||
| grid-template-columns: 1fr 2fr; | ||
| margin: 2%; | ||
| } | ||
|
|
||
|
|
||
| h1 { | ||
| font-size: 60px; | ||
| margin-top: 4%; | ||
| } | ||
|
|
||
|
|
||
| h4, h2 { | ||
| font-size: 40px; | ||
| } | ||
|
|
||
|
|
||
| .projects-list { | ||
| padding: 0 0 0 5%; | ||
| font-size: 16px; | ||
| border-bottom: 1px solid #b8c3bd; | ||
| } | ||
|
|
||
| .projects { | ||
| display: grid; | ||
| grid-template-columns: 1fr 1fr; | ||
| } | ||
| } | ||
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.
Just a very small detail, i would get rid of line 11 or do the same on both sides so it looks proportionate =)