AnthonyHerve56 commited on
Commit
79d7ec9
·
1 Parent(s): 041b9be

Test modification pour iphone

Browse files
Files changed (2) hide show
  1. static/css/style.css +26 -2
  2. templates/index.html +42 -4
static/css/style.css CHANGED
@@ -28,6 +28,7 @@
28
  /* Animations */
29
  --scale-hover: scale(1.02);
30
  --translate-up: translateY(-3px);
 
31
  }
32
 
33
  /* RESET ET BASE */
@@ -45,6 +46,7 @@ body {
45
  display: flex;
46
  flex-direction: column;
47
  min-height: 100vh;
 
48
  -webkit-font-smoothing: antialiased;
49
  }
50
 
@@ -249,7 +251,7 @@ h1 {
249
  .chat-history {
250
  padding: 1.8rem;
251
  flex-grow: 1;
252
- max-height: calc(100vh - 280px);
253
  overflow-y: auto;
254
  scroll-behavior: smooth;
255
  }
@@ -608,7 +610,7 @@ h1 {
608
  .freddy-content {
609
  padding: 1rem;
610
  overflow-y: auto;
611
- max-height: calc(100vh - 150px);
612
  }
613
 
614
  .freddy-content::-webkit-scrollbar {
@@ -1037,6 +1039,7 @@ h1 {
1037
  }
1038
  .chat-history {
1039
  padding: 1rem;
 
1040
  }
1041
 
1042
  .chat-form {
@@ -1145,6 +1148,27 @@ h1 {
1145
  }
1146
  }
1147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1148
 
1149
 
1150
  .role-selection-container {
 
28
  /* Animations */
29
  --scale-hover: scale(1.02);
30
  --translate-up: translateY(-3px);
31
+ --app-vh: 1vh;
32
  }
33
 
34
  /* RESET ET BASE */
 
46
  display: flex;
47
  flex-direction: column;
48
  min-height: 100vh;
49
+ min-height: calc(var(--app-vh, 1vh) * 100);
50
  -webkit-font-smoothing: antialiased;
51
  }
52
 
 
251
  .chat-history {
252
  padding: 1.8rem;
253
  flex-grow: 1;
254
+ max-height: calc((var(--app-vh, 1vh) * 100) - 280px);
255
  overflow-y: auto;
256
  scroll-behavior: smooth;
257
  }
 
610
  .freddy-content {
611
  padding: 1rem;
612
  overflow-y: auto;
613
+ max-height: calc((var(--app-vh, 1vh) * 100) - 150px);
614
  }
615
 
616
  .freddy-content::-webkit-scrollbar {
 
1039
  }
1040
  .chat-history {
1041
  padding: 1rem;
1042
+ max-height: calc((var(--app-vh, 1vh) * 100) - 340px);
1043
  }
1044
 
1045
  .chat-form {
 
1148
  }
1149
  }
1150
 
1151
+ @supports (-webkit-touch-callout: none) {
1152
+ body {
1153
+ min-height: -webkit-fill-available;
1154
+ }
1155
+
1156
+ .chat-form {
1157
+ padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
1158
+ }
1159
+
1160
+ .keyboard-open .chat-form {
1161
+ position: sticky;
1162
+ bottom: 0;
1163
+ z-index: 30;
1164
+ box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
1165
+ }
1166
+
1167
+ .keyboard-open .chat-history {
1168
+ scroll-padding-bottom: 140px;
1169
+ }
1170
+ }
1171
+
1172
 
1173
 
1174
  .role-selection-container {
templates/index.html CHANGED
@@ -286,6 +286,24 @@
286
  <script>
287
  document.addEventListener('DOMContentLoaded', function () {
288
  let isConversationMode = false; // mode conversation activé/désactivé
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
 
290
  // Smooth scroll vers la zone de chat après sélection de rôle
291
  if (sessionStorage.getItem('scroll_to_chat')) {
@@ -309,6 +327,20 @@
309
  const closeSourcesBtn = document.getElementById('closeSourcesBtn');
310
  const freddyLogs = document.getElementById('freddyLogs');
311
  const freddySources = document.getElementById('freddySources');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
 
313
  // Éléments de sélection de rôle
314
  const roleButtons = document.querySelectorAll('.role-button');
@@ -619,8 +651,8 @@
619
 
620
  // === Reconnaissance vocale ===
621
  const micBtn = document.getElementById('micButton'); // utilise l'ID réel du bouton
622
- if (micBtn && 'webkitSpeechRecognition' in window) {
623
- const recognition = new webkitSpeechRecognition();
624
  recognition.lang = "fr-FR";
625
  recognition.continuous = false;
626
  recognition.interimResults = false;
@@ -663,14 +695,17 @@
663
  recognition.onend = () => {
664
  micBtn.classList.remove("listening");
665
  };
 
 
 
666
  }
667
 
668
 
669
 
670
  // === Mode conversation ===
671
  const conversationBtn = document.getElementById("conversationBtn");
672
- if (conversationBtn && 'webkitSpeechRecognition' in window) {
673
- const convRecognition = new webkitSpeechRecognition();
674
  convRecognition.lang = "fr-FR";
675
  convRecognition.continuous = false;
676
  convRecognition.interimResults = false;
@@ -756,6 +791,9 @@
756
  convRecognition.onend = () => {
757
  if (isConversationMode) convRecognition.start(); // boucle tant que mode actif
758
  };
 
 
 
759
  }
760
 
761
  });
 
286
  <script>
287
  document.addEventListener('DOMContentLoaded', function () {
288
  let isConversationMode = false; // mode conversation activé/désactivé
289
+ const isiOS = /iPad|iPhone|iPod/.test(navigator.userAgent)
290
+ || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
291
+
292
+ if (isiOS) {
293
+ document.body.classList.add('ios-device');
294
+ }
295
+
296
+ function updateAppViewportHeight() {
297
+ const viewportHeight = window.visualViewport ? window.visualViewport.height : window.innerHeight;
298
+ const vh = viewportHeight * 0.01;
299
+ document.documentElement.style.setProperty('--app-vh', `${vh}px`);
300
+ }
301
+
302
+ updateAppViewportHeight();
303
+ window.addEventListener('resize', updateAppViewportHeight);
304
+ if (window.visualViewport) {
305
+ window.visualViewport.addEventListener('resize', updateAppViewportHeight);
306
+ }
307
 
308
  // Smooth scroll vers la zone de chat après sélection de rôle
309
  if (sessionStorage.getItem('scroll_to_chat')) {
 
327
  const closeSourcesBtn = document.getElementById('closeSourcesBtn');
328
  const freddyLogs = document.getElementById('freddyLogs');
329
  const freddySources = document.getElementById('freddySources');
330
+ const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
331
+
332
+ if (isiOS && queryInput) {
333
+ queryInput.addEventListener('focus', function () {
334
+ document.body.classList.add('keyboard-open');
335
+ setTimeout(() => {
336
+ queryInput.scrollIntoView({ behavior: 'smooth', block: 'center' });
337
+ }, 120);
338
+ });
339
+
340
+ queryInput.addEventListener('blur', function () {
341
+ document.body.classList.remove('keyboard-open');
342
+ });
343
+ }
344
 
345
  // Éléments de sélection de rôle
346
  const roleButtons = document.querySelectorAll('.role-button');
 
651
 
652
  // === Reconnaissance vocale ===
653
  const micBtn = document.getElementById('micButton'); // utilise l'ID réel du bouton
654
+ if (micBtn && SpeechRecognition) {
655
+ const recognition = new SpeechRecognition();
656
  recognition.lang = "fr-FR";
657
  recognition.continuous = false;
658
  recognition.interimResults = false;
 
695
  recognition.onend = () => {
696
  micBtn.classList.remove("listening");
697
  };
698
+ } else if (micBtn) {
699
+ micBtn.disabled = true;
700
+ micBtn.title = "Reconnaissance vocale non disponible sur ce navigateur";
701
  }
702
 
703
 
704
 
705
  // === Mode conversation ===
706
  const conversationBtn = document.getElementById("conversationBtn");
707
+ if (conversationBtn && SpeechRecognition) {
708
+ const convRecognition = new SpeechRecognition();
709
  convRecognition.lang = "fr-FR";
710
  convRecognition.continuous = false;
711
  convRecognition.interimResults = false;
 
791
  convRecognition.onend = () => {
792
  if (isConversationMode) convRecognition.start(); // boucle tant que mode actif
793
  };
794
+ } else if (conversationBtn) {
795
+ conversationBtn.disabled = true;
796
+ conversationBtn.title = "Mode conversation vocale non disponible sur ce navigateur";
797
  }
798
 
799
  });