Docfile commited on
Commit
ec7cc8e
·
verified ·
1 Parent(s): 811a2c3

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +131 -32
templates/index.html CHANGED
@@ -43,20 +43,88 @@
43
  background-color: #EEF2FF;
44
  }
45
 
46
- .preview-container {
47
- margin-top: 1rem;
48
- display: none; /* Par défaut, masqué */
 
49
  }
50
 
51
- .preview-container img {
52
- max-width: 100%;
53
- max-height: 300px;
54
- border-radius: 8px;
55
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  }
57
  </style>
58
  </head>
59
  <body class="bg-gray-50">
 
60
  <div class="min-h-screen">
61
  <!-- Header -->
62
  <header class="bg-white shadow-sm">
@@ -73,7 +141,7 @@
73
  <form id="uploadForm" class="space-y-6">
74
  <div class="upload-zone rounded-lg p-8 text-center">
75
  <input type="file" id="imageInput" accept="image/*" required
76
- class="hidden" onchange="updatePreview()">
77
  <label for="imageInput" class="cursor-pointer">
78
  <div class="space-y-2">
79
  <svg class="mx-auto h-12 w-12 text-indigo-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
@@ -86,13 +154,6 @@
86
  </div>
87
  </label>
88
  </div>
89
-
90
- <!-- Image Preview -->
91
- <div class="preview-container text-center" id="previewContainer">
92
- <p class="text-gray-500 text-sm mb-2">Prévisualisation de l'image :</p>
93
- <img id="imagePreview" alt="Prévisualisation de l'image">
94
- </div>
95
-
96
  <div class="flex justify-center">
97
  <button type="submit"
98
  class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-colors duration-200">
@@ -133,29 +194,67 @@
133
  <script>
134
  let tableauContent = '';
135
 
136
- function updatePreview() {
137
  const input = document.getElementById('imageInput');
138
- const previewContainer = document.getElementById('previewContainer');
139
- const imagePreview = document.getElementById('imagePreview');
140
  const fileName = document.getElementById('fileName');
141
-
142
- if (input.files && input.files[0]) {
143
- const file = input.files[0];
144
- fileName.textContent = file.name;
145
-
146
- // Prévisualisation de l'image
147
- const reader = new FileReader();
148
- reader.onload = (e) => {
149
- imagePreview.src = e.target.result;
150
- previewContainer.style.display = 'block'; // Afficher la prévisualisation
151
- };
152
- reader.readAsDataURL(file);
153
  } else {
154
  fileName.textContent = 'Cliquez ou glissez une image ici';
155
- previewContainer.style.display = 'none'; // Cacher la prévisualisation
156
  }
157
  }
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  document.getElementById('uploadForm').addEventListener('submit', async (e) => {
160
  e.preventDefault();
161
 
 
43
  background-color: #EEF2FF;
44
  }
45
 
46
+ /* Styles améliorés pour le tableau avec scroll horizontal */
47
+ .markdown-content {
48
+ overflow-x: auto;
49
+ padding-bottom: 1rem; /* Espace pour la scrollbar */
50
  }
51
 
52
+ .markdown-content table {
53
+ border-collapse: collapse;
54
+ min-width: 100%;
55
+ width: max-content; /* Permet au tableau de dépasser si nécessaire */
56
+ margin: 1rem 0;
57
+ }
58
+
59
+ .markdown-content th,
60
+ .markdown-content td {
61
+ border: 1px solid #e5e7eb;
62
+ padding: 0.75rem;
63
+ text-align: left;
64
+ white-space: nowrap; /* Empêche le retour à la ligne */
65
+ min-width: 150px; /* Largeur minimum pour chaque cellule */
66
+ }
67
+
68
+ .markdown-content th {
69
+ background-color: #f9fafb;
70
+ position: sticky;
71
+ top: 0;
72
+ z-index: 10;
73
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
74
+ }
75
+
76
+ /* Style pour la scrollbar horizontale */
77
+ .markdown-content::-webkit-scrollbar {
78
+ height: 8px;
79
+ }
80
+
81
+ .markdown-content::-webkit-scrollbar-track {
82
+ background: #f1f1f1;
83
+ border-radius: 4px;
84
+ }
85
+
86
+ .markdown-content::-webkit-scrollbar-thumb {
87
+ background: #6366F1;
88
+ border-radius: 4px;
89
+ }
90
+
91
+ .markdown-content::-webkit-scrollbar-thumb:hover {
92
+ background: #4F46E5;
93
+ }
94
+
95
+ /* Styles pour SweetAlert2 */
96
+ .swal2-popup {
97
+ width: 90% !important;
98
+ max-width: 1200px !important;
99
+ }
100
+
101
+ .swal2-html-container {
102
+ max-height: 80vh !important;
103
+ overflow-y: auto !important;
104
+ }
105
+
106
+ /* Indicateur de défilement */
107
+ .scroll-indicator {
108
+ position: absolute;
109
+ bottom: 20px;
110
+ right: 20px;
111
+ background: rgba(99, 102, 241, 0.9);
112
+ color: white;
113
+ padding: 8px 12px;
114
+ border-radius: 4px;
115
+ font-size: 0.875rem;
116
+ opacity: 0;
117
+ transition: opacity 0.3s ease;
118
+ pointer-events: none;
119
+ }
120
+
121
+ .scroll-indicator.visible {
122
+ opacity: 1;
123
  }
124
  </style>
125
  </head>
126
  <body class="bg-gray-50">
127
+ <!-- [Le reste du HTML reste identique jusqu'au script] -->
128
  <div class="min-h-screen">
129
  <!-- Header -->
130
  <header class="bg-white shadow-sm">
 
141
  <form id="uploadForm" class="space-y-6">
142
  <div class="upload-zone rounded-lg p-8 text-center">
143
  <input type="file" id="imageInput" accept="image/*" required
144
+ class="hidden" onchange="updateFileName()">
145
  <label for="imageInput" class="cursor-pointer">
146
  <div class="space-y-2">
147
  <svg class="mx-auto h-12 w-12 text-indigo-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
 
154
  </div>
155
  </label>
156
  </div>
 
 
 
 
 
 
 
157
  <div class="flex justify-center">
158
  <button type="submit"
159
  class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-colors duration-200">
 
194
  <script>
195
  let tableauContent = '';
196
 
197
+ function updateFileName() {
198
  const input = document.getElementById('imageInput');
 
 
199
  const fileName = document.getElementById('fileName');
200
+ if (input.files.length > 0) {
201
+ fileName.textContent = input.files[0].name;
 
 
 
 
 
 
 
 
 
 
202
  } else {
203
  fileName.textContent = 'Cliquez ou glissez une image ici';
 
204
  }
205
  }
206
 
207
+ function showScrollIndicator(container) {
208
+ if (container.scrollWidth > container.clientWidth) {
209
+ const indicator = document.createElement('div');
210
+ indicator.className = 'scroll-indicator visible';
211
+ indicator.textContent = '← Faites défiler →';
212
+ container.parentElement.appendChild(indicator);
213
+
214
+ setTimeout(() => {
215
+ indicator.classList.remove('visible');
216
+ }, 3000);
217
+
218
+ container.addEventListener('scroll', () => {
219
+ if (container.scrollLeft > 0) {
220
+ indicator.classList.add('visible');
221
+ } else {
222
+ indicator.classList.remove('visible');
223
+ }
224
+
225
+ // Cache l'indicateur après 1 seconde de scroll
226
+ clearTimeout(container.scrollTimeout);
227
+ container.scrollTimeout = setTimeout(() => {
228
+ indicator.classList.remove('visible');
229
+ }, 1000);
230
+ });
231
+ }
232
+ }
233
+
234
+ document.getElementById('showTableau').addEventListener('click', () => {
235
+ Swal.fire({
236
+ title: 'Tableau d\'analyse',
237
+ html: marked.parse(tableauContent),
238
+ width: '90%',
239
+ customClass: {
240
+ htmlContainer: 'markdown-content'
241
+ },
242
+ didRender: () => {
243
+ const container = document.querySelector('.markdown-content');
244
+ showScrollIndicator(container);
245
+
246
+ // Ajout des ombres de défilement
247
+ container.addEventListener('scroll', () => {
248
+ const maxScroll = container.scrollWidth - container.clientWidth;
249
+ container.style.boxShadow = container.scrollLeft > 0 ?
250
+ 'inset 10px 0 5px -5px rgba(0,0,0,0.1)' : '';
251
+ container.style.boxShadow += container.scrollLeft < maxScroll ?
252
+ ', inset -10px 0 5px -5px rgba(0,0,0,0.1)' : '';
253
+ });
254
+ }
255
+ });
256
+ });
257
+
258
  document.getElementById('uploadForm').addEventListener('submit', async (e) => {
259
  e.preventDefault();
260