qyle commited on
Commit
d81d2c4
·
verified ·
1 Parent(s): c560e99

switch position of language options

Browse files
Files changed (3) hide show
  1. static/app.js +24 -1
  2. static/style.css +19 -10
  3. templates/index.html +6 -6
static/app.js CHANGED
@@ -14,6 +14,7 @@ const doneFileUploadBtn = document.getElementById('done-file-upload');
14
  const closeFileUploadBtn = document.getElementById('close-file-upload-btn');
15
  const fileListHtml = document.getElementById('file-list');
16
 
 
17
  const enBtn = document.getElementById('btn-en');
18
  const frBtn = document.getElementById('btn-fr');
19
 
@@ -97,6 +98,16 @@ document.body.classList.add('no-scroll');
97
 
98
  let sessionFiles = [];
99
 
 
 
 
 
 
 
 
 
 
 
100
  function renderMessages() {
101
  chatWindow.innerHTML = '';
102
  const modelType = systemPresetSelect.value;
@@ -232,6 +243,8 @@ function openFileUploadOverlay(e) {
232
  e.preventDefault();
233
  // Let the stylesheet take over
234
  uploadFileOverlay.style.display = '';
 
 
235
  }
236
  uploadFileBtn.addEventListener('click', openFileUploadOverlay);
237
 
@@ -472,9 +485,11 @@ async function deleteFile(file) {
472
  // Close the overlay
473
  closeFileUploadBtn.addEventListener('click', () => {
474
  uploadFileOverlay.style.display = 'none';
 
475
  });
476
  doneFileUploadBtn.addEventListener('click', () => {
477
  uploadFileOverlay.style.display = 'none';
 
478
  })
479
 
480
  // ----- Event wiring -----
@@ -558,6 +573,8 @@ profileBtn.addEventListener('click', () => {
558
  gender = document.getElementById('gender').value;
559
  roles = Array.from(document.querySelectorAll('input[name="role"]:checked')).map(input => input.value);
560
  participantId = participantInput.value.trim();
 
 
561
  });
562
 
563
  sendBtn.addEventListener('click', sendMessage);
@@ -591,15 +608,19 @@ function openCommentOverlay(e) {
591
  e.preventDefault();
592
  // Let the stylesheet take over
593
  commentOverlay.style.display = '';
 
 
594
  }
595
  leaveCommentText.addEventListener('click', openCommentOverlay);
596
 
597
  // Cancelling or closing the comment overlay simply hides the comment popup
598
  closeCommentBtn.addEventListener('click', () => {
599
  commentOverlay.style.display = 'none';
 
600
  });
601
  cancelCommentBtn.addEventListener('click', () => {
602
  commentOverlay.style.display = 'none';
 
603
  });
604
 
605
  async function sendComment() {
@@ -723,4 +744,6 @@ renderFiles();
723
  // Open the details element by default on desktop only.
724
  if (window.innerWidth >= 460) {
725
  document.querySelector('details').setAttribute('open', '');
726
- }
 
 
 
14
  const closeFileUploadBtn = document.getElementById('close-file-upload-btn');
15
  const fileListHtml = document.getElementById('file-list');
16
 
17
+ const langSwitchContainer = document.getElementById('lang-switch-container');
18
  const enBtn = document.getElementById('btn-en');
19
  const frBtn = document.getElementById('btn-fr');
20
 
 
98
 
99
  let sessionFiles = [];
100
 
101
+ function openModal() {
102
+ // Move the translation options at the top right corner of the screen
103
+ langSwitchContainer.classList.add('floating');
104
+ }
105
+
106
+ function closeModal() {
107
+ // Move the translation options in the toolbar
108
+ langSwitchContainer.classList.remove('floating');
109
+ }
110
+
111
  function renderMessages() {
112
  chatWindow.innerHTML = '';
113
  const modelType = systemPresetSelect.value;
 
243
  e.preventDefault();
244
  // Let the stylesheet take over
245
  uploadFileOverlay.style.display = '';
246
+
247
+ openModal();
248
  }
249
  uploadFileBtn.addEventListener('click', openFileUploadOverlay);
250
 
 
485
  // Close the overlay
486
  closeFileUploadBtn.addEventListener('click', () => {
487
  uploadFileOverlay.style.display = 'none';
488
+ closeModal();
489
  });
490
  doneFileUploadBtn.addEventListener('click', () => {
491
  uploadFileOverlay.style.display = 'none';
492
+ closeModal();
493
  })
494
 
495
  // ----- Event wiring -----
 
573
  gender = document.getElementById('gender').value;
574
  roles = Array.from(document.querySelectorAll('input[name="role"]:checked')).map(input => input.value);
575
  participantId = participantInput.value.trim();
576
+
577
+ closeModal();
578
  });
579
 
580
  sendBtn.addEventListener('click', sendMessage);
 
608
  e.preventDefault();
609
  // Let the stylesheet take over
610
  commentOverlay.style.display = '';
611
+
612
+ openModal();
613
  }
