Skip to content

Commit 30ab791

Browse files
Merge pull request steam-bell-92#544 from siri-004/fix/js-console-errors
fix: resolve console errors and UI layout issues
2 parents 2a2c9bf + 1b07087 commit 30ab791

5 files changed

Lines changed: 38 additions & 42 deletions

File tree

web-app/css/styles.css

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ body {
109109
color: var(--text-color);
110110
line-height: 1.6;
111111
transition: background-color var(--motion-duration) ease, color var(--motion-duration) ease;
112-
padding-bottom: 6rem; /* reserve space for fixed footer */
112+
padding-bottom: 6rem;
113+
/* reserve space for fixed footer */
113114
}
114115

115116
#main-content {
@@ -1688,11 +1689,11 @@ body {
16881689
width: 100%;
16891690
box-sizing: border-box;
16901691

1691-
background: rgba(255,255,255,0.03);
1692+
background: rgba(255, 255, 255, 0.03);
16921693
padding: 1.2rem;
16931694
border-radius: 16px;
16941695

1695-
border: 1px solid rgba(255,255,255,0.08);
1696+
border: 1px solid rgba(255, 255, 255, 0.08);
16961697

16971698
transition: all 0.25s ease;
16981699
overflow: hidden;
@@ -1709,7 +1710,7 @@ body {
17091710
.project-card:hover {
17101711
transform: translateY(-4px);
17111712
border-color: rgba(34, 197, 94, 0.3);
1712-
box-shadow: 0 10px 30px rgba(0,0,0,0.08);
1713+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
17131714
}
17141715

17151716
.project-card:hover::after {
@@ -1731,11 +1732,9 @@ body {
17311732
justify-content: center;
17321733
border-radius: 20px;
17331734

1734-
background: linear-gradient(
1735-
135deg,
1736-
rgba(34, 197, 94, 0.12),
1737-
rgba(74, 222, 128, 0.10)
1738-
);
1735+
background: linear-gradient(135deg,
1736+
rgba(34, 197, 94, 0.12),
1737+
rgba(74, 222, 128, 0.10));
17391738

17401739
margin-bottom: 1rem;
17411740

web-app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@
803803
<div class="navbar-brand">
804804
<a class="logo-wrap" href="#">
805805
<!-- LOGO IMAGE -->
806-
<img alt="PyMini Logo" class="navbar-logo" src="/python-mini-project/images/logo.png"/>
806+
<img alt="PyMini Logo" class="navbar-logo" src="/assets/logo.png"/>
807807
<!-- TEXT -->
808808
<div class="logo-text">
809809
<span class="logo-py">py</span>

web-app/js/projects/2048-game.js

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,20 @@ function get2048GameHTML() {
9898
}
9999
100100
.tile {
101-
width: 100%;
102-
aspect-ratio: 1 / 1;
103-
height: auto;
104-
background: var(--control-color);
105-
106-
display: flex;
107-
justify-content: center;
108-
align-items: center;
101+
width: 100%;
102+
aspect-ratio: 1 / 1;
103+
height: auto;
104+
background: var(--control-color);
109105
110-
font-size: clamp(16px, 5vw, 28px);
111-
font-weight: bold;
106+
display: flex;
107+
justify-content: center;
108+
align-items: center;
112109
113-
border-radius: 12px;
110+
font-size: clamp(16px, 5vw, 28px);
111+
font-weight: bold;
114112
113+
border-radius: 12px;
114+
}
115115
/* Right Side Controls Layout */
116116
.controls {
117117
display: flex;
@@ -437,24 +437,22 @@ function init2048Game() {
437437
}
438438
}
439439

440-
let touchStartX = 0;
441-
let touchStartY = 0;
442440

443441
gridContainer.addEventListener('touchstart', e => {
444442
e.preventDefault();
445443
touchStartX = e.changedTouches[0].screenX;
446444
touchStartY = e.changedTouches[0].screenY;
447445
}, { passive: false });
448446

449-
gridContainer.addEventListener('touchend', e => {
447+
gridContainer.addEventListener('touchend', e => {
450448
e.preventDefault();
451449
let touchEndX = e.changedTouches[0].screenX;
452450
let touchEndY = e.changedTouches[0].screenY;
453-
451+
454452
let dx = touchEndX - touchStartX;
455453
let dy = touchEndY - touchStartY;
456454
let moved = false;
457-
455+
458456
if (Math.abs(dx) > Math.abs(dy)) {
459457
if (dx > 30) moved = moveRight();
460458
else if (dx < -30) moved = moveLeft();
@@ -469,16 +467,6 @@ function init2048Game() {
469467
}
470468
}, { passive: false });
471469

472-
document
473-
.getElementById("restart-btn")
474-
.addEventListener("click", () => {
475-
476-
window.addEventListener("mouseup", (e) => {
477-
if (!isDragging) return;
478-
isDragging = false;
479-
handleSwipeEnd(e.clientX, e.clientY);
480-
});
481-
482470
createBoard();
483471
}
484472

web-app/js/projects/flappy-game.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,18 @@ function initFlappyGame() {
314314
}
315315

316316
function tap(e) {
317-
if (e && e.preventDefault) e.preventDefault();
318-
if (gameOver) {
319-
resetGame();
320-
} else {
321-
resetGame();
317+
if (e && e.preventDefault) {
318+
e.preventDefault();
319+
}
320+
321+
jump();
322+
}
323+
function jump() {
324+
if (!gameRunning) {
325+
startGame();
322326
}
327+
328+
bird.velocity = bird.jumpStrength;
323329
}
324330

325331
function handleKeyDown(event) {
@@ -334,12 +340,16 @@ function initFlappyGame() {
334340
canvas.addEventListener('mousedown', tap);
335341
canvas.addEventListener('touchstart', tap, { passive: false });
336342

343+
344+
function stopGame() {
337345
if (animationId) {
338346
cancelAnimationFrame(animationId);
339347
animationId = null;
340348
}
349+
gameRunning = false;
341350
}
342351

352+
console.log(startBtn);
343353
startBtn.addEventListener("click", function () {
344354
startScreen.style.display = "none";
345355
gameScreen.style.display = "flex";

web-app/js/projects/word-scramble.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// WORD SCRAMBLE GAME
33
// ============================================
44

5-
console.log('📝 Word Scramble loaded - Version with Timer');
65

76
function getWordScrambleHTML() {
87
console.log('🎨 Generating Word Scramble HTML');

0 commit comments

Comments
 (0)