Skip to content

Commit 8816b73

Browse files
Merge branch 'main' into privacyterms
2 parents 0888374 + 5ca4a8a commit 8816b73

17 files changed

Lines changed: 907 additions & 282 deletions

.github/workflows/sync-leaderboard.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
5656
# 2. Run sync
5757
export DATA_DIR=db-repo
58+
export DATA_REPO_TOKEN=${{ secrets.DATA_REPO_TOKEN }}
5859
node scripts/sync-leaderboard.js
5960
6061
# 3. Stage changes (everything except users.json)

CODE_OF_CONDUCT.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
2424
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
25+
- Focusing on what is best not just for us as individuals, but for the
2626
overall community
2727

2828
Examples of unacceptable behavior include:
2929

30-
* The use of sexualized language or imagery, and sexual attention or
30+
- The use of sexualized language or imagery, and sexual attention or
3131
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
3535
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
36+
- Other conduct which could reasonably be considered inappropriate in a
3737
professional setting
3838

3939
## Enforcement Responsibilities
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
### 4. Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within
@@ -126,4 +126,3 @@ enforcement ladder](https://github.com/mozilla/diversity).
126126
For answers to common questions about this code of conduct, see the FAQ at
127127
https://www.contributor-covenant.org/faq. Translations are available at
128128
https://www.contributor-covenant.org/translations.
129-

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ It allows users to register with their LeetCode username and automatically fetch
1010

1111
The goal of this project is to:
1212

13-
- Encourage consistent problem-solving among students
14-
- Create a competitive yet motivating environment
15-
- Provide visibility into individual coding progress
13+
- Encourage consistent problem-solving among students
14+
- Create a competitive yet motivating environment
15+
- Provide visibility into individual coding progress
1616

1717
---
1818

19-
20-
2119
## Screenshots
20+
2221
A quick preview of the platform UI. The appearance may evolve as the project develops.
22+
2323
### Home Page
2424

2525
![Home Page](assets/home-page.png)
@@ -28,13 +28,10 @@ A quick preview of the platform UI. The appearance may evolve as the project dev
2828

2929
![Registration](assets/registration-page.png)
3030

31-
3231
### Leaderboard
3332

3433
![Leaderboard](assets/leaderboard.png)
3534

36-
37-
3835
## Related Repositories
3936

4037
- [leetcode-ranking-data](https://github.com/codepvg/leetcode-ranking-data) – The database repository where raw JSON data and historical stats are stored
@@ -65,6 +62,7 @@ leetcode-ranking/
6562
### 1. Fork and clone the repository
6663

6764
First, fork the repository to your GitHub account. Then clone it locally:
65+
6866
```bash
6967
git clone https://github.com/YOUR-USERNAME/leetcode-ranking.git
7068
cd leetcode-ranking
@@ -82,9 +80,9 @@ or
8280

8381
## Usage
8482

85-
1. Open the registration page
86-
2. Enter your name and LeetCode username
87-
3. Submit the form
83+
1. Open the registration page
84+
2. Enter your name and LeetCode username
85+
3. Submit the form
8886
4. View your ranking on the leaderboard after the next sync
8987

9088
---
@@ -93,7 +91,7 @@ or
9391

9492
Contributions are welcome.
9593

96-
- Fork the repository
97-
- Create a new branch
98-
- Make your changes
99-
- Submit a Pull Request
94+
- Fork the repository
95+
- Create a new branch
96+
- Make your changes
97+
- Submit a Pull Request

frontend/about.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,25 @@
1313
<link rel="stylesheet" href="styles/main.css" />
1414
<link rel="icon" type="image/png" href="assets/logo.png" />
1515
<script src="js/navbar.js"></script>
16+
17+
<meta
18+
name="description"
19+
content="Learn how CodePVG tracks LeetCode progress for PVG students — scoring system, sync schedule, and how to join."
20+
/>
21+
<meta property="og:title" content="About — CodePVG" />
22+
<meta
23+
property="og:description"
24+
content="Learn how CodePVG tracks LeetCode progress for PVG students — scoring system, sync schedule, and how to join."
25+
/>
26+
<meta property="og:url" content="https://codepvg.onrender.com/about" />
27+
<meta property="og:type" content="website" />
28+
<meta
29+
property="og:image"
30+
content="https://codepvg.onrender.com/assets/logo.png"
31+
/>
32+
<meta property="og:site_name" content="CodePVG" />
1633
</head>
34+
1735
<body>
1836
<canvas id="matrix-canvas"></canvas>
1937

@@ -304,7 +322,6 @@ <h3 class="feature-title">WhatsApp</h3>
304322
</main>
305323
<script src="js/footer.js"></script>
306324
<script src="js/matrix.js"></script>
307-
308325
<script src="js/terminal_ui.js"></script>
309326
</body>
310327
</html>

frontend/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@
1212
/>
1313
<link rel="stylesheet" href="styles/main.css" />
1414
<link rel="icon" type="image/png" href="assets/logo.png" />
15+
<meta
16+
name="description"
17+
content="An open leaderboard for PVG students grinding LeetCode. Track your daily, weekly, monthly and overall progress — ranked by difficulty-weighted score."
18+
/>
19+
<meta property="og:title" content="CodePVG — LeetCode Leaderboard" />
20+
<meta
21+
property="og:description"
22+
content="Track your LeetCode progress and compete with PVG peers. Ranked by problem difficulty. Updated every 5 minutes."
23+
/>
24+
<meta property="og:url" content="https://codepvg.onrender.com/" />
25+
<meta property="og:type" content="website" />
26+
<meta
27+
property="og:image"
28+
content="https://codepvg.onrender.com/assets/logo.png"
29+
/>
30+
<meta property="og:site_name" content="CodePVG" />
1531
</head>
1632

1733
<body>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
function setupPaginationListeners() {
2+
document.getElementById("prev-page-btn")?.addEventListener("click", () => {
3+
if (currentPage > 1) {
4+
currentPage--;
5+
applyFiltersAndRender();
6+
window.scrollTo({ top: 0, behavior: "smooth" });
7+
}
8+
});
9+
10+
document.getElementById("next-page-btn")?.addEventListener("click", () => {
11+
const totalPages = Math.ceil(
12+
leaderboardData[activeDatasetType].length / itemsPerPage,
13+
);
14+
15+
if (currentPage < totalPages) {
16+
currentPage++;
17+
applyFiltersAndRender();
18+
window.scrollTo({ top: 0, behavior: "smooth" });
19+
}
20+
});
21+
}
22+
23+
function renderPagination(totalItems) {
24+
const pageNumbers = document.getElementById("page-numbers");
25+
26+
if (!pageNumbers) return;
27+
28+
const totalPages = Math.ceil(totalItems / itemsPerPage);
29+
pageNumbers.innerHTML = "";
30+
31+
if (totalPages === 0) return;
32+
33+
function createPageBtn(i) {
34+
const btn = document.createElement("button");
35+
btn.classList.add("page-btn");
36+
btn.textContent = i;
37+
38+
if (i === currentPage) {
39+
btn.classList.add("active-page");
40+
}
41+
42+
btn.onclick = () => {
43+
currentPage = i;
44+
applyFiltersAndRender();
45+
window.scrollTo({ top: 0, behavior: "smooth" });
46+
};
47+
48+
return btn;
49+
}
50+
51+
const pagesToRender = [];
52+
const range = 1; // Number of pages to show around the current page
53+
54+
pagesToRender.push(1);
55+
56+
if (currentPage - range > 2) {
57+
pagesToRender.push("..");
58+
}
59+
60+
for (
61+
let i = Math.max(2, currentPage - range);
62+
i <= Math.min(totalPages - 1, currentPage + range);
63+
i++
64+
) {
65+
pagesToRender.push(i);
66+
}
67+
68+
if (currentPage + range < totalPages - 1) {
69+
pagesToRender.push("..");
70+
}
71+
72+
if (totalPages > 1) {
73+
pagesToRender.push(totalPages);
74+
}
75+
76+
pagesToRender.forEach((item) => {
77+
if (item === "..") {
78+
const ellipsis = document.createElement("span");
79+
ellipsis.className = "page-ellipsis";
80+
ellipsis.textContent = "..";
81+
pageNumbers.appendChild(ellipsis);
82+
} else {
83+
pageNumbers.appendChild(createPageBtn(item));
84+
}
85+
});
86+
}

0 commit comments

Comments
 (0)