Skip to content

Commit 7bda106

Browse files
committed
Fix: Info tooltip visible for Simon Sya and Tic Tac Toe
1 parent 4c51831 commit 7bda106

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

web-app/js/main.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,13 +1292,27 @@ document.addEventListener("DOMContentLoaded", function () {
12921292
}
12931293
setupModalInfoButton(name);
12941294

1295-
// Inject info button
1295+
// Inject info button - FIXED for Tic Tac Toe and all projects
12961296
var projectContent = modalBody.querySelector(".project-content");
12971297
if (projectContent) {
1298+
// First, check if there's already an info button (to avoid duplicates)
1299+
if (projectContent.querySelector(".inline-info-btn")) {
1300+
// Info button already exists, skip injection
1301+
console.log('ℹ️ Info button already exists for', name);
1302+
} else {
1303+
// Look for any heading element
12981304
var firstHeading = projectContent.querySelector("h2, h3, .resume-analyzer-copy h2, .pet-title");
1305+
1306+
// Special case for Tic Tac Toe - look for the heading inside project-content
1307+
if (!firstHeading) {
1308+
firstHeading = projectContent.querySelector('[style*="display: flex"] h2');
1309+
}
1310+
12991311
if (!firstHeading) {
1312+
// Look for any element that might be a title
13001313
firstHeading = projectContent.querySelector('[class*="title"], [class*="header"] h2');
13011314
}
1315+
13021316
if (firstHeading && !projectContent.querySelector(".inline-info-btn")) {
13031317
var infoBtn = document.createElement("button");
13041318
infoBtn.className = "inline-info-btn";
@@ -1316,7 +1330,9 @@ document.addEventListener("DOMContentLoaded", function () {
13161330
e.stopPropagation();
13171331
if (typeof getProjectInstructions === "function") {
13181332
var info = getProjectInstructions(name);
1319-
showInfoModal(info.title, info.steps);
1333+
if (info && typeof showInfoModal === "function") {
1334+
showInfoModal(info.title, info.steps);
1335+
}
13201336
}
13211337
});
13221338

@@ -1326,7 +1342,8 @@ document.addEventListener("DOMContentLoaded", function () {
13261342
firstHeading.appendChild(infoBtn);
13271343
}
13281344
}
1329-
});
1345+
}
1346+
});
13301347

13311348
// Setup focus trap
13321349
if (removeTrap) removeTrap();

web-app/js/projects/tic-tac-toe.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,25 @@
88
// ── 1. HTML Template ──────────────────────────────────────
99
function getTicTacToeHTML() {
1010
return `
11+
<div class="project-content">
12+
<div style="display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0 1rem 0; width: 100%; border-bottom: 1px solid var(--border-color, #333); margin-bottom: 1rem;">
13+
<div style="display: flex; align-items: center; gap: 12px;">
14+
<h2 style="margin: 0; display: inline-block; font-size: 1.5rem;">❌⭕ Tic Tac Toe</h2>
15+
<button
16+
class="info-tip-btn"
17+
id="ticTacToeInfoBtn"
18+
style="background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--accent, #22c55e); padding: 0; line-height: 1; display: inline-flex; align-items: center; transition: transform 0.2s ease;"
19+
aria-label="How to play Tic Tac Toe"
20+
onmouseover="this.style.transform='scale(1.2)'"
21+
onmouseout="this.style.transform='scale(1)'"
22+
>
23+
24+
</button>
25+
</div>
26+
</div>
27+
1128
<div class="wrap">
12-
29+
1330
<!-- SETUP SCREEN -->
1431
<div id="screen-setup" class="screen screen--active">
1532
<div class="logo">
@@ -136,6 +153,7 @@ function getTicTacToeHTML() {
136153
<button class="btn-primary" id="next-btn" style="font-size:0.9rem;padding:11px">Next Round →</button>
137154
</div>
138155
</div>
156+
</div>
139157
<style>
140158
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
141159

0 commit comments

Comments
 (0)