Skip to content

Commit

Permalink
update ca
Browse files Browse the repository at this point in the history
  • Loading branch information
Hemu21 committed Aug 5, 2024
1 parent 00d7970 commit 63372d1
Show file tree
Hide file tree
Showing 18 changed files with 4,438 additions and 760 deletions.
21 changes: 21 additions & 0 deletions CA_Leaderboard/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions CA_Leaderboard/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 8 additions & 0 deletions CA_Leaderboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
104 changes: 11 additions & 93 deletions CA_Leaderboard/index.html
Original file line number Diff line number Diff line change
@@ -1,95 +1,13 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Leaderboard</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
text-align: center;
}
img {
max-width: 100%;
height: auto;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #ff6600;
}
.highlight {
color: orange;
font-weight: bold;
}
.description {
margin: 20px 0;
font-size: 1.2em;
}
</style>
</head>
<body>
<img src="logo.png" alt="GirlScript Summer Of Code Logo">
<h1>Campus ambassador Leaderboard</h1>
<div class="description">
Get ready to climb the ranks and win big! As a
<span class="highlight">GirlScript Summer of Code</span> campus ambassador,
your influence is invaluable. We're excited to introduce the leaderboard,
your gateway to exclusive rewards. For every successful referral who completes
certification and contributes a merged PR to the designated Postman Challenge
GitHub repo, you earn a whopping 50 points. The campus ambassador with the highest
score will be showered with amazing goodies and surprises.
</div>
<table id="leaderboardTable">
<thead>
<tr>
<th>Rank</th>
<th>Name</th>
<th>Referral Code</th>
<th>Number of Certifications</th>
<th>Score</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<footer>
<img src="footer.png" alt="GirlScript Summer Of Code Logo">
</footer>
<script>
function updateLeaderboard() {
fetch('/api/leaderboard')
.then(response => response.json())
.then(leaderboard => {
const tableBody = document.getElementById('leaderboardTable').getElementsByTagName('tbody')[0];
tableBody.innerHTML = '';

leaderboard.forEach((item, index) => {
const row = tableBody.insertRow();
row.insertCell(0).textContent = index + 1; // Rank
row.insertCell(1).textContent = item['Name'];
row.insertCell(2).textContent = item['Referral Code'];
row.insertCell(3).textContent = item['Number of Certifications'];
row.insertCell(4).textContent = item['Number of Certifications'] * 50; // Score
});
})
.catch(error => console.error('Error loading the leaderboard data:', error));
}

// Update the leaderboard every 3 seconds
setInterval(updateLeaderboard, 3000);

// Initial load
updateLeaderboard();
</script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GSSOC'24 | CA Leaderboard</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading

0 comments on commit 63372d1

Please sign in to comment.