Skip to content

Commit 777ae24

Browse files
committed
Some major bugs of project is fixed
1 parent dead44a commit 777ae24

3 files changed

Lines changed: 78 additions & 41 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"liveServer.settings.port": 5501
3+
}

‎hackyourrepo-app/AmirHossein/script.js‎

Lines changed: 65 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,20 @@ const card = elFactory('div', {calss: 'card'}, // Leftside table
4949
elFactory('td', {class: 'col-left'}, 'Update: '),
5050
elFactory('td', {class: 'col-right rep-update'}, '2020-05-27 12:00:00'))));
5151

52-
const rightSide = elFactory('section', {id: 'right-side'},
53-
elFactory('div', {id: 'contributor'}, 'Contributors'));
54-
const smallCard = elFactory('div', {class: 'card samll-card'},
55-
elFactory('img', {src: 'https://avatars3.githubusercontent.com/u/3985124?v=4', calss: 'userPhoto', width: '50px'}),
56-
elFactory('a', {href: '', class: 'userName'}, 'Isabela'),
57-
elFactory('div', {class: 'badge'}, '9'));
52+
53+
const rightSide = elFactory('section', {id: 'right-side'},
54+
elFactory('div', {id: 'contributor'}, 'Contributors'));
55+
56+
// const smallCard = elFactory('div', {class: 'card samll-card'},
57+
// elFactory('img', {src: '', calss: 'userPhoto', width: '50px'}),
58+
// elFactory('a', {href: '', class: 'userName'}, ''),
59+
// elFactory('div', {class: 'badge'}, ''));
60+
61+
62+
5863

5964
leftSide.appendChild(card);
60-
rightSide.appendChild(smallCard);
65+
// rightSide.appendChild(smallCard);
6166
container.appendChild(header);
6267
bottomBox.appendChild(leftSide);
6368
bottomBox.appendChild(rightSide)
@@ -68,7 +73,6 @@ const select = header.querySelector('select');
6873

6974

7075

71-
7276
function addrepoNames(data) {
7377

7478
data.forEach(element => {
@@ -78,42 +82,68 @@ function addrepoNames(data) {
7882
select.appendChild(option);
7983
});
8084

85+
86+
87+
8188
select.addEventListener('input', () => {
89+
90+
rightSide.innerHTML = ''
91+
8292
data.forEach(element => {
83-
if(select.value === element.name) {
84-
const repoDescription = card.querySelector('.rep-description');
85-
repoDescription.innerHTML = element.description;
86-
const repoName = card.querySelector('.repo-link');
87-
repoName.innerHTML = element.name;
88-
repoName.href = element.html_url;
89-
const forks = card.querySelector('.rep-fork');
90-
forks.innerHTML = element.forks;
91-
const update = card.querySelector('.rep-update');
92-
update.innerHTML = element.updated_at;
93-
const smallCard = elFactory('div', {class: 'card samll-card'},
94-
elFactory('img', {src: 'https://avatars3.githubusercontent.com/u/3985124?v=4', calss: 'userPhoto', width: '50px'}),
95-
elFactory('a', {href: '', class: 'userName'}, 'Isabela'),
96-
elFactory('div', {class: 'badge'}, '9'));
97-
const contributorsUrl = element.contributors_url;
98-
fetch(contributorsUrl)
99-
.then(response => response.json())
100-
.then(data2 => console.log(data2))
101-
// image.src = ''
102-
// fetch(pokUrl)
103-
// .then(response => response.json())
104-
// .then(data => {
105-
// image.src = data.sprites.front_default;
106-
// document.body.appendChild(image);
107-
// })
108-
// .catch(error => console.log(error))
109-
}
93+
94+
if(select.value === element.name) {
95+
const repoDescription = card.querySelector('.rep-description');
96+
const repoName = card.querySelector('.repo-link');
97+
const forks = card.querySelector('.rep-fork');
98+
const update = card.querySelector('.rep-update');
99+
repoDescription.innerHTML = element.description;
100+
repoName.innerHTML = element.name;
101+
repoName.href = element.html_url;
102+
forks.innerHTML = element.forks;
103+
update.innerHTML = element.updated_at;
104+
105+
106+
107+
const contributorsUrl = element.contributors_url;
108+
console.log(contributorsUrl);
109+
110+
fetch(contributorsUrl)
111+
.then(response => response.json())
112+
.then(data2 => {
113+
console.log(data2)
114+
data2.forEach(element2 => {
115+
116+
const smallCard = elFactory('div', {class: 'card samll-card'},
117+
elFactory('img', {src: '', calss: 'userPhoto', width: '50px'}),
118+
elFactory('a', {href: '', class: 'userName'}, ''),
119+
elFactory('div', {class: 'badge'}, ''));
120+
121+
const userName = smallCard.querySelector('.userName');
122+
const image = smallCard.querySelector('img');
123+
const badge = smallCard.querySelector('.badge');
124+
image.src = element2.avatar_url;
125+
userName.innerHTML = element2.login;
126+
userName.href = element2.html_url;
127+
badge.innerHTML = element2.contributions;
128+
129+
rightSide.appendChild(smallCard)
130+
131+
})
132+
133+
134+
})
135+
136+
// .catch(error => console.log(error))
137+
}
110138

111139

112140
})
113141
})
114142

115143
};
116144

145+
146+
117147
function fetchData(url) {
118148

119149
fetch(url)

‎hackyourrepo-app/AmirHossein/style.css‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
padding: 0;
77
box-sizing: border-box;
88

9+
}
10+
.container {
11+
width: 80%;
12+
margin: 0 auto;
13+
914
}
1015

1116
#header {
@@ -17,15 +22,12 @@
1722
padding: 20px;
1823

1924
}
20-
p {
21-
margin-right: 30px;
22-
}
2325

24-
.container {
25-
width: 80%;
26-
margin: 0 auto;
2726

2827

28+
29+
p {
30+
margin-right: 30px;
2931
}
3032

3133
.bottom-box {
@@ -62,6 +64,7 @@ p {
6264
width: 50%;
6365
}
6466

67+
6568
#contributor {
6669
margin-top: 10px;
6770
margin-left:0.4rem;
@@ -73,6 +76,7 @@ p {
7376
border-bottom: none;
7477
height: 3em;
7578
}
79+
7680
.small-card {
7781
display: flex;
7882
border: 3px solid black;

0 commit comments

Comments
 (0)