Skip to content

Commit

Permalink
Merge branch 'YadavAkhileshh:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
srishti023 authored Nov 10, 2024
2 parents 781bc7c + b02cd88 commit 2edcbcd
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 114 deletions.
72 changes: 72 additions & 0 deletions .github/ISSUE_TEMPLATE/backend_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: "🔧 Backend Issue Report"
description: "Create a detailed report to help us improve the backend services."
title: "BACKEND ISSUE:"
labels: ["Backend", "Bug"]
body:
- type: checkboxes
attributes:
label: "Preliminary Checks"
description: "Please confirm the following before reporting a backend issue."
options:
- label: "I have checked the server logs"
required: true
- label: "I have searched the existing issues"
required: true
- type: dropdown
attributes:
label: "Environment"
description: "Where does this issue occur?"
options:
- Development
- Staging
- Production
validations:
required: true
- type: input
attributes:
label: "Backend Version/Commit"
description: "Specify the version or commit hash where this issue occurs"
validations:
required: true
- type: textarea
attributes:
label: "Issue Summary"
description: "Provide a concise summary of the issue, including what you expected to happen and what actually happened."
validations:
required: true
- type: textarea
attributes:
label: "Steps to Reproduce"
description: "List the steps to reproduce the issue. Include specific details, such as API endpoints, request parameters, etc."
validations:
required: true
- type: textarea
attributes:
label: "Expected vs Actual Behavior"
description: |
Clearly describe:
1. What you expected to happen
2. What actually happened
3. Why you believe this is incorrect behavior
validations:
required: true
- type: textarea
attributes:
label: "Logs/Errors"
description: "If applicable, attach logs or error messages that can help us diagnose the issue."
validations:
required: false
- type: checkboxes
attributes:
label: "Additional Information"
options:
- label: "I agree to follow this project's Code of Conduct"
required: true
- label: "I can provide more details if needed"
required: true
- type: input
attributes:
label: "Contact Information"
description: "How can we reach you if we need more information? (email/Slack/etc.)"
validations:
required: true
51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE/frontend_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "🌐 Frontend Issue Report"
description: "Create a detailed report to help us improve the frontend user experience."
title: "FRONTEND ISSUE:"
labels: ["Frontend", "Bug"]
body:
- type: checkboxes
attributes:
label: "Preliminary Checks"
description: "Please confirm the following before reporting a frontend issue."
options:
- label: "I have checked the browser console for errors"
required: true
- label: "I have searched the existing issues"
required: true
- label: "I have included my browser name and version"
required: true
- label: "I have included my operating system"
required: true
- label: "I have included my device type (desktop/mobile/tablet)"
required: true
- type: textarea
attributes:
label: "Issue Summary"
description: "Provide a concise summary of the issue, including what you expected to happen and what actually happened."
validations:
required: true
- type: textarea
attributes:
label: "Steps to Reproduce"
description: "List the steps to reproduce the issue, including which pages or components are affected."
validations:
required: true
- type: textarea
attributes:
label: "Expected vs Actual Behavior"
description: "What did you expect to happen instead of the current behavior?"
validations:
required: false
- type: textarea
attributes:
label: "Screenshots/Recordings"
description: "If applicable, attach screenshots or recordings that illustrate the issue."
validations:
required: false
- type: checkboxes
attributes:
label: "Additional Information"
options:
- label: "I agree to follow this project's Code of Conduct"
required: true
- label: "I can provide more details if needed"
95 changes: 95 additions & 0 deletions contributor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
const repoOwner = "YadavAkhileshh";
const repoName = "Alien-Invasion-Defense";
const contributorsUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/contributors`;
const repoUrl = `https://api.github.com/repos/${repoOwner}/${repoName}`;

