-
Notifications
You must be signed in to change notification settings - Fork 130
Week 7 | GitHub Tracker | Amanda Tilly #13
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
amandatilly
wants to merge
15
commits into
Technigo:main
Choose a base branch
from
amandatilly: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
15 commits
Select commit
Hold shift + click to select a range
7412d72
fetched repos, filtered forked projects and added to browser. started…
b8cfa37
fetched and filtered pull requests
f745132
fetching data for commits and comments from api
0d74677
fetched most recent push date, default branch name for repos, number …
868cffd
username and profile picture
ea40877
readme update
dc2f55d
added chart and class names, started styling
12c000c
styling and media queries
c85baa1
header styling, picture size and background height
5fd1717
h1 size
70d3032
text shadow
5eb8df7
cleaned up code and added comments
82130cc
adding comments in js
5d1d6f3
updated readme
68f4841
Update README.md
amandatilly 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,20 @@ | ||
| # 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. | ||
| Creating a place to keep track of the GitHub repos made during my Boot Camp at Technigo. Using JavaScript, html, css and fetching data from API's from the JSON response. | ||
|
|
||
| ## 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? | ||
| My page includes: | ||
|
|
||
| - A list of all repos that are forked from Technigo | ||
| - Username and profile picture | ||
| - Most recent update (push) for each repo | ||
| - Name of default branch for each repo | ||
| - URL to the actual GitHub repo | ||
| - Number of commits for each repo | ||
| - It is responsive (mobile first) | ||
| - A visualisation, a donut chart, of how many projects I've done so far, compared to how many I will do. | ||
|
|
||
| ## 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://elegant-pasteur-b7cf22.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 |
|---|---|---|
| @@ -1,4 +1,27 @@ | ||
| //DOM-selector for the canvas 👇 | ||
| const ctx = document.getElementById('chart').getContext('2d') | ||
| const ctx = document.getElementById("chart").getContext("2d"); | ||
|
|
||
| //"Draw" the chart here 👇 | ||
|
|
||
| const drawChart = (amount) => { | ||
| const config = { | ||
| type: "doughnut", | ||
| data: { | ||
| labels: ["Completed Projects", "Remaining Projects"], | ||
| datasets: [ | ||
| { | ||
| label: "My First Dataset", | ||
| data: [amount, 20 - amount], | ||
| backgroundColor: [ | ||
| "rgb(22, 35, 50)", | ||
| "rgba(222,207,168,255) ", | ||
| "rgb(255, 205, 86)", | ||
| ], | ||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,36 @@ | ||
| <!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> | ||
| <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" /> | ||
| <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=Amatic+SC:wght@400;700&family=Josefin+Sans:wght@400;700&display=swap" | ||
| rel="stylesheet" | ||
| /> | ||
| </head> | ||
|
|
||
| <!-- This will be used to draw the chart 👇 --> | ||
| <canvas id="chart"></canvas> | ||
| <body> | ||
| <header class="header"> | ||
| <div class="user-profile" id="userProfile"></div> | ||
| </header> | ||
|
|
||
| <script src="./script.js"></script> | ||
| <script src="./chart.js"></script> | ||
| </body> | ||
| </html> | ||
| <section class="grid"> | ||
| <h1>GitHub Tracker</h1> | ||
| <main class="projects" id="projects"></main> | ||
|
|
||
| <!-- This will be used to draw the chart 👇 --> | ||
| <div class="chart-container"> | ||
| <canvas id="chart"></canvas> | ||
| </div> | ||
| </section> | ||
|
|
||
| <script src="./script.js"></script> | ||
| <script src="./chart.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,85 @@ | ||
| const USER = "amandatilly"; | ||
| const REPOS_URL = `https://api.github.com/users/${USER}/repos`; | ||
| const USER_URL = `https://api.github.com/users/${USER}`; | ||
|
|
||
| const projectContainer = document.getElementById("projects"); | ||
| const profileContainer = document.getElementById("userProfile"); | ||
|
|
||
| // function to fetch and display user profile info | ||
| const fetchUser = () => { | ||
| fetch(USER_URL) | ||
| .then((res) => res.json()) | ||
| .then((data) => { | ||
| profileContainer.innerHTML = ` | ||
| <section class="user"> | ||
| <img class="picture" src="${data.avatar_url}" alt="profile picture" /> | ||
| <h2>Hi I'm ${data.name}</h2> | ||
| <p>An ${data.bio} based in ${data.location}</p> | ||
| <a href="${data.html_url}">@${data.login}</a> | ||
| </section> | ||
| `; | ||
| }); | ||
| }; | ||
|
|
||
| //function to fetch and display repos | ||
| const getRepos = () => { | ||
| fetch(REPOS_URL) | ||
| .then((res) => res.json()) | ||
| .then((data) => { | ||
| // filters out repos for user name and that starts with project- | ||
| const forkedRepos = data.filter( | ||
| (repo) => repo.fork && repo.name.startsWith("project-") | ||
| ); | ||
|
|
||
| forkedRepos.forEach( | ||
| (repo) => | ||
| (projectContainer.innerHTML += ` | ||
| <div class="repo-card" id=${repo.name}> | ||
| <a href="${repo.html_url}">${repo.name}</a> | ||
| <p>Branch: ${repo.default_branch} </p> | ||
| <p>Latest update: ${new Date(repo.pushed_at).toDateString()}</p> | ||
| <p id="commit-${repo.name}">Number of commits: </p> | ||
| </div> | ||
| `) | ||
| ); | ||
| drawChart(forkedRepos.length); // calling function and passing value to chart.js (amount) | ||
| getPullRequests(forkedRepos); // calling function and passing value | ||
| }); | ||
| }; | ||
|
|
||
| //function to fetch pull | ||
| const getPullRequests = (repos) => { | ||
| repos.forEach((repo) => { | ||
| fetch( | ||
| `https://api.github.com/repos/Technigo/${repo.name}/pulls?per_page=100` | ||
| ) | ||
| .then((res) => res.json()) | ||
| .then((data) => { | ||
| //compares repo user info to pull user info and title with my name | ||
| const userPullRequests = data.find( | ||
| (pull) => | ||
| repo.owner.login === pull.user.login || | ||
| pull.title.includes("Amanda") | ||
| ); | ||
| // displays number of commits if a pull request has been made, if not it displays message | ||
| if (userPullRequests) { | ||
| fetchCommits(userPullRequests.commits_url, repo.name); //calling function and passing values | ||
| } else { | ||
| document.getElementById(`commit-${repo.name}`).innerHTML = | ||
| "No pull request yet"; | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
|
|
||
| //function to fetch and display commits | ||
| const fetchCommits = (myCommitsUrl, myRepoName) => { | ||
| fetch(myCommitsUrl) | ||
| .then((res) => res.json()) | ||
| .then((data) => { | ||
| document.getElementById(`commit-${myRepoName}`).innerHTML += data.length; | ||
| }); | ||
| }; | ||
|
|
||
| getRepos(); | ||
| fetchUser(); |
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,182 @@ | ||
| * { | ||
| margin: 0; | ||
| padding: 0; | ||
| border: 0 none; | ||
| } | ||
|
|
||
| body { | ||
| background: #FFECE9; | ||
| } | ||
| background: #ce7f5a; | ||
| font-family: "Josefin Sans", sans-serif; | ||
| line-height: 1.5; | ||
| } | ||
|
|
||
| /* Hero */ | ||
|
|
||
| .header { | ||
| height: 90vh; | ||
| width: auto; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| text-align: center; | ||
| background-image: url("https://images.unsplash.com/photo-1456615074700-1dc12aa7364d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2940&q=80"); | ||
| background-size: cover; | ||
| background-repeat: no-repeat; | ||
| background-position: left; | ||
| position: relative; | ||
| } | ||
|
|
||
| .header p, | ||
| h2 { | ||
| color: whitesmoke; | ||
| } | ||
|
|
||
| .header a:link { | ||
| text-transform: lowercase; | ||
| color: whitesmoke; | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .header a:visited { | ||
| color: whitesmoke; | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .header a:hover { | ||
| text-decoration: underline; | ||
| color: #c9b597; | ||
| } | ||
|
|
||
| .picture { | ||
| border-radius: 50%; | ||
| width: 100px; | ||
| } | ||
| .user { | ||
| text-shadow: 5px 5px 10px black; | ||
| } | ||
|
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 really like this text-shadow effect. It adds a professional touch and depth as well |
||
|
|
||
| /* Main Section */ | ||
|
|
||
| .projects { | ||
| display: flex; | ||
| flex-direction: row; | ||
| flex-wrap: wrap; | ||
| align-items: center; | ||
| justify-content: center; | ||
| grid-gap: 5px; | ||
| padding: 20px; | ||
| } | ||
|
|
||
| .grid { | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: 30px; | ||
| margin-top: 100px; | ||
| margin-bottom: 60px; | ||
| } | ||
|
|
||
| .grid h1 { | ||
| font-size: 30px; | ||
| color: whitesmoke; | ||
| text-align: center; | ||
| text-transform: uppercase; | ||
| } | ||
|
|
||
| .repo-card { | ||
| display: flex; | ||
| flex-direction: column; | ||
| box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | ||
| margin-top: 10px; | ||
| margin-bottom: 10px; | ||
| padding: 20px; | ||
| align-items: center; | ||
| background-color: #162332; | ||
| min-width: 200px; | ||
| max-width: 400px; | ||
| width: 80%; | ||
| color: whitesmoke; | ||
| gap: 10px; | ||
| } | ||
|
|
||
| .repo-card a:link { | ||
| text-decoration: none; | ||
| text-transform: uppercase; | ||
| color: #c9b597; | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| .repo-card a:visited { | ||
| text-decoration: none; | ||
| color: #c9b597; | ||
| } | ||
|
|
||
| .repo-card a:hover { | ||
| text-decoration: underline; | ||
| color: whitesmoke; | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| .chart-container { | ||
| max-width: 400px; | ||
| } | ||
|
|
||
| /* Media Queries */ | ||
|
|
||
| @media (min-width: 768px) { | ||
| .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. This empty-set should probably be removed :) |
||
| .chart-container { | ||
| min-width: 400px; | ||
| } | ||
|
|
||
| .grid h1 { | ||
| font-size: 40px; | ||
| } | ||
|
|
||
| .repo-card p, | ||
| a { | ||
| font-size: 20px; | ||
| } | ||
|
|
||
| .header h2 { | ||
| font-size: 30px; | ||
| } | ||
|
|
||
| .header p { | ||
| font-size: 20px; | ||
| } | ||
| } | ||
|
|
||
| @media (min-width: 992px) { | ||
| .projects { | ||
| gap: 10px; | ||
| } | ||
|
|
||
| .chart-container { | ||
| min-width: 600px; | ||
| } | ||
|
|
||
| .repo-card p, | ||
| a { | ||
| font-size: 25px; | ||
| } | ||
|
|
||
| .header h2 { | ||
| font-size: 35px; | ||
| } | ||
|
|
||
| .header p { | ||
| font-size: 25px; | ||
| } | ||
|
|
||
| .grid h1 { | ||
| font-size: 50px; | ||
| } | ||
|
|
||
| .picture { | ||
| width: 130px; | ||
| } | ||
| } | ||
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.
I really like the hover effect on the chart. Great idea