-
Notifications
You must be signed in to change notification settings - Fork 131
Finished Project #112
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?
Finished Project #112
Conversation
rijad90
left a comment
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.
Well done! You should be proud of your accomplishment this week. Clean JS code, easy to understand.
Usually I would mention that the CSS is not on point to 100%, but I have seen your capability in other projects so I don't mind at all as this was by far the hardest project, so far.
Woop woop!
| // GITHUB API | ||
| const USER = 'Dopest0727' | ||
| const PARENT_OWNER = 'Technigo' | ||
| const REPOS_URL = `https://api.github.com/users/${USER}/repos` | ||
| const USER_URL = `https://api.github.com/users/${USER}` | ||
|
|
||
| // GLO VAR | ||
| const projects = document.getElementById('projects') | ||
| const userData = document.getElementById('userData') | ||
|
|
||
| // FILTER BY | ||
| const filterAllBtn = document.getElementById('filterAllBtn') | ||
| const filterLangJsBtn = document.getElementById('filterLangJsBtn') | ||
| const filterLangHtmlBtn = document.getElementById('filterLangHtmlBtn') | ||
|
|
||
| const sortSizeBtn = document.getElementById('sortSizeBtn') | ||
| const sortCreatedBtn = document.getElementById('sortCreatedBtn') | ||
| const sortNameBtn = document.getElementById('sortNameBtn') | ||
|
|
||
| let reposArr = [] | ||
| let reposData = {} | ||
|
|
||
| const pullReqData = { | ||
| total: 19, | ||
| done: 4, | ||
| } |
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.
Well done, I like the way you sorted this!
| reposData[repo.name] = { pullRequest: '', authors: '', commits: '' } | ||
|
|
||
| generateProjectCard(repo) | ||
| const COMMITS_URL = `https://api.github.com/repos/${USER}/${repo.name}/commits?per_page=100` |
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.
Good job inceasing the amout results from 30 to 100
| } | ||
|
|
||
| const fetchAllReposFromUser = () => { | ||
| // FETCH MY REPOS |
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.
Good job adding the comments making it more clear for a a reviews
| } | ||
| }) | ||
| }) | ||
| .catch(err => alert('fetchFullRepo error:', err)) |
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.
Nice :)
| const getCollaborators = (commits, repo) => { | ||
| // filter out each commit author and stor for later sort | ||
| let authors = {} | ||
| commits.forEach(commit => { | ||
| if (!Object.keys(authors).includes(commit.author.login)) { | ||
| authors[commit.author.login] = { | ||
| avatar_url: commit.author.avatar_url, | ||
| html_url: commit.author.html_url, | ||
| } | ||
| } | ||
| }) | ||
| reposData[repo.name].authors = authors | ||
| populateCollaborators(authors, repo) | ||
| fetchPullRequestsArray(repo, Object.keys(authors)) | ||
| } | ||
|
|
||
| const populateCollaborators = (authors, repo) => { | ||
| for (const author in authors) { | ||
| if (Object.keys(authors).length > 1) { | ||
| document.getElementById( | ||
| `collaborators-${repo.name}` | ||
| ).innerHTML += `<a href="${authors[author].html_url}" target="_blank"><img class="avatar-collaborator" src="${authors[author].avatar_url}"></a>` | ||
| } else { | ||
| document.getElementById(`collaborators-${repo.name}`).innerHTML = | ||
| 'Individual project' | ||
| } | ||
| } | ||
| } |
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.
Nice detail to let users know your collabs for the project!
No description provided.