-
Notifications
You must be signed in to change notification settings - Fork 130
Github-tracker Nina Rivera #54
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,13 +1,17 @@ | ||
| # 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 assignment was to make a github-tracker, a page which shows your profile picture, username and information about your projects, pullrequests and commits. We also learned how to incorporate charts in our work. | ||
|
|
||
| ## 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? | ||
|
|
||
| Fortunately I have a couple of people I study with, who help me a lot when I'm stuck. I started by watching the videos by our teachers, and then the recordings of our classes. This helped since I could rewind and watch again if something was unclear. I've also used StackOverflow for some guidance. | ||
|
|
||
| This week I've used a page to help me with the colorschemes for my page and this is the link: https://coolors.co/ | ||
| I've also learned how to do shading in css which was cool. Hopefully my javascript aha-moment is just a couple of weeks away! | ||
|
|
||
|
|
||
| ## 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://githubtracker-ninaalejandra.netlify.app/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| TODO-list: | ||
|
|
||
| 1) fetch the repos and console log them x | ||
| 2) get them in the browser x | ||
| 3) filter out the technigo repos x | ||
| 4) test chart library x | ||
| 5) add pullrequests x | ||
| 6) add profile pic x | ||
| 7) add commits x | ||
| 8) style x |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| //DOM-selectors | ||
| const profileInfo = document.getElementById("profile") | ||
| const list = document.getElementById("list") | ||
|
|
||
| //Github | ||
| const USER = 'NinaAlejandra' | ||
| const REPOS_URL = `https://api.github.com/users/${USER}/repos` | ||
| const API_MY_PROFILE = 'https://api.github.com/users/NinaAlejandra' | ||
|
|
||
| //User | ||
| const getUser = () => { | ||
| fetch(API_MY_PROFILE) | ||
| .then((response) => response.json()) | ||
| .then((data) => { | ||
| profileInfo.innerHTML = | ||
| `<img src="https://github.com/NinaAlejandra.png" alt="Profile picture"> | ||
| <h4> ${data.name}</h4> | ||
| <h4> <a href="${data.html_url}">${data.login}</a></h4>` | ||
| }) | ||
| } | ||
|
|
||
| //Fetches | ||
| const getRepos = () => { | ||
| fetch(REPOS_URL) | ||
| .then(response => response.json()) | ||
| .then(data => { | ||
| const forkedRepos = data.filter(repo => repo.fork && repo.name.startsWith('project-')) | ||
| const forkedSortedRepos = forkedRepos.sort(sortingFunctionFromStackOverflow) | ||
| forkedSortedRepos.forEach(repo => list.innerHTML += ` | ||
| <div class="projects"> | ||
| <h3><a href="${repo.html_url}">${repo.name} | ||
| with default branch ${repo.default_branch}</h3></a> | ||
| <p>Recent push: ${new Date(repo.pushed_at).toDateString()}</p> | ||
| <p id="pull-request-${repo.name}"></p> | ||
| <p id="commits-${repo.name}"></p> | ||
| </div>`) | ||
| drawChart(forkedSortedRepos.length) | ||
| fetchPullRequest(forkedSortedRepos) | ||
| addCommits(forkedSortedRepos) | ||
| }) | ||
| } | ||
|
|
||
| const fetchPullRequest = (allRepos) => { | ||
| allRepos.forEach(repo => { | ||
| fetch(`https://api.github.com/repos/Technigo/${repo.name}/pulls?per_page=100`) | ||
| .then((res) => res.json()) | ||
| .then((data) => { | ||
| const myPullRequests = data.filter((pullRequest) => pullRequest.user.login === USER) | ||
| document.getElementById(`pull-request-${repo.name}`).innerHTML = `Pull Requests: ${myPullRequests.length}` | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
| const addCommits = (allRepos) => { | ||
| allRepos.forEach(repo => { | ||
| fetch(`https://api.github.com/repos/${USER}/${repo.name}/commits`) | ||
| .then((res) => res.json()) | ||
| .then((data) => { | ||
| document.getElementById(`commits-${repo.name}`).innerHTML = `Commits: ${data.length}` | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
| function sortingFunctionFromStackOverflow(a, b) { | ||
|
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 is a very nice function! I forgot to use it, I really should add it. 😊 |
||
| return new Date(a.created_at) - new Date(b.created_at) | ||
| } | ||
|
|
||
| //invoking functions | ||
| getUser() | ||
| getRepos() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,84 @@ | ||
| body { | ||
| background: #FFECE9; | ||
| } | ||
| background: #F7D4BC; | ||
| font-family: 'Gemunu Libre', sans-serif; | ||
| } | ||
|
|
||
| header { | ||
| text-align: center; | ||
| font-size: 30px; | ||
| } | ||
|
|
||
| .profile { | ||
| align-items: center; | ||
| justify-content: center; | ||
| display: flex; | ||
| text-align:center; | ||
| color: #218380; | ||
| margin:auto; | ||
| width: 100%; | ||
| flex-direction: column; | ||
| } | ||
|
|
||
| img { | ||
| border-radius: 50%; | ||
| width: 200px; | ||
| margin: 15px; | ||
| box-shadow: -30px 30px 30px rgba(0, 0, 0, 0.3); | ||
|
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. It's nice that you added a shadow to your profile image! the shadow looks a little bit "off" from the shape of the image, a suggestion is to play around a little with the value-numbers of the shadows. I also worked a while to figure out the numbers to make the shadow, its tricky! 😊 |
||
| } | ||
|
|
||
| p { | ||
| color: #AD5D4E; | ||
| } | ||
|
|
||
| .projects { | ||
| flex-direction: column; | ||
|
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 like your responsiveness of the project-boxes! Since it seems like you have already declared the .projectbox to be display: flex I think that the display: block doesn't do anything in this part? I tried to remove it in the inspector and it seems to no change anything. just a suggestion of you want to have a little bit less code 😊 |
||
| display: block; | ||
| border-style: solid; | ||
| color: #AD5D4E; | ||
| margin: 5px; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .chart-class { | ||
| width: 50%; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
|
Comment on lines
+42
to
+46
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. The chart was very tricky to style because it doesn't really listen to whatever you style it to like other element, I also tried to style it with flex and with different align-item and justify-content etc but nothing actually happened. The only thing that seems to work is the margin: auto; that you have, the other properties could actually be removed I think. (could be worth try to remove it to have a cleaner code) I also just set a width in % and then align-self: center to make it centered and not being huge, that worked for me at least 🙂 |
||
| margin: auto; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| h4 { | ||
| font-size: 25px; | ||
| margin: 5px; | ||
| font-weight: bolder; | ||
| } | ||
|
|
||
| a { | ||
| font-size: 18px; | ||
| color: #218380; | ||
| } | ||
|
|
||
| a:hover { | ||
| color:#74a09f; | ||
| } | ||
|
|
||
| @media (min-width: 668px){ | ||
|
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. you have great responsiveness in mobile and tablet but I think it would be great to add another media query for desktops and bigger, it works as it is but the project boxes becomes a little bit too stretched and the chart is huge 😄 |
||
| main { | ||
| text-align: center; | ||
| flex-direction: row; | ||
|
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. It seems like this one get overwritten in the inspector tool by the display: block element so it doesn't actually serve anything. tips is to check the inspector and try to remove and add to see if anything happens 😊 |
||
| } | ||
|
|
||
| .projects { | ||
| display: inline-block; | ||
| text-align: center; | ||
| padding: 5px; | ||
| width: 33%; | ||
| height: 50%; | ||
| } | ||
|
|
||
| .chart-class { | ||
| width: 40%; | ||
| margin-top: 20px; | ||
| } | ||
| } | ||
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 doesn't seem like this h2 is visible in the page? is it maybe behind some object or just invisible? 🤔