Skip to content

Commit 196f543

Browse files
committed
feat(creators): add hardcoded creators list with carousel UI
Added an initial hardcoded list of creators and implemented a carousel for navigation. Skipped dynamic population of PR mergers from GitHub API for now, since it requires multiple API requests and was hitting rate limits.
1 parent 3ca0700 commit 196f543

File tree

3 files changed

+719
-569
lines changed

3 files changed

+719
-569
lines changed

app.js

Lines changed: 78 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,70 @@
1-
'use strict';
1+
"use strict";
22

33
// load more content
44
function loadMore() {
5-
const paragraphs = document.querySelectorAll('#projects_items .load_more');
5+
const paragraphs = document.querySelectorAll("#projects_items .load_more");
66
for (let i = 0; i < paragraphs.length; i++) {
7-
paragraphs[i].classList.add('show');
7+
paragraphs[i].classList.add("show");
88
}
9-
const hr = document.querySelectorAll('.line_hr');
9+
const hr = document.querySelectorAll(".line_hr");
1010
for (let i = 0; i < hr.length; i++) {
11-
hr[i].classList.add('sh');
11+
hr[i].classList.add("sh");
1212
}
13-
document.getElementById('load-more-button').style.display = 'none';
14-
document.getElementById('hide-button').style.display = 'block';
13+
document.getElementById("load-more-button").style.display = "none";
14+
document.getElementById("hide-button").style.display = "block";
1515
}
1616

1717
function hide() {
18-
const paragraphs = document.querySelectorAll('#projects_items .load_more');
18+
const paragraphs = document.querySelectorAll("#projects_items .load_more");
1919
for (let i = 0; i < paragraphs.length; i++) {
20-
paragraphs[i].classList.remove('show');
20+
paragraphs[i].classList.remove("show");
2121
}
22-
const hr = document.querySelectorAll('.line_hr');
22+
const hr = document.querySelectorAll(".line_hr");
2323
for (let i = 0; i < hr.length; i++) {
24-
hr[i].classList.remove('sh');
24+
hr[i].classList.remove("sh");
2525
}
26-
document.getElementById('load-more-button').style.display = 'block';
27-
document.getElementById('hide-button').style.display = 'none';
26+
document.getElementById("load-more-button").style.display = "block";
27+
document.getElementById("hide-button").style.display = "none";
2828
}
2929

30-
const members_url = "https://api.github.com/orgs/move-fast-and-break-things/members";
30+
const members_url =
31+
"https://api.github.com/orgs/move-fast-and-break-things/members";
3132

3233
// fetch authors data
3334
async function getAuthors(apiURL) {
34-
3535
const response = await fetch(apiURL);
3636
if (!response.ok) {
3737
throw new Error(`HTTP error! status: ${response.status}`);
3838
}
3939
const data = await response.json();
40-
return Promise.all(data.map(async (element) => {
41-
const userResponse = await fetch(element.url);
42-
if (!userResponse.ok) {
43-
throw new Error(`HTTP error! status: ${userResponse.status}`);
44-
}
45-
const userData = await userResponse.json();
46-
return {
47-
name: userData.name || userData.login,
48-
bio: userData.bio,
49-
avatar: userData.avatar_url,
50-
html_url: userData.html_url,
51-
};
52-
}));
40+
return Promise.all(
41+
data.map(async (element) => {
42+
const userResponse = await fetch(element.url);
43+
if (!userResponse.ok) {
44+
throw new Error(`HTTP error! status: ${userResponse.status}`);
45+
}
46+
const userData = await userResponse.json();
47+
return {
48+
name: userData.name || userData.login,
49+
bio: userData.bio,
50+
avatar: userData.avatar_url,
51+
html_url: userData.html_url,
52+
};
53+
})
54+
);
5355
}
5456

