Skip to content

Apiweb3#5

Merged
outintotheblue merged 13 commits into
masterfrom
apiweb3
Oct 11, 2019
Merged

Apiweb3#5
outintotheblue merged 13 commits into
masterfrom
apiweb3

Conversation

@outintotheblue
Copy link
Copy Markdown
Owner

No description provided.

Comment thread homework-classes/Contributor.js Outdated
for (let contributor of listOfContributors) {
Util.createAndAppend('img', contributors, {
src: this.contributor.avatar_url,
class: 'contri',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contri seems like a strange css class name. Can there be an alternative here?

Comment thread homework-classes/App.js
@@ -54,7 +55,7 @@ class App {
const repo = this.repos[index];
const contributors = await repo.fetchContributors();
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem is here! Cant seem to go through this part

Comment thread homework/index1.js
function listenerSelect(listOfRepos) {
document.getElementById('dropdown-select').addEventListener('change', event => {
const selectedRepo = event.target.value;
const selectedData = listOfRepos.filter(repoData => repoData.name === selectedRepo)[0];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be returning undefined every time. Think this is the source of the bug.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The objects have a .repository field:

    document.getElementById('dropdown-select').addEventListener('change', event => {
      const selectedRepoName = event.target.value;
      const selectedRepoData = this.repos.filter(
        repoData => repoData.repository.name === selectedRepoName,
      )[0];
      const index = this.repos.indexOf(selectedRepoData);
      this.fetchContributorsAndRender(index);
    });

Comment thread homework-classes/Repository.js Outdated
render(container) {
// TODO: replace the next line with your code.
Util.createAndAppend('pre', container, { text: JSON.stringify(this.repository, null, 2) });
Util.createAndAppend('option', container, {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll have to add more here. Think you can copy code over from the previous week? Also, can't read if not white colored.

Comment thread homework-classes/Contributor.js Outdated
// TODO: replace the next line with your code.
Util.createAndAppend('pre', container, { text: JSON.stringify(this.contributor, null, 2) });
const contributorsDiv = Util.createAndAppend('div', root, { id: 'contributors' });
for (let contributor of listOfContributors) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for loop here. One class, will be for one contributor. Can delete this line.

Comment thread homework-classes/App.js Outdated
const rightDiv = Util.createAndAppend('div', container);

const contributorList = Util.createAndAppend('ul', contributorContainer);
const contributorList = Util.createAndAppend('ul', rightDiv);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably make this a normal div because it will not just be text, but images too.

Comment thread homework-classes/Contributor.js Outdated
render(container) {
// TODO: replace the next line with your code.
Util.createAndAppend('pre', container, { text: JSON.stringify(this.contributor, null, 2) });
const contributorsDiv = Util.createAndAppend('div', root, { id: 'contributors' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would rename to contributorDiv

Comment thread homework-classes/Contributor.js Outdated
Util.createAndAppend('pre', container, { text: JSON.stringify(this.contributor, null, 2) });
const contributorsDiv = Util.createAndAppend('div', root, { id: 'contributors' });
for (let contributor of listOfContributors) {
Util.createAndAppend('img', contributors, {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll want to do:
Util.createAndAppend('img', contributorDiv, {

Comment thread homework-classes/Contributor.js Outdated
class: 'contributors-detail',
});
}
//Util.createAndAppend('pre', container, { text: JSON.stringify(this.contributor, null, 2) });
Copy link
Copy Markdown

@grod220 grod220 Sep 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll then want to do a normal append with what you created above. Something like:

container.appendChild(contributorDiv)

Util.createAndAppend('p', contributorDiv, {
text: this.contributor.contributions,
class: 'contributors-detail',
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to use the container :)

  render(container) {
    Util.createAndAppend('img', container, {
      src: this.contributor.avatar_url,
      class: 'contributors-detail',
    });
    Util.createAndAppend('p', container, {
      text: this.contributor.login,
      class: 'contributors-detail',
    });
    Util.createAndAppend('p', container, {
      text: this.contributor.contributions,
      class: 'contributors-detail',
    });
  }
}

@outintotheblue outintotheblue merged commit 7fef171 into master Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants