-
Notifications
You must be signed in to change notification settings - Fork 131
GitHub tracker #116
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
Thereese
wants to merge
8
commits into
Technigo:main
Choose a base branch
from
Thereese: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
GitHub tracker #116
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
887eba6
fetched projects and pull requests
d077c42
fixes authentification
e7bebfc
update css, html, js plus picture
8e6cdff
new code to all files
aa1b78e
changed readme-file
d7da3c5
fixed broken link
4131641
updated readme-file
a2dca4c
new netlify-link
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
Binary file not shown.
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 @@ | ||
| code/secret.js |
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,12 @@ | ||
| # 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. | ||
| A really tricky project, happy that everything is working! With more time I would have worked | ||
| more with the styling and added some more fetched information, maybe a different kind of chart. | ||
|
|
||
| ## 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? | ||
| Create a github tracker fetching information from my GitHub-profile. | ||
|
|
||
| ## 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://thereese-githubtracker.netlify.app |
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
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,85 @@ | ||
| //DOM SELECTORS | ||
|
|
||
| const projectsContainer = document.getElementById('projects') | ||
| const userContainer = document.getElementById('user-container') | ||
| const userInfo = document.getElementById('user-info') | ||
| const userImg = document.getElementById('user-img') | ||
|
|
||
| //APIS TO FETCH FROM | ||
| const username = 'Thereese' | ||
| let reponame | ||
| const API_URL = `https://api.github.com/users/${username}/repos` | ||
| const API_URL_PR = `https://api.github.com/repos/Technigo/${reponame}/pulls` | ||
|
|
||
|
|
||
| const options = { | ||
| method: 'GET', | ||
| headers: { | ||
| Authorization: 'API_TOKEN' | ||
| } | ||
| } | ||
|
|
||
|
|
||
| //FETCH USERNAME AND PROFILEPIC | ||
| const getUser = () => { | ||
| fetch (`https://api.github.com/users/${username}`, options) | ||
| .then((res) => res.json()) | ||
| .then((data) => { | ||
| userImg.innerHTML= | ||
| `<img class="user-image" src=${data.avatar_url}/>` | ||
| userInfo.innerHTML= | ||
| `<h1>${data.name}</h1> | ||
| <h3> | ${data.login}</h3>` | ||
| }) | ||
| } | ||
|
|
||
|
|
||
| //FETCH REPOS AND FILTER TECHNIGOPROJECTS. DATA TO PROJECTCONTAINER. | ||
| const getRepos = () => { | ||
| fetch (API_URL, options) | ||
| .then((res) => res.json()) | ||
| .then((data) => { | ||
| const filterTechnigoProjects = data.filter((repo) => repo.fork && repo.name.startsWith("project")) | ||
|
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 with filtering only those that starts with "project"! |
||
| filterTechnigoProjects.forEach(repo => { | ||
| let projectID = repo.id | ||
| projectsContainer.innerHTML+= | ||
| `<div class="repocard" id=${projectID}> | ||
| <a href=${repo.html_url}><h3> ${repo.name}</h3></a> | ||
| <p> Default branch: ${repo.default_branch}</p> | ||
| <p> Latest push: ${new Date(repo.pushed_at).toDateString()}</p> | ||
|
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. Awsome job with |
||
| <p id="commit-${repo.name}">Commits:</p> | ||
| </div>` | ||
|
|
||
| }) | ||
| getPullRequests(filterTechnigoProjects) | ||
| drawChart(filterTechnigoProjects.length) | ||
| }) | ||
| } | ||
|
|
||
| getRepos() | ||
| //FETCH PULLREQUESTS, SORT AND RETURN DATA OR COMMENT | ||
| const getPullRequests = (filterTechnigoProjects) => { | ||
| filterTechnigoProjects.forEach(repo => { | ||
| fetch (`https://api.github.com/repos/Technigo/${repo.name}/pulls?per_page=100`, options) | ||
| .then((res) => res.json()) | ||
| .then((data) => { | ||
| const filterMyPull = data.find((pull) => pull.user.login === repo.owner.login) | ||
| if (filterMyPull) { | ||
| getCommits(filterMyPull.commits_url, repo.name) | ||
| } else { | ||
| document.getElementById(`commit-${repo.name}`).innerHTML = | ||
| '<p>No pull requests made</p>' | ||
| } | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
| const getCommits = (URL, repoName) => { | ||
| fetch(URL, options) | ||
| .then ((res) => res.json()) | ||
| .then (data => { | ||
| document.getElementById(`commit-${repoName}`).innerHTML += data.length; | ||
| }) | ||
| } | ||
| getUser() | ||
|
|
||
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,110 @@ | ||
| * { | ||
| margin: 0; | ||
| padding: 0; | ||
| box-sizing: border-box; | ||
| } | ||
| body { | ||
| background: #FFECE9; | ||
| background: #e2e7e8; | ||
| font-family: "Oxygen", sans-serif; | ||
| } | ||
|
|
||
| .title { | ||
| background-image: url(./bakgrund.jpeg) ; | ||
| background-position: left bottom; | ||
| background-repeat: no-repeat; | ||
| background-size: cover; | ||
| background-attachment: fixed; | ||
| position: relative; | ||
| height: 220px; | ||
| width: 100%; | ||
| display: grid; | ||
| justify-content: center; | ||
| align-items: center; | ||
| padding: 5%; | ||
| font-size: 1.4rem; | ||
| text-align: center; | ||
| } | ||
|
|
||
| main { | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .user-container { | ||
| display: grid; | ||
| grid-template-columns: 1fr; | ||
| justify-content: center; | ||
| background-color: rgba(148,182,165,0.8); | ||
| } | ||
|
|
||
| .user-image { | ||
| max-width: 20vw; | ||
| border-radius: 100%; | ||
| padding-top: 20px; | ||
| } | ||
|
|
||
| .user-img { | ||
| display: flex; | ||
| justify-content: center; | ||
| padding-top: 10px; | ||
| } | ||
|
|
||
| .user-info { | ||
| display: grid; | ||
| padding-bottom: 40px; | ||
| justify-items: center; | ||
| } | ||
|
|
||
| .projects { | ||
| color: black; | ||
| display: inline-grid; | ||
| grid-template-columns: 1fr; | ||
| justify-items: center; | ||
| padding: 5%; | ||
| } | ||
|
|
||
| .repocard { | ||
| display: block; | ||
| align-items: center; | ||
| text-align: center; | ||
| padding: 20px; | ||
| margin: 10px; | ||
| width: 100%; | ||
| background-color: rgba(148,182,165,0.1); | ||
| } | ||
|
|
||
| .repocard a { | ||
| text-decoration: none; | ||
| color: gray | ||
| } | ||
|
|
||
| a:hover { | ||
| color: darkgreen; | ||
| } | ||
|
|
||
| .chart-wrapper { | ||
| display: grid; | ||
| justify-items: center; | ||
| width: 100%; | ||
| background-color: rgba(148,182,165,0.5); | ||
| } | ||
|
|
||
| .chart-container { | ||
| display: grid; | ||
| justify-items: center; | ||
| padding: 5%; | ||
| max-width: 450px; | ||
| } | ||
|
|
||
|
|
||
| @media (min-width: 769px) { | ||
| .projects { | ||
| grid-template-columns: 1fr 1fr; | ||
| column-gap: 25px; | ||
| } | ||
|
|
||
| .title { | ||
| font-size: 1.9rem; | ||
| } | ||
| } |
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.
Great job with fetching the img and username!
A tip to make it even more clever is to wrap the
<h3>in<a>tag and add${data.html_url}to link the username to your github profile.