614
  leaveCommentText.addEventListener('click', openCommentOverlay);
615
 
616
  // Cancelling or closing the comment overlay simply hides the comment popup
617
  closeCommentBtn.addEventListener('click', () => {
618
  commentOverlay.style.display = 'none';
619
+ closeModal();
620
  });
621
  cancelCommentBtn.addEventListener('click', () => {
622
  commentOverlay.style.display = 'none';
623
+ closeModal();
624
  });
625
 
626
  async function sendComment() {
 
744
  // Open the details element by default on desktop only.
745
  if (window.innerWidth >= 460) {
746
  document.querySelector('details').setAttribute('open', '');
747
+ }
748
+
749
+ openModal();
static/style.css CHANGED
@@ -347,6 +347,14 @@ svg {
347
  margin: 0 0 10px 0;
348
  font-size: 1.4rem;
349
  }
 
 
 
 
 
 
 
 
350
  }
351
 
352
  @media (min-width: 460px) {
@@ -431,18 +439,12 @@ svg {
431
  max-width: 400px;
432
  }
433
 
434
- .language-modal {
435
- display: flex;
436
- flex-direction: column;
437
- justify-content: space-between;
438
- max-height: 300px;
439
- }
440
-
441
  .consent-box {
442
  display: flex;
443
  flex-direction: column;
444
  justify-content: space-between;
445
- max-height: 300px;
446
  }
447
 
448
  .profile {
@@ -635,10 +637,17 @@ input[type='range'].disabled {
635
  align-items: center;
636
  font-family: sans-serif;
637
  gap: 5px;
 
 
 
 
 
 
 
 
638
  position: fixed;
639
  top: 20px;
640
- right: 20px;
641
-
642
  z-index: 100; /* In front of the modals */
643
  }
644
 
 
347
  margin: 0 0 10px 0;
348
  font-size: 1.4rem;
349
  }
350
+
351
+ /* Increase the size of the modals on mobile */
352
+ .comment-area {
353
+ width: 90%;
354
+ }
355
+ .upload-file-area {
356
+ width: 90%;
357
+ }
358
  }
359
 
360
  @media (min-width: 460px) {
 
439
  max-width: 400px;
440
  }
441
 
442
+ .language-modal,
 
 
 
 
 
 
443
  .consent-box {
444
  display: flex;
445
  flex-direction: column;
446
  justify-content: space-between;
447
+ max-height: 400px;
448
  }
449
 
450
  .profile {
 
637
  align-items: center;
638
  font-family: sans-serif;
639
  gap: 5px;
640
+
641
+ /* By default */
642
+ position: static;
643
+ margin-left: auto;
644
+ }
645
+
646
+ .lang-switch-container.floating {
647
+ /* At the top right corner, when a modal is opened */
648
  position: fixed;
649
  top: 20px;
650
+ right: 20px;
 
651
  z-index: 100; /* In front of the modals */
652
  }
653
 
templates/index.html CHANGED
@@ -42,6 +42,12 @@
42
  </div>
43
 
44
  <button id="clearBtn" class="secondary-button" data-i18n="btn_clear"></button>
 
 
 
 
 
 
45
  </div>
46
 
47
  <!-- Consent/Welcome overlay -->
@@ -211,12 +217,6 @@
211
 
212
  <div id="snackbar-container"></div>
213
 
214
- <div class="lang-switch-container">
215
- <button id="btn-en" class="lang-btn">EN</button>
216
- <span class="separator">|</span>
217
- <button id="btn-fr" class="lang-btn">FR</button>
218
- </div>
219
-
220
  <div class="font-size-container">
221
  <button id="increase-font-size-btn" class="font-size-btn">Aa+</button>
222
  <button id="reset-font-size-btn" class="font-size-btn">Aa</button>
 
42
  </div>
43
 
44
  <button id="clearBtn" class="secondary-button" data-i18n="btn_clear"></button>
45
+
46
+ <div class="lang-switch-container" id="lang-switch-container">
47
+ <button id="btn-en" class="lang-btn">EN</button>
48
+ <span class="separator">|</span>
49
+ <button id="btn-fr" class="lang-btn">FR</button>
50
+ </div>
51
  </div>
52
 
53
  <!-- Consent/Welcome overlay -->
 
217
 
218
  <div id="snackbar-container"></div>
219
 
 
 
 
 
 
 
220
  <div class="font-size-container">
221
  <button id="increase-font-size-btn" class="font-size-btn">Aa+</button>
222
  <button id="reset-font-size-btn" class="font-size-btn">Aa</button>