Skip to content

Commit fa66c4e

Browse files
authored
Add code prettier workflow and formatting existing files (#54)
1 parent c18be60 commit fa66c4e

12 files changed

Lines changed: 1968 additions & 1337 deletions

File tree

.github/workflows/prettier.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Auto-Format Code
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
jobs:
10+
prettier:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
# Check out the PR branch instead of the merge commit
19+
ref: ${{ github.head_ref }}
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
26+
- name: Run Prettier
27+
run: npx prettier --write "frontend/**/*.{html,css,js}"
28+
29+
- name: Auto-commit formatted code
30+
uses: stefanzweifel/git-auto-commit-action@v5
31+
with:
32+
commit_message: "style: auto-format code with Prettier [skip ci]"
33+
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"

frontend/about.html

Lines changed: 291 additions & 116 deletions
Large diffs are not rendered by default.

frontend/index.html

Lines changed: 67 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,83 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
3-
4-
<head>
5-
<meta charset="UTF-8">
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
76
<title>CodePVG — LeetCode Leaderboard</title>
8-
<link rel="preconnect" href="https://fonts.googleapis.com">
9-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
7+
<link rel="preconnect" href="https://fonts.googleapis.com" />
8+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
109
<link
11-
href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap"
12-
rel="stylesheet">
13-
<link rel="stylesheet" href="styles/main.css">
14-
<link rel="icon" type="image/png" href="assets/logo.png">
15-
</head>
10+
href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap"
11+
rel="stylesheet"
12+
/>
13+
<link rel="stylesheet" href="styles/main.css" />
14+
<link rel="icon" type="image/png" href="assets/logo.png" />
15+
</head>
1616

17-
<body>
17+
<body>
1818
<canvas id="matrix-canvas"></canvas>
1919
<main class="hero">
20-
<div class="hero-content">
21-
<h1 class="hero-title decryption-title" data-target="CodePVG Leaderboard">
22-
<span>CodePVG Leaderboard</span><span class="cursor blink">_</span>
23-
</h1>
20+
<div class="hero-content">
21+
<h1
22+
class="hero-title decryption-title"
23+
data-target="CodePVG Leaderboard"
24+
>
25+
<span>CodePVG Leaderboard</span><span class="cursor blink">_</span>
26+
</h1>
27+
28+
<p class="hero-subtitle" style="margin-bottom: 2.5rem">
29+
> solve problems. climb ranks. repeat daily.<br />
30+
> your leetcode grind, tracked & ranked.
31+
</p>
2432

25-
<p class="hero-subtitle" style="margin-bottom: 2.5rem;">
26-
> solve problems. climb ranks. repeat daily.<br>
27-
> your leetcode grind, tracked & ranked.
28-
</p>
33+
<div class="mock-shell">
34+
<div class="shell-line hidden" id="cmd-1">
35+
<span class="prompt">guest@codepvg:~$</span>
36+
<span
37+
class="typing-text"
38+
data-cmd="cat /home/codepvg/README.md"
39+
></span>
40+
</div>
2941

30-
<div class="mock-shell">
31-
<div class="shell-line hidden" id="cmd-1">
32-
<span class="prompt">guest@codepvg:~$</span> <span class="typing-text" data-cmd="cat /home/codepvg/README.md"></span>
33-
</div>
34-
35-
<div class="shell-output hidden" id="out-1">
36-
<div class="hero-description" style="margin: 0; max-width: 100%;">
37-
<p>
38-
An open leaderboard for all PVG students grinding LeetCode. We auto-track your daily,
39-
weekly, and overall progress — awarding points based on difficulty.
40-
Join the community, climb the ranks, and watch yourself level up.
41-
</p>
42-
</div>
43-
</div>
44-
45-
<div class="shell-line hidden" id="cmd-2">
46-
<span class="prompt">guest@codepvg:~$</span> <span class="typing-text" data-cmd="./show_options.sh"></span>
47-
</div>
48-
49-
<div class="shell-output hidden" id="out-2">
50-
<div class="hero-buttons" style="margin-top: 1rem;">
51-
<a href="/leaderboard" class="btn btn-primary">
52-
view_leaderboard
53-
</a>
54-
<a href="/registration" class="btn btn-secondary">
55-
register_now
56-
</a>
57-
</div>
58-
</div>
42+
<div class="shell-output hidden" id="out-1">
43+
<div class="hero-description" style="margin: 0; max-width: 100%">
44+
<p>
45+
An open leaderboard for all PVG students grinding LeetCode. We
46+
auto-track your daily, weekly, and overall progress — awarding
47+
points based on difficulty. Join the community, climb the ranks,
48+
and watch yourself level up.
49+
</p>
5950
</div>
51+
</div>
52+
53+
<div class="shell-line hidden" id="cmd-2">
54+
<span class="prompt">guest@codepvg:~$</span>
55+
<span class="typing-text" data-cmd="./show_options.sh"></span>
56+
</div>
6057

61-
<!-- Live Activity Feed -->
62-
<div class="live-feed hidden">
63-
<div class="live-feed-header">tail -f /var/log/leetcode_sync.log</div>
64-
<div class="live-feed-content" id="live-feed-content">
65-
<!-- Populated dynamically by JS -->
66-
</div>
58+
<div class="shell-output hidden" id="out-2">
59+
<div class="hero-buttons" style="margin-top: 1rem">
60+
<a href="/leaderboard" class="btn btn-primary">
61+
view_leaderboard
62+
</a>
63+
<a href="/registration" class="btn btn-secondary">
64+
register_now
65+
</a>
6766
</div>
67+
</div>
6868
</div>
69+
70+
<!-- Live Activity Feed -->
71+
<div class="live-feed hidden">
72+
<div class="live-feed-header">tail -f /var/log/leetcode_sync.log</div>
73+
<div class="live-feed-content" id="live-feed-content">
74+
<!-- Populated dynamically by JS -->
75+
</div>
76+
</div>
77+
</div>
6978
</main>
7079
<script src="js/boot.js"></script>
7180
<script src="js/hero_fx.js"></script>
7281
<script src="js/matrix.js"></script>
73-
</body>
74-
75-
</html>
82+
</body>
83+
</html>

frontend/js/boot.js

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,80 @@
11
document.addEventListener("DOMContentLoaded", () => {
2-
// Hide hero content initially
3-
const heroContent = document.querySelector('.hero-content');
4-
if (heroContent) {
5-
heroContent.style.opacity = '0';
6-
heroContent.style.visibility = 'hidden';
7-
}
2+
// Hide hero content initially
3+
const heroContent = document.querySelector(".hero-content");
4+
if (heroContent) {
5+
heroContent.style.opacity = "0";
6+
heroContent.style.visibility = "hidden";
7+
}
88

9-
// Create the boot overlay container
10-
const bootOverlay = document.createElement('div');
11-
bootOverlay.className = 'boot-overlay';
9+
// Create the boot overlay container
10+
const bootOverlay = document.createElement("div");
11+
bootOverlay.className = "boot-overlay";
1212

13-
// Create an inner wrapper to center the text block
14-
const bootInner = document.createElement('div');
15-
bootInner.className = 'boot-inner';
16-
bootOverlay.appendChild(bootInner);
13+
// Create an inner wrapper to center the text block
14+
const bootInner = document.createElement("div");
15+
bootInner.className = "boot-inner";
16+
bootOverlay.appendChild(bootInner);
1717

18-
document.body.appendChild(bootOverlay);
18+
document.body.appendChild(bootOverlay);
1919

20-
const bootLines = [
21-
"CodePVG_OS v2.4.1 (tty1)",
22-
"",
23-
"[ 0.041] initializing kernel...",
24-
"[ 0.089] loading core modules.............. [OK]",
25-
"[ 0.124] mounting file systems............. [OK]",
26-
"[ 0.201] establishing secure connection.... [OK]",
27-
"[ 0.345] fetching leetcode user data....... [OK]",
28-
"[ 0.412] resolving rank algorithms......... [OK]",
29-
"[ 0.589] loading matrix_rain.sh............ [OK]",
30-
"[ 0.640] starting UI service............... [OK]",
31-
"",
32-
"system ready.",
33-
"$ exec dashboard"
34-
];
20+
const bootLines = [
21+
"CodePVG_OS v2.4.1 (tty1)",
22+
"",
23+
"[ 0.041] initializing kernel...",
24+
"[ 0.089] loading core modules.............. [OK]",
25+
"[ 0.124] mounting file systems............. [OK]",
26+
"[ 0.201] establishing secure connection.... [OK]",
27+
"[ 0.345] fetching leetcode user data....... [OK]",
28+
"[ 0.412] resolving rank algorithms......... [OK]",
29+
"[ 0.589] loading matrix_rain.sh............ [OK]",
30+
"[ 0.640] starting UI service............... [OK]",
31+
"",
32+
"system ready.",
33+
"$ exec dashboard",
34+
];
3535

36-
let currentLine = 0;
36+
let currentLine = 0;
3737

38-
// Function to rapidly print lines
39-
function printNextLine() {
40-
if (currentLine < bootLines.length) {
41-
const line = document.createElement('div');
42-
line.className = 'boot-line';
38+
// Function to rapidly print lines
39+
function printNextLine() {
40+
if (currentLine < bootLines.length) {
41+
const line = document.createElement("div");
42+
line.className = "boot-line";
4343

44-
// Highlight [OK] in green
45-
let text = bootLines[currentLine];
46-
if (text.includes('[OK]')) {
47-
text = text.replace('[OK]', '<span class="boot-ok">[OK]</span>');
48-
}
44+
// Highlight [OK] in green
45+
let text = bootLines[currentLine];
46+
if (text.includes("[OK]")) {
47+
text = text.replace("[OK]", '<span class="boot-ok">[OK]</span>');
48+
}
4949

50-
line.innerHTML = text;
51-
bootInner.appendChild(line);
50+
line.innerHTML = text;
51+
bootInner.appendChild(line);
5252

53-
// Auto scroll to bottom
54-
bootOverlay.scrollTop = bootOverlay.scrollHeight;
53+
// Auto scroll to bottom
54+
bootOverlay.scrollTop = bootOverlay.scrollHeight;
5555

56-
currentLine++;
56+
currentLine++;
5757

58-
// Random slower delay between 80ms and 250ms
59-
const delay = Math.random() * 170 + 80;
60-
setTimeout(printNextLine, delay);
61-
} else {
62-
// Finish sequence
63-
setTimeout(() => {
64-
bootOverlay.classList.add('fade-out');
58+
// Random slower delay between 80ms and 250ms
59+
const delay = Math.random() * 170 + 80;
60+
setTimeout(printNextLine, delay);
61+
} else {
62+
// Finish sequence
63+
setTimeout(() => {
64+
bootOverlay.classList.add("fade-out");
6565

66-
setTimeout(() => {
67-
bootOverlay.remove();
68-
if (heroContent) {
69-
heroContent.style.visibility = 'visible';
70-
heroContent.style.animation = 'fadeIn 0.8s ease-out forwards';
71-
document.dispatchEvent(new Event('bootSequenceComplete'));
72-
}
73-
}, 400); // Wait for fade out
74-
}, 400); // Short pause before fading out
75-
}
66+
setTimeout(() => {
67+
bootOverlay.remove();
68+
if (heroContent) {
69+
heroContent.style.visibility = "visible";
70+
heroContent.style.animation = "fadeIn 0.8s ease-out forwards";
71+
document.dispatchEvent(new Event("bootSequenceComplete"));
72+
}
73+
}, 400); // Wait for fade out
74+
}, 400); // Short pause before fading out
7675
}
76+
}
7777

78-
// Start boot sequence
79-
setTimeout(printNextLine, 200); // Initial small delay
78+
// Start boot sequence
79+
setTimeout(printNextLine, 200); // Initial small delay
8080
});

frontend/js/footer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
document.addEventListener("DOMContentLoaded", () => {
2-
3-
if (window.location.pathname.includes("index.html") || window.location.pathname === "/") {
2+
if (
3+
window.location.pathname.includes("index.html") ||
4+
window.location.pathname === "/"
5+
) {
46
return;
57
}
68

0 commit comments

Comments
 (0)