Skip to content

Commit e2177a0

Browse files
committed
Merge branch 'upstream/main' into feat/issue-972-sqlite-support
2 parents 9c3a97b + 78ac33d commit e2177a0

175 files changed

Lines changed: 18166 additions & 7264 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

0 Bytes
Binary file not shown.

.github/workflows/playwright.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Playwright E2E Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
timeout-minutes: 15
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- name: Install dependencies
27+
run: |
28+
cd web-app
29+
npm ci
30+
31+
- name: Install Playwright Browsers
32+
run: |
33+
cd web-app
34+
npx playwright install --with-deps
35+
36+
- name: Run Playwright tests
37+
run: |
38+
cd web-app
39+
npx playwright test
40+
41+
- name: Upload Playwright Report
42+
uses: actions/upload-artifact@v4
43+
if: always()
44+
with:
45+
name: playwright-report
46+
path: web-app/playwright-report/
47+
retention-days: 30

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
3434
- name: Run automated tests
3535
run: |
36-
python -m unittest discover -s tests -v
36+
pytest tests/ -v --tb=short

.gitignore

46 Bytes
Binary file not shown.

README.md

Lines changed: 114 additions & 32 deletions
Large diffs are not rendered by default.

WEB_APP_GUIDE.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,76 @@ Then open `http://localhost:8000` in your browser.
6666
- Works on mobile, tablet, and desktop
6767
- No console errors
6868

69+
## 🎯 Modal Requirements
70+
71+
For modals to work correctly in the web app, the following IDs are required:
72+
73+
| ID | Purpose |
74+
|----|---------|
75+
| `projectModal` | Main modal container |
76+
| `modalBody` | Container for project content |
77+
| `modalClose` | Button to close modal |
78+
79+
**Example HTML structure:**
80+
81+
```html
82+
<div class="modal" id="projectModal">
83+
<div class="modal-content">
84+
<div class="modal-header">
85+
<button class="modal-close" id="modalClose">&times;</button>
86+
</div>
87+
<div id="modalBody"></div>
88+
</div>
89+
</div>
90+
```
91+
92+
## 📦 Adding a Project Card
93+
94+
To add a new project card to the homepage, add this HTML inside `projectsTemplate`:
95+
96+
```html
97+
<div class="project-card" data-category="games" data-project="your-project-name" data-tags="tag1,tag2,tag3">
98+
<img class="card-banner" src="assets/banners/your-project.webp" alt="Project Name" loading="lazy">
99+
<div class="card-actions">
100+
<button class="btn-play">Try It</button>
101+
</div>
102+
<h3>Project Name</h3>
103+
<p>Brief description of your project</p>
104+
</div>
105+
```
106+
107+
**Required attributes:**
108+
109+
- `data-category`: `games`, `math`, or `utilities`
110+
- `data-project`: Unique project identifier
111+
- `data-tags`: Search keywords (comma separated)
112+
113+
## ✅ Web PR Testing Checklist
114+
115+
Before submitting a web-related PR, test the following:
116+
117+
- Project modal opens when clicking "Try It"
118+
- Theme toggle switches between dark/light mode
119+
- Search bar filters projects correctly
120+
- No console errors (`F12` → Console)
121+
- Mobile view works (320px width)
122+
- Keyboard navigation (Tab, Enter, Escape)
123+
- Project closes properly with ✕ button and Escape key
124+
125+
## 🚫 What NOT to Do
126+
127+
Avoid these common mistakes:
128+
129+
| Mistake | Why It's Bad |
130+
|---------|--------------|
131+
| Duplicate element IDs | Breaks JavaScript functionality |
132+
| Opening `index.html` directly | Use `python -m http.server 8000` |
133+
| Forgetting to register in `projects.js` | Project won't load |
134+
| Hardcoding colors | Use CSS variables instead |
135+
| Breaking template structure | Causes project cards to disappear |
136+
69137
## Notes
70138

71139
- Use the worker for any long-running Python execution.
72140
- Stop execution by terminating the worker and creating a fresh one.
73-
- Keep changes small and consistent with the existing UI.
141+
- Keep changes small and consistent with the existing UI.

games/2048-Game/2048-Game.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def load_high_score(self):
104104
def save_high_score(self):
105105
try:
106106
HIGH_SCORE_PATH.write_text(str(self.high_score))
107-
except Exception as e:
107+
except OSError as e:
108108
print(f"Warning: Could not save high score: {e}")
109109

110110
def create_grid(self):
@@ -330,7 +330,10 @@ def restart_game(self):
330330
self.root.bind("<Key>", self.handle_keypress)
331331

332332

333-
if __name__ == "__main__":
333+
def main():
334334
root = tk.Tk()
335335
game = Game2048(root)
336-
root.mainloop()
336+
root.mainloop()
337+
338+
if __name__ == "__main__":
339+
main()

0 commit comments

Comments
 (0)