-
Notifications
You must be signed in to change notification settings - Fork 130
Github-tracker project #93
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
NabeelMansour
wants to merge
24
commits into
Technigo:main
Choose a base branch
from
NabeelMansour: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
24 commits
Select commit
Hold shift + click to select a range
7b4f24c
added the final work
NabeelMansour 6d9f2d5
Update README.md
NabeelMansour ea1bd1a
update styling
NabeelMansour 523e82b
updated index file
NabeelMansour c9550bc
update the css file
NabeelMansour 5f6d095
Update readme file
NabeelMansour 229285a
Update script.js
NabeelMansour 29ad152
cleant up the css
NabeelMansour ff28d82
Updated the script file
NabeelMansour ac49256
Updated html file
NabeelMansour 6d577fd
Update index.html
NabeelMansour 02a14c1
Update index.html
NabeelMansour 4bc0ac8
Update script.js
NabeelMansour e5d0f0c
Update style.css
NabeelMansour 89280d9
Update script.js
NabeelMansour ab727c0
Update script.js
NabeelMansour fa0982c
Update script.js
NabeelMansour a751f60
Update script.js
NabeelMansour ec90c1c
Update script.js
NabeelMansour f01ae55
Update script.js
NabeelMansour c76f768
Update script.js
NabeelMansour 9bd6ba0
Update script.js
NabeelMansour 4cb2e59
Update style.css
NabeelMansour 0f3d8bd
Update style.css
NabeelMansour 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
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,10 @@ | ||
| # 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. | ||
| Assigment was about to make a github tracker | ||
|
|
||
| ## 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? | ||
|
|
||
| ## 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://stoic-archimedes-d36d72.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
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,21 +1,40 @@ | ||
| <!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" /> | ||
| </head> | ||
| <body> | ||
| <h1>GitHub Tracker</h1> | ||
| <h2>Projects:</h2> | ||
| <main id="projects"></main> | ||
|
|
||
| <!-- This will be used to draw the chart 👇 --> | ||
| <canvas id="chart"></canvas> | ||
|
|
||
| <script src="./script.js"></script> | ||
| <script src="./chart.js"></script> | ||
| </body> | ||
| </html> | ||
| <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" /> | ||
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
| <link | ||
| href="https://fonts.googleapis.com/css2?family=Raleway&display=swap" | ||
| rel="stylesheet" | ||
| /> | ||
|
|
||
| <title>Project GitHub Tracker</title> | ||
| <link rel="stylesheet" href="./style.css" /> | ||
| </head> | ||
|
|
||
| <body> | ||
| <!-- list of projects --> | ||
| <main class="header" id="header"></main> | ||
|
|
||
| <div class="myDiv"></div> | ||
|
|
||
| <section class="container" id="container"></section> | ||
|
|
||
| <!-- This will be used to draw the chart 👇 --> | ||
|
|
||
| <!-- <canvas id="chart" class="chart"></canvas> --> | ||
|
|
||
| <div class="chart-container" id="chart-container"> | ||
| <canvas id="chart"></canvas> | ||
| </div> | ||
|
|
||
| <script src="./token.js"></script> | ||
| <script src="./chart.js"></script> | ||
| <script src="./script.js"></script> | ||
| </body> | ||
| </html> | ||
|
|
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,117 @@ | ||
| const username = 'NabeelMansour' | ||
| const container = document.getElementById('container') | ||
| const header = document.getElementById('header') | ||
| const technigoRepos = document.getElementById('technigoRepos') | ||
|
|
||
|
|
||
| // DOM selectors | ||
| const userName = document.getElementById('username') | ||
| const project = document.getElementById('projects') | ||
| const chart = document.getElementById('chart'); | ||
|
|
||
| const options = { | ||
| method: 'GET', | ||
| headers: { | ||
| Authorization: `token ${token}` | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| // API'S | ||
| const USER_API = `https://api.github.com/users/${username}` | ||
| const API_REPOS = `https://api.github.com/users/${username}/repos` | ||
|
|
||
|
|
||
|
|
||
| // fetch for the user info | ||
|
|
||
| fetch(USER_API, ) | ||
| .then(res => res.json()) | ||
| .then(data => { | ||
|
|
||
| header.innerHTML += ` | ||
| <div class="header-text"> | ||
| <img src="${data.avatar_url}" class="image" /> | ||
| <p>${data.name}</p> | ||
| <h1><span>${data.login}</span></h1> | ||
| <h2>GitHub Tracker</h2> | ||
| <p>${data.bio}</p> | ||
| </div> | ||
| ` | ||
|
|
||
| }) | ||
|
|
||
| // fetch the users reposetories | ||
|
|
||
| fetch(API_REPOS) | ||
| .then(res => res.json()) | ||
| .then(data => { | ||
|
|
||
| const technigoRepositories = data.filter(repo => repo.name.includes('project-') && repo.fork) | ||
|
|
||
| technigoRepositories.forEach((repo) => { | ||
| container.innerHTML += ` | ||
| <div class="technigo-repos" id="technigoRepos"> | ||
| <h2 id="repoName">${repo.name}</h2> | ||
| <h3 id="description">${repo.description}</h3> | ||
|
|
||
| <div class="repo-info"> | ||
| <p><span> Last push:</span> ${new Date(repo.pushed_at).toDateString()}</p> | ||
| <p><span> Branch:</span> ${repo.default_branch}</p> | ||
| <p><span> Main language:</span> ${repo.language}</p> | ||
| <p id="commit-${repo.name}"><span> Number of commits:</span> </p> | ||
| </div> | ||
| <p><a class="repo-link" target="_blank" href="${repo.html_url}">My Repo</a></p> | ||
| </div> | ||
| ` | ||
| }) | ||
| drawChart(technigoRepositories.length) | ||
| getPullRequests(technigoRepositories) // Calling the pull req and commits function | ||
| }) | ||
|
|
||
|
|
||
|
|
||
| // Gets the pull request for the projects | ||
| const getPullRequests = (forkedRepos) => { | ||
| forkedRepos.forEach(repo => { | ||
| fetch(`https://api.github.com/repos/Technigo/${repo.name}/pulls?per_page=100`) | ||
| .then(res => res.json()) | ||
| .then(data => { | ||
|
|
||
|
|
||
|
|
||
| const filteredPulls = data.find((pull) => pull.user.login === repo.owner.login) | ||
| if (filteredPulls) { | ||
| fetchCommits(filteredPulls.commits_url, repo.name) | ||
| } else { | ||
| document.getElementById(`commits-${repo.name}`).innerHTML = "No pulls from this user yet." | ||
| } | ||
|
|
||
| }) | ||
| }) | ||
| } | ||
|
|
||
| // fetches the commits | ||
| const fetchCommits = (myCommitsUrl, myRepoName) => { | ||
| fetch(myCommitsUrl) | ||
| .then(res => res.json()) | ||
| .then((data) => { | ||
| document.getElementById(`commit-${myRepoName}`).innerHTML += data.length | ||
| }) | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
Oops, something went wrong.
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.
It seems like there is no description so the page throw null. Better to remove this.