Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
## 2024-05-23 - CLI UX Enhancement
**Learning:** Even in CLI apps, visual distinction (colors, emojis) significantly reduces cognitive load when scanning logs.
**Action:** Use ANSI colors and consistent emojis for key events (success/failure) in future CLI tools.

## 2025-02-28 - Structured CLI Reports
**Learning:** Dense numerical data in CLI output is hard to parse. Using ASCII box-drawing characters and alignment to create a "dashboard" or "invoice" style summary significantly improves readability and perceived quality.
**Action:** When summarizing simulation or batch job results, always format the final report as a structured table or box rather than a list of print statements.
## 2024-05-20 - Dynamic Progress Bar for Quiet CLI Tasks
**Learning:** For long-running CLI processes that suppress verbose logging (e.g., `--quiet`), users lose system status visibility.
**Action:** Implemented a dynamic progress bar using `\r` and `flush=True`, conditional on `sys.stdout.isatty()`, to provide status feedback without polluting non-interactive logs.

## 2025-03-23 - Game Key Scrolling
**Learning:** Browsers natively scroll the page when users press Space or Arrow keys. When building a web-based game, this creates a frustrating UX where the game viewport jumps around while playing.
**Action:** Always call `e.preventDefault()` on keydown events for typical game controls ("Space", "ArrowUp", etc.) when the focus is on a game container or the body.
## 2024-07-09 - Added Keyboard Instructions and ARIA Live Score to Mario Game
**Learning:** When building interactive HTML5 widgets or games with custom keyboard event bindings, always provide explicit, visible instructional text so users know the required inputs. Additionally, when dynamic numeric values (like a score) update frequently, separating the dynamic value into its own `span` with `aria-live="polite"` prevents screen readers from redundantly announcing static prefix text like "Score: ".
**Action:** Apply this pattern to any future interactive widgets by ensuring controls are visible on-screen and dynamic values are semantically isolated for screen readers.
17 changes: 14 additions & 3 deletions src/views/mario-game.njk
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,32 @@
font-size: 20px;
font-family: Arial;
}

#instructions {
position: absolute;
top: 40px;
left: 10px;
color: white;
font-size: 16px;
font-family: Arial;
opacity: 0.8;
}
</style>
</head>

<body>

<div id="game">
<div id="score">Score: 0</div>
<div id="score">Score: <span id="score-val" aria-live="polite" aria-atomic="true">0</span></div>
<div id="instructions">Press <strong>Space</strong> or <strong>Up Arrow</strong> to jump</div>
<div id="mario"></div>
<div class="ground"></div>
</div>

<script>
const mario = document.getElementById("mario");
const game = document.getElementById("game");
const scoreText = document.getElementById("score");
const scoreText = document.getElementById("score-val");

let jumping = false;
let score = 0;
Expand Down Expand Up @@ -118,7 +129,7 @@
clearInterval(move);
goomba.remove();
score++;
scoreText.innerText = "Score: " + score;
scoreText.innerText = score;
} else {
position -= 6;
goomba.style.left = position + "px";
Expand Down
Loading