5557
// set authors in the DOM
5658
async function setAuthors(apiURL) {
5759
const authors = await getAuthors(apiURL);
58-
const container = document.querySelector("#creators > div > div");
60+
const container = document.querySelector("#creators .persons");
5961
if (!container) {
6062
throw new Error("Container element not found");
6163
}
62-
authors.forEach(author => {
63-
const personDiv = document.createElement('div');
64-
personDiv.className = 'person';
64+
console.log(container);
65+
authors.forEach((author) => {
66+
const personDiv = document.createElement("div");
67+
personDiv.className = "person";
6568
personDiv.innerHTML = `
6669
<div class="name_and_img">
6770
<a href="${author.html_url}" class="tooltip" target="_blank">
@@ -70,67 +73,94 @@ async function setAuthors(apiURL) {
7073
</a>
7174
</div>
7275
73-
<p class="about_person">${author.bio || 'No biography available'}</p>
76+
<p class="about_person">${
77+
author.bio || "No biography available"
78+
}</p>
7479
`;
7580
container.appendChild(personDiv);
7681
});
77-
7882
}
7983

8084
// set contributors in the DOM
8185
async function setContributors(apiURL, element) {
8286
try {
8387
const contributors = await getAuthors(apiURL);
84-
element.innerHTML = contributors.length === 0 ? "No developers found" :
85-
contributors.map(contributor => `
88+
element.innerHTML =
89+
contributors.length === 0
90+
? "No developers found"
91+
: contributors
92+
.map(
93+
(contributor) => `
8694
<span class="developer-name">
8795
<a href="${contributor.html_url}" class="tooltip" target="_blank">
8896
<img src="${contributor.avatar}" alt="${contributor.name}'s avatar" class="shining-image">
8997
<span class="tooltip-text">${contributor.name}</span>
9098
</a>
9199
</span>
92-
`).join('');
100+
`
101+
)
102+
.join("");
93103
} catch (error) {
94104
console.error("Error setting contributors:", error);
95-
element.innerHTML = "Can't load the developer list. Check out the repository page to see all of the contributors 😅";
105+
element.innerHTML =
106+
"Can't load the developer list. Check out the repository page to see all of the contributors 😅";
96107
}
97108
}
98109

99110
// load all contributors
100111
async function loadAllContributors() {
101112
const developerLists = document.querySelectorAll(".developers-list");
102-
const promises = Array.from(developerLists).map(devList => {
113+
const promises = Array.from(developerLists).map((devList) => {
103114
const apiURL = devList.getAttribute("data-value");
104115
return setContributors(apiURL, devList);
105116
});
106117
await Promise.all(promises);
118+
renderCreators(Array.from(allContributors.values()));
107119
}
108120

109121
// Scroll-to-top functionality
110122
function setupScrollToTop() {
111-
const toTopButton = document.getElementById('toTop');
123+
const toTopButton = document.getElementById("toTop");
112124
if (!toTopButton) return;
113125

114-
window.addEventListener('scroll', () => {
126+
window.addEventListener("scroll", () => {
115127
if (window.scrollY > 100) {
116-
toTopButton.style.display = 'block';
128+
toTopButton.style.display = "block";
117129
} else {
118-
toTopButton.style.display = 'none';
130+
toTopButton.style.display = "none";
119131
}
120132
});
121133

122-
toTopButton.addEventListener('click', (e) => {
134+
toTopButton.addEventListener("click", (e) => {
123135
e.preventDefault();
124136
window.scrollTo({
125137
top: 0,
126-
behavior: 'smooth'
138+
behavior: "smooth",
127139
});
128140
});
129141
}
130142

143+
function initCarousel() {
144+
const persons = document.querySelector(".persons");
145+
const nextBtn = document.querySelector(".carousel-btn.next");
146+
const prevBtn = document.querySelector(".carousel-btn.prev");
147+
148+
if (!persons || !nextBtn || !prevBtn) return;
149+
150+
nextBtn.addEventListener("click", () => {
151+
persons.scrollBy({ left: 260, behavior: "smooth" });
152+
});
153+
154+
prevBtn.addEventListener("click", () => {
155+
persons.scrollBy({ left: -260, behavior: "smooth" });
156+
});
157+
}
158+
131159
// Wait for DOM content to be loaded before executing scripts
132-
document.addEventListener('DOMContentLoaded', () => {
133-
setAuthors(members_url).catch(console.error);
160+
document.addEventListener("DOMContentLoaded", async () => {
161+
//since the creators are hardcoded, we can skip this step for now
162+
// setAuthors(members_url).catch(console.error);
134163
loadAllContributors();
164+
initCarousel();
135165
setupScrollToTop();
136-
});
166+
});

index.html

Lines changed: 78 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,13 @@ <h3>MFBT</h3>
511511
<section id="MAV" class="mav">
512512
<div class="container">
513513
<h2>Our Mission</h2>
514-
<div class="TextBlock">
515-
We are committed to making our community a welcoming space for everyone.
516-
Whether you're a seasoned developer, a beginner, or just curious,
517-
you're welcome here! We dedicated to fostering growth, collaboration,
518-
and continuous learning. Our mission is to cultivate an environment
519-
where individuals support each other in developing exceptional programs
520-
and expanding their knowledge.
514+
<div class="TextBlock">
515+
We are committed to making our community a welcoming space for everyone.
516+
Whether you're a seasoned developer, a beginner, or just curious,
517+
you're welcome here! We dedicated to fostering growth, collaboration,
518+
and continuous learning. Our mission is to cultivate an environment
519+
where individuals support each other in developing exceptional programs
520+
and expanding their knowledge.
521521
</div>
522522
<h2>Our Values</h2>
523523
<div class="TextBlock">
@@ -540,18 +540,82 @@ <h2>Our Values</h2>
540540
</li>
541541
</ul>
542542
</div>
543-
</section>
543+
</section>
544544

545545
<section id="creators" class="creators">
546546
<div class="container">
547-
<h2>Creators</h2>
548-
<div class="persons">
549-
550-
</div>
547+
<h2>Creators</h2>
548+
<div class="carousel-wrapper">
549+
<button class="carousel-btn prev"></button>
550+
<div class="persons">
551+
<div class="person">
552+
<div class="name_and_img">
553+
<a href="https://github.com/ast3310" class="tooltip" target="_blank">
554+
<img src="https://avatars.githubusercontent.com/u/40520443?v=4" alt="Unarokov Astemir's avatar">
555+
<p class="person_name">Unarokov Astemir</p>
556+
</a>
557+
</div>
558+
559+
<p class="about_person">✋ Hi, I’m Astemir. I’m a web developer who is creating a lot of interesting things. I can work on front-end part and also on back-end part of the application.</p>
560+
</div>
561+
<div class="person">
562+
<div class="name_and_img">
563+
<a href="https://github.com/KogaiIrina" class="tooltip" target="_blank">
564+
<img src="https://avatars.githubusercontent.com/u/63745301?v=4" alt="Irina Kogai's avatar">
565+
<p class="person_name">Irina Kogai</p>
566+
</a>
567+
</div>
568+
569+
<p class="about_person">Full-Stack Software Engineer &amp; Engineering Manager</p>
570+
</div>
571+
<div class="person">
572+
<div class="name_and_img">
573+
<a href="https://github.com/minervathebot" class="tooltip" target="_blank">
574+
<img src="https://avatars.githubusercontent.com/u/202535349?v=4" alt="Minerva Bot's avatar">
575+
<p class="person_name">Minerva Bot</p>
576+
</a>
577+
</div>
578+
579+
<p class="about_person">A helpful bot</p>
580+
</div>
581+
<div class="person">
582+
<div class="name_and_img">
583+
<a href="https://github.com/Misofser" class="tooltip" target="_blank">
584+
<img src="https://avatars.githubusercontent.com/u/20745234?v=4" alt="Sofia Mikhalevich's avatar">
585+
<p class="person_name">Sofia Mikhalevich</p>
586+
</a>
587+
</div>
588+
589+
<p class="about_person">Web developer with skills in illustrating and design</p>
590+
</div>
591+
<div class="person">
592+
<div class="name_and_img">
593+
<a href="https://github.com/PlutoniumSoup" class="tooltip" target="_blank">
594+
<img src="https://avatars.githubusercontent.com/u/145541424?v=4" alt="Andrey's avatar">
595+
<p class="person_name">Andrey</p>
596+
</a>
597+
</div>
598+
599+
<p class="about_person">An ordinary man with extraordinary ideas.
600+
Also like home-made pizza
601+
</p>
602+
</div>
603+
<div class="person">
604+
605+
<div class="name_and_img">
606+
<a href="https://github.com/yurijmikhalevich" class="tooltip" target="_blank">
607+
<img src="https://avatars.githubusercontent.com/u/4187729?v=4" alt="Yurij Mikhalevich's avatar">
608+
<p class="person_name">Yurij Mikhalevich</p>
609+
</a>
610+
</div>
611+
612+
<p class="about_person">No biography available</p>
613+
</div>
614+
</div>
615+
<button class="carousel-btn next"></button>
551616
</div>
552617
</section>
553618

554-
555619
<section id="join" class="join">
556620
<div class="container">
557621
<hr size=3px width=100% color="#3D4250">
@@ -594,8 +658,7 @@ <h2>Join us</h2>
594658
</div>
595659
</section>
596660

597-
598-
<footer>
661+
<footer>
599662
<div class="container">
600663
<div class="github_container">
601664
<a href="#"><img class="f_logo" src="img/logo.svg" alt="MFBT" aria-label="Go to top of the page"></a>

0 commit comments

Comments
 (0)