From d935a79186c00ccc685c2baa6d771efd34236d7f Mon Sep 17 00:00:00 2001 From: Anurag Pandey Date: Mon, 3 Jun 2024 11:53:28 +0530 Subject: [PATCH] added backend to contributors page --- Official_Website/contributor-index.html | 251 +----------------------- Official_Website/contributor-style.css | 5 +- Official_Website/contributor.js | 171 ++++++++++++++++ 3 files changed, 182 insertions(+), 245 deletions(-) create mode 100644 Official_Website/contributor.js diff --git a/Official_Website/contributor-index.html b/Official_Website/contributor-index.html index 6e19c25d..2b92ebe2 100644 --- a/Official_Website/contributor-index.html +++ b/Official_Website/contributor-index.html @@ -15,13 +15,15 @@

HelpOps-Hub

Ensuring You Never Get Stuck In DevOps Again!

-
+
-
-
-
- Anurag Pandey -
-
- Maintainer -

Anurag Pandey

-

Software Developer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

Technical Writer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
- -
-
-
-
- User Full Name -
-
- Maintainer -

User Full Name

-

UI/UX Designer

-
-
-
+ diff --git a/Official_Website/contributor-style.css b/Official_Website/contributor-style.css index 372aa657..5c413eb5 100644 --- a/Official_Website/contributor-style.css +++ b/Official_Website/contributor-style.css @@ -261,7 +261,7 @@ width: 40px; color: black; } */ -.team-grid { +#team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; @@ -366,3 +366,6 @@ width: 40px; .social-links a:hover { color: #ffffff; } + #group{ + color: rgb(29, 129, 29); + } diff --git a/Official_Website/contributor.js b/Official_Website/contributor.js new file mode 100644 index 00000000..93b22e11 --- /dev/null +++ b/Official_Website/contributor.js @@ -0,0 +1,171 @@ +// const hamBurger = document.querySelector(".hamburger"); +// const nMenu = document.querySelector(".nav-menu"); + +// document.addEventListener("DOMContentLoaded", function () { +// setTimeout(function () { +// document.querySelector("body").classList.add("loaded"); +// }, 500); +// }); +// const loading = document.getElementById("loading1"); +// loading.innerHTML = `

Loading

`; +// Hamburger menu +// hamBurger.addEventListener("click", mobileMenu); +// function mobileMenu() { +// hamBurger.classList.toggle("active"); +// nMenu.classList.toggle("active"); +// } + +const cont = document.getElementById("team-grid"); +const owner = "mdazfar2"; +const repoName = "HelpOps-Hub"; + +async function fetchContributors(pageNumber) { + const apiUrl = + "https://script.google.com/macros/s/AKfycbzipat1oQlBel7YwZaPl7mCpshjRpvyouFSRgunjqGlKC-0gv46hypYD0EnSMsOEBeC-Q/exec"; + + async function getkey() { + try { + const response = await fetch(apiUrl); + if (!response.ok) { + throw new Error("Network response was not ok"); + } + const data = await response.json(); + console.log(data); // Log the response data + return data.apik[0].apikey; + } catch (error) { + console.error("Error fetching data:", error); + } + } + const token = await getkey(); + const perPage = 100; + const url = `https://api.github.com/repos/${owner}/${repoName}/contributors?page=${pageNumber}&per_page=${perPage}`; + + const response = await fetch(url, { + headers: { + Authorization: `Bearer ${token}`, + }, + }); + if (!response.ok) { + throw new Error( + `Failed to fetch contributors data. Status code: ${response.status}` + ); + } + + const contributorsData = await response.json(); + // loading.innerHTML = ``; + return contributorsData; +} + +// Function to fetch all contributors +async function fetchAllContributors() { + let allContributors = []; + let pageNumber = 1; + + try { + while (true) { + const contributorsData = await fetchContributors(pageNumber); + if (contributorsData.length === 0) { + break; + } + allContributors = allContributors.concat(contributorsData); + pageNumber++; + } + allContributors.forEach((contributor) => { + if (contributor.login === owner) { + return; + } + //
+ //
+ //
+ // Azfar Alam + //
+ //
+ // Founder + //

Azfar Alam

+ //

DevOps Engineer

+ //
+ //
+ // + //
; + + const contributorCard = document.createElement("div"); + contributorCard.classList.add("team-member"); + const avatarImg = document.createElement("img"); + avatarImg.src = contributor.avatar_url; + avatarImg.alt = `${contributor.login}'s Picture`; + const name = contributor.name || contributor.login; + + const loginLink = document.createElement("a"); + const loginLink1 = document.createElement("a"); + loginLink1.href = `https://github.com/sponsors/${name}`; + loginLink.href = contributor.html_url; + loginLink.target = "_blank"; + contributorCard.innerHTML = `
+
+ ${avatarImg.alt} +
+
+ Maintainer +

${name}

+
+
+ `; + // loginLink.appendChild(avatarImg); + + // contributorCard.appendChild(loginLink); + + cont.appendChild(contributorCard); + }); + } catch (error) { + console.error(error); + } +} + +fetchAllContributors(); + +// let calcScrollValue = () => { +// let scrollProg = document.getElementById("progress"); +// let pos = document.documentElement.scrollTop; +// let calcHeight = +// document.documentElement.scrollHeight - +// document.documentElement.clientHeight; +// let scrollValue = Math.round((pos * 100) / calcHeight); +// if (pos > 100) { +// scrollProg.style.display = "grid"; +// } else { +// scrollProg.style.display = "none"; +// } +// scrollProg.addEventListener("click", () => { +// document.documentElement.scrollTop = 0; +// }); +// scrollProg.style.background = `conic-gradient(#0063ba ${scrollValue}%, #d499de ${scrollValue}%)`; +// }; + +// window.addEventListener("scroll", function () { +// var scrollToTopButton = document.getElementById("progress"); +// if (window.pageYOffset > 200) { +// scrollToTopButton.style.display = "block"; +// } else { +// scrollToTopButton.style.display = "none"; +// } +// }); + +// window.onscroll = calcScrollValue; +// window.onload = calcScrollValue;