milwright commited on
Commit
b48eb70
Β·
1 Parent(s): 7b3ba65

Add sticky control panel for mobile-friendly navigation

Browse files

- Implement fixed bottom panel with Hint | Submit layout
- Ensure buttons stay visible above mobile keyboards
- Add responsive styling with larger touch targets
- Include backdrop blur and consistent theming
- Improve content filtering with enhanced dash detection

Files changed (3) hide show
  1. index.html +18 -10
  2. src/app.js +3 -0
  3. src/styles.css +94 -0
index.html CHANGED
@@ -36,16 +36,8 @@
36
  <div class="text-sm font-semibold mb-2">πŸ‘‰πŸ‘ˆ Hints:</div>
37
  <div id="hints-list" class="text-sm space-y-1"></div>
38
  </div>
39
- <div id="controls" class="flex gap-4 justify-center flex-wrap">
40
- <button type="button" id="submit-btn" class="typewriter-button">
41
- Submit
42
- </button>
43
- <button type="button" id="next-btn" class="typewriter-button hidden">
44
- Next Passage
45
- </button>
46
- <button type="button" id="hint-btn" class="typewriter-button">
47
- Show Hints
48
- </button>
49
  </div>
50
  <div id="result" class="mt-4 text-center result-text"></div>
51
  </div>
@@ -53,6 +45,22 @@
53
  </main>
54
  </div>
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  <script src="./src/app.js" type="module"></script>
57
  </body>
58
  </html>
 
36
  <div class="text-sm font-semibold mb-2">πŸ‘‰πŸ‘ˆ Hints:</div>
37
  <div id="hints-list" class="text-sm space-y-1"></div>
38
  </div>
39
+ <div id="controls" class="hidden">
40
+ <!-- Controls moved to sticky footer -->
 
 
 
 
 
 
 
 
41
  </div>
42
  <div id="result" class="mt-4 text-center result-text"></div>
43
  </div>
 
45
  </main>
46
  </div>
47
 
48
+ <!-- Sticky Control Panel -->
49
+ <div id="sticky-controls" class="sticky-controls hidden">
50
+ <div class="controls-inner">
51
+ <button type="button" id="hint-btn" class="typewriter-button">
52
+ Show Hints
53
+ </button>
54
+ <div class="controls-divider"></div>
55
+ <button type="button" id="submit-btn" class="typewriter-button">
56
+ Submit
57
+ </button>
58
+ <button type="button" id="next-btn" class="typewriter-button hidden">
59
+ Next Passage
60
+ </button>
61
+ </div>
62
+ </div>
63
+
64
  <script src="./src/app.js" type="module"></script>
65
  </body>
66
  </html>
src/app.js CHANGED
@@ -11,6 +11,7 @@ class App {
11
  this.elements = {
12
  loading: document.getElementById('loading'),
13
  gameArea: document.getElementById('game-area'),
 
14
  bookInfo: document.getElementById('book-info'),
15
  roundInfo: document.getElementById('round-info'),
16
  contextualization: document.getElementById('contextualization'),
@@ -315,9 +316,11 @@ class App {
315
  `;
316
  this.elements.loading.classList.remove('hidden');
317
  this.elements.gameArea.classList.add('hidden');
 
318
  } else {
319
  this.elements.loading.classList.add('hidden');
320
  this.elements.gameArea.classList.remove('hidden');
 
321
  }
322
  }
323
 
 
11
  this.elements = {
12
  loading: document.getElementById('loading'),
13
  gameArea: document.getElementById('game-area'),
14
+ stickyControls: document.getElementById('sticky-controls'),
15
  bookInfo: document.getElementById('book-info'),
16
  roundInfo: document.getElementById('round-info'),
17
  contextualization: document.getElementById('contextualization'),
 
316
  `;
317
  this.elements.loading.classList.remove('hidden');
318
  this.elements.gameArea.classList.add('hidden');
319
+ this.elements.stickyControls.classList.add('hidden');
320
  } else {
321
  this.elements.loading.classList.add('hidden');
322
  this.elements.gameArea.classList.remove('hidden');
323
+ this.elements.stickyControls.classList.remove('hidden');
324
  }
325
  }
326
 
src/styles.css CHANGED
@@ -464,6 +464,92 @@
464
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
465
  }
466
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  /* Print styles */
468
  @media print {
469
  body {
@@ -478,6 +564,14 @@
478
  .typewriter-button {
479
  display: none;
480
  }
 
 
 
 
 
 
 
 
481
  }
482
  }
483
 
 
464
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
465
  }
466
 
467
+ /* Sticky Control Panel */
468
+ .sticky-controls {
469
+ position: fixed;
470
+ bottom: 0;
471
+ left: 0;
472
+ right: 0;
473
+ background: var(--aged-paper-light);
474
+ border-top: 2px solid rgba(0, 0, 0, 0.1);
475
+ box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
476
+ padding: 12px 16px;
477
+ z-index: 1000;
478
+ backdrop-filter: blur(8px);
479
+ }
480
+
481
+ .sticky-controls .controls-inner {
482
+ max-width: 1024px;
483
+ margin: 0 auto;
484
+ display: flex;
485
+ gap: 1px;
486
+ justify-content: center;
487
+ align-items: center;
488
+ }
489
+
490
+ .sticky-controls .typewriter-button {
491
+ flex: 1;
492
+ max-width: 200px;
493
+ min-height: 44px;
494
+ margin: 0;
495
+ border-radius: 0;
496
+ font-size: 16px;
497
+ font-weight: 600;
498
+ position: relative;
499
+ }
500
+
501
+ .sticky-controls .typewriter-button:first-child {
502
+ border-top-left-radius: 8px;
503
+ border-bottom-left-radius: 8px;
504
+ }
505
+
506
+ .sticky-controls .typewriter-button:last-child {
507
+ border-top-right-radius: 8px;
508
+ border-bottom-right-radius: 8px;
509
+ }
510
+
511
+ .sticky-controls .typewriter-button:not(:last-child) {
512
+ border-right: 1px solid rgba(0, 0, 0, 0.2);
513
+ }
514
+
515
+ .controls-divider {
516
+ height: 24px;
517
+ width: 2px;
518
+ background: rgba(0, 0, 0, 0.3);
519
+ margin: 0 -1px;
520
+ z-index: 1;
521
+ }
522
+
523
+ /* Add bottom padding to main content to prevent overlap */
524
+ #game-container {
525
+ padding-bottom: 100px;
526
+ }
527
+
528
+ /* Mobile optimizations for sticky controls */
529
+ @media (max-width: 640px) {
530
+ .sticky-controls {
531
+ padding: 10px 12px;
532
+ }
533
+
534
+ .sticky-controls .typewriter-button {
535
+ min-height: 48px;
536
+ font-size: 16px;
537
+ padding: 12px 8px;
538
+ }
539
+
540
+ #game-container {
541
+ padding-bottom: 90px;
542
+ }
543
+ }
544
+
545
+ /* Ensure controls stay above mobile keyboards */
546
+ @media (max-width: 640px) and (max-height: 500px) {
547
+ .sticky-controls {
548
+ position: fixed;
549
+ bottom: 0;
550
+ }
551
+ }
552
+
553
  /* Print styles */
554
  @media print {
555
  body {
 
564
  .typewriter-button {
565
  display: none;
566
  }
567
+
568
+ .sticky-controls {
569
+ display: none;
570
+ }
571
+
572
+ #game-container {
573
+ padding-bottom: 0;
574
+ }
575
  }
576
  }
577