async function fetchContributorData() {
try {
// Start with the first page of contributors
let contributors = [];
let url = contributorsUrl;

while (url) {
const contributorsRes = await fetch(url);
const contributorsPage = await contributorsRes.json();

// Add the current page of contributors to the total list
contributors = contributors.concat(contributorsPage);

// Check the Link header for pagination information
const linkHeader = contributorsRes.headers.get("Link");
if (linkHeader) {
const nextPageUrl = parseLinkHeader(linkHeader);
url = nextPageUrl ? nextPageUrl : null; // Get the next page URL or stop if no next page
} else {
url = null; // No Link header means we're on the last page
}
}

const repoRes = await fetch(repoUrl);
const repoData = await repoRes.json();

// Update the stats section
const statsGrid = document.getElementById("statsGrid");
statsGrid.innerHTML = `
<div class="contributor-stat-card"><h3>${contributors.length}</h3><p>Contributors</p></div>
<div class="contributor-stat-card"><h3>${contributors.reduce((sum, { contributions }) => sum + contributions, 0)}</h3><p>Total Contributions</p></div>
<div class="contributor-stat-card"><h3>${repoData.stargazers_count}</h3><p>GitHub Stars</p></div>
<div class="contributor-stat-card"><h3>${repoData.forks_count}</h3><p>Forks</p></div>
`;

// Update the contributors section
const contributorsContainer = document.getElementById("contributors");
contributorsContainer.innerHTML = contributors.map(({ login, contributions, avatar_url, html_url }) => `
<div class="contributor-card">
<img src="${avatar_url}" alt="${login}'s avatar">
<p><strong>${login}</strong></p>
<p>Contributions: ${contributions}</p>
<a href="${html_url}" target="_blank">GitHub Profile</a>
</div>
`).join('');
} catch (error) {
console.error("Error fetching data:", error);
}
}

// Function to parse the Link header and get the URL for the next page
function parseLinkHeader(linkHeader) {
const links = linkHeader.split(',').reduce((acc, part) => {
const [url, rel] = part.split(';');
const match = rel.match(/rel="(\w+)"/);
if (match) {
acc[match[1]] = url.trim().slice(1, -1); // Remove surrounding <> from URL
}
return acc;
}, {});
return links.next; // Return the URL of the next page, or undefined if there's no next
}

window.onscroll = function () {
const scrollUpBtn = document.getElementById("scrollUpBtn-cn");
if (
document.body.scrollTop > 100 ||
document.documentElement.scrollTop > 100
) {
scrollUpBtn.style.display = "block";
} else {
scrollUpBtn.style.display = "none";
}
const totalHeight =
document.documentElement.scrollHeight - window.innerHeight;
const scrollPosition = window.pageYOffset;
const scrollPercentage = (scrollPosition / totalHeight) * 100;
document.getElementById(
"progress-bar-cn"
).style.width = `${scrollPercentage}%`;
};

function scrollToTop() {
window.scrollTo({
top: 0,
behavior: "smooth",
});
}

fetchContributorData();
4 changes: 2 additions & 2 deletions contributors.css
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
margin: 0 auto;
padding: 2rem 2rem;
text-align: center;
background-color: rgba(255,255,255,0.3);
background-color: transparent;;
border-radius: 25px;
margin-top: 60px;
}
Expand All @@ -533,7 +533,7 @@
}

.contributor-stat-card {
background-color: rgba(0,0,0,0.4);
background-color: rgb(37 55 69);
border-radius: 10px;
padding: 1.5rem;
text-align: center;
Expand Down
32 changes: 1 addition & 31 deletions contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,37 +125,7 @@ <h1 class="title">Our Contributors</h1>
}
</style>

<script src="./contributors.js"></script>


<script>
// Create a trailing dot element dynamically
function createTrailDot(x, y) {
const trailDot = document.createElement('div');
trailDot.classList.add('cursor-tail');
trailDot.style.left = `${x}px`;
trailDot.style.top = `${y}px`;
document.body.appendChild(trailDot);

// Remove the trail dot after the animation completes (0.5s)
setTimeout(() => {
trailDot.remove();
}, 500); // Match the duration of the animation in CSS
}

// Function to move the cursor and generate trailing dots
function moveCursor(event) {
const x = event.pageX;
const y = event.pageY;

// Create a new trail dot at the cursor position
createTrailDot(x, y);
}

// Listen to mousemove event to trigger the cursor and trail
document.addEventListener('mousemove', moveCursor);
</script>

<script src="./contributor.js"></script>

</body>
</html>
65 changes: 0 additions & 65 deletions contributors.js

This file was deleted.

16 changes: 0 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -688,22 +688,6 @@ <h2 class="uppercase">What power-up do you find most helpful?</h2>
</div>


<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox">
<div class="slider"></div>
</label>

<span id="mode-label">Light Mode</span>
</div>
<!-- <div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox">
<div class="slider"></div>
</label>
<span id="mode-label">Light Mode</span>
</div> -->


</div>
<div id="gameContainer">
Expand Down

0 comments on commit 2edcbcd

Please sign in to comment.