Spaces:
Sleeping
Sleeping
fix: improve UI elements and reduce input field width
Browse files- Replace lightbulb emoji with shy fingers (ππ) for hints section
- Replace book emoji with parchment emoji (π) for contextualization
- Remove "classic" from literature references, use "literature" alone
- Reduce input field width calculation for better text flow
- Reduce loading transition from 1 second to 0.5 seconds
- index.html +1 -1
- src/aiService.js +1 -1
- src/app.js +4 -4
- src/clozeGameEngine.js +2 -2
index.html
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
<div id="contextualization" class="context-box mb-4 p-3 rounded-lg"></div>
|
33 |
<div id="passage-content" class="prose max-w-none mb-6"></div>
|
34 |
<div id="hints-section" class="hints-box mb-4 p-3 rounded-lg">
|
35 |
-
<div class="text-sm font-semibold mb-2"
|
36 |
<div id="hints-list" class="text-sm space-y-1"></div>
|
37 |
</div>
|
38 |
<div id="controls" class="flex gap-4 justify-center flex-wrap">
|
|
|
32 |
<div id="contextualization" class="context-box mb-4 p-3 rounded-lg"></div>
|
33 |
<div id="passage-content" class="prose max-w-none mb-6"></div>
|
34 |
<div id="hints-section" class="hints-box mb-4 p-3 rounded-lg">
|
35 |
+
<div class="text-sm font-semibold mb-2">ππ Hints:</div>
|
36 |
<div id="hints-list" class="text-sm space-y-1"></div>
|
37 |
</div>
|
38 |
<div id="controls" class="flex gap-4 justify-center flex-wrap">
|
src/aiService.js
CHANGED
@@ -355,7 +355,7 @@ Return as JSON: {"passage1": {...}, "passage2": {...}}`
|
|
355 |
|
356 |
if (!this.apiKey) {
|
357 |
console.log('No API key, returning fallback contextualization');
|
358 |
-
return
|
359 |
}
|
360 |
|
361 |
try {
|
|
|
355 |
|
356 |
if (!this.apiKey) {
|
357 |
console.log('No API key, returning fallback contextualization');
|
358 |
+
return `π Practice with literature from ${author}'s "${title}"`;
|
359 |
}
|
360 |
|
361 |
try {
|
src/app.js
CHANGED
@@ -77,7 +77,7 @@ class App {
|
|
77 |
// Show contextualization from AI agent
|
78 |
this.elements.contextualization.innerHTML = `
|
79 |
<div class="flex items-start gap-2">
|
80 |
-
<span class="text-blue-600"
|
81 |
<span>${roundData.contextualization || 'Loading context...'}</span>
|
82 |
</div>
|
83 |
`;
|
@@ -222,10 +222,10 @@ class App {
|
|
222 |
roundData = await this.game.nextRound();
|
223 |
}
|
224 |
|
225 |
-
// Ensure loading is shown for at least
|
226 |
const elapsedTime = Date.now() - startTime;
|
227 |
-
if (elapsedTime <
|
228 |
-
await new Promise(resolve => setTimeout(resolve,
|
229 |
}
|
230 |
|
231 |
this.displayRound(roundData);
|
|
|
77 |
// Show contextualization from AI agent
|
78 |
this.elements.contextualization.innerHTML = `
|
79 |
<div class="flex items-start gap-2">
|
80 |
+
<span class="text-blue-600">π</span>
|
81 |
<span>${roundData.contextualization || 'Loading context...'}</span>
|
82 |
</div>
|
83 |
`;
|
|
|
222 |
roundData = await this.game.nextRound();
|
223 |
}
|
224 |
|
225 |
+
// Ensure loading is shown for at least half a second
|
226 |
const elapsedTime = Date.now() - startTime;
|
227 |
+
if (elapsedTime < 500) {
|
228 |
+
await new Promise(resolve => setTimeout(resolve, 500 - elapsedTime));
|
229 |
}
|
230 |
|
231 |
this.displayRound(roundData);
|
src/clozeGameEngine.js
CHANGED
@@ -530,7 +530,7 @@ class ClozeGame {
|
|
530 |
class="cloze-input"
|
531 |
data-blank-index="${index}"
|
532 |
placeholder="${'_'.repeat(Math.max(3, blank.originalWord.length))}"
|
533 |
-
style="width: ${Math.max(
|
534 |
|
535 |
html = html.replace(`___BLANK_${index}___`, inputHtml);
|
536 |
});
|
@@ -746,7 +746,7 @@ class ClozeGame {
|
|
746 |
class="cloze-input"
|
747 |
data-blank-index="${index}"
|
748 |
placeholder="${'_'.repeat(Math.max(3, blank.originalWord.length))}"
|
749 |
-
style="width: ${Math.max(
|
750 |
<button id="${chatButtonId}"
|
751 |
class="chat-button text-blue-500 hover:text-blue-700 text-sm"
|
752 |
data-blank-index="${index}"
|
|
|
530 |
class="cloze-input"
|
531 |
data-blank-index="${index}"
|
532 |
placeholder="${'_'.repeat(Math.max(3, blank.originalWord.length))}"
|
533 |
+
style="width: ${Math.max(50, blank.originalWord.length * 10)}px;">`;
|
534 |
|
535 |
html = html.replace(`___BLANK_${index}___`, inputHtml);
|
536 |
});
|
|
|
746 |
class="cloze-input"
|
747 |
data-blank-index="${index}"
|
748 |
placeholder="${'_'.repeat(Math.max(3, blank.originalWord.length))}"
|
749 |
+
style="width: ${Math.max(50, blank.originalWord.length * 10)}px;">
|
750 |
<button id="${chatButtonId}"
|
751 |
class="chat-button text-blue-500 hover:text-blue-700 text-sm"
|
752 |
data-blank-index="${index}"
|