Docfile commited on
Commit
25804f6
·
verified ·
1 Parent(s): ec7cc8e

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +77 -22
templates/index.html CHANGED
@@ -43,16 +43,15 @@
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
 
@@ -61,8 +60,8 @@
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 {
@@ -73,7 +72,6 @@
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
  }
@@ -92,7 +90,6 @@
92
  background: #4F46E5;
93
  }
94
 
95
- /* Styles pour SweetAlert2 */
96
  .swal2-popup {
97
  width: 90% !important;
98
  max-width: 1200px !important;
@@ -103,7 +100,6 @@
103
  overflow-y: auto !important;
104
  }
105
 
106
- /* Indicateur de défilement */
107
  .scroll-indicator {
108
  position: absolute;
109
  bottom: 20px;
@@ -121,12 +117,45 @@
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">
131
  <div class="max-w-7xl mx-auto px-4 py-4 sm:px-6 lg:px-8">
132
  <h1 class="text-3xl font-bold text-indigo-600">Mariam AI</h1>
@@ -134,14 +163,12 @@
134
  </div>
135
  </header>
136
 
137
- <!-- Main content -->
138
  <main class="max-w-7xl mx-auto px-4 py-8 sm:px-6 lg:px-8">
139
- <!-- Upload Section -->
140
  <div class="bg-white rounded-lg shadow p-6 mb-8">
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,6 +181,16 @@
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">
@@ -163,7 +200,6 @@
163
  </form>
164
  </div>
165
 
166
- <!-- Loading indicator -->
167
  <div id="loading" class="hidden">
168
  <div class="flex flex-col items-center justify-center space-y-4">
169
  <span class="loader"></span>
@@ -171,9 +207,7 @@
171
  </div>
172
  </div>
173
 
174
- <!-- Results Section -->
175
  <div id="results" class="space-y-8 hidden">
176
- <!-- Tableau Button -->
177
  <div class="flex justify-center">
178
  <button id="showTableau"
179
  class="px-6 py-3 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 transition-colors duration-200">
@@ -181,7 +215,6 @@
181
  </button>
182
  </div>
183
 
184
- <!-- Dissertation -->
185
  <div class="bg-white rounded-lg shadow p-6">
186
  <h2 class="text-2xl font-bold text-gray-900 mb-4">Dissertation</h2>
187
  <div id="dissertationResult" class="prose max-w-none markdown-content">
@@ -194,16 +227,40 @@
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');
@@ -222,7 +279,6 @@
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');
@@ -243,7 +299,6 @@
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 ?
 
43
  background-color: #EEF2FF;
44
  }
45
 
 
46
  .markdown-content {
47
  overflow-x: auto;
48
+ padding-bottom: 1rem;
49
  }
50
 
51
  .markdown-content table {
52
  border-collapse: collapse;
53
  min-width: 100%;
54
+ width: max-content;
55
  margin: 1rem 0;
56
  }
57
 
 
60
  border: 1px solid #e5e7eb;
61
  padding: 0.75rem;
62
  text-align: left;
63
+ white-space: nowrap;
64
+ min-width: 150px;
65
  }
66
 
67
  .markdown-content th {
 
72
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
73
  }
74
 
 
75
  .markdown-content::-webkit-scrollbar {
76
  height: 8px;
77
  }
 
90
  background: #4F46E5;
91
  }
92
 
 
93
  .swal2-popup {
94
  width: 90% !important;
95
  max-width: 1200px !important;
 
100
  overflow-y: auto !important;
101
  }
102
 
 
103
  .scroll-indicator {
104
  position: absolute;
105
  bottom: 20px;
 
117
  .scroll-indicator.visible {
118
  opacity: 1;
119
  }
120
+
121
+ /* Styles pour la prévisualisation de l'image */
122
+ .image-preview-container {
123
+ position: relative;
124
+ max-width: 100%;
125
+ margin: 1rem auto;
126
+ border-radius: 0.5rem;
127
+ overflow: hidden;
128
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
129
+ 0 2px 4px -1px rgba(0, 0, 0, 0.06);
130
+ }
131
+
132
+ .image-preview-container img {
133
+ display: block;
134
+ max-width: 100%;
135
+ height: auto;
136
+ max-height: 400px;
137
+ object-fit: contain;
138
+ }
139
+
140
+ .remove-image {
141
+ position: absolute;
142
+ top: 0.5rem;
143
+ right: 0.5rem;
144
+ background-color: rgba(255, 255, 255, 0.9);
145
+ border-radius: 50%;
146
+ padding: 0.5rem;
147
+ cursor: pointer;
148
+ transition: all 0.2s ease;
149
+ }
150
+
151
+ .remove-image:hover {
152
+ background-color: #EF4444;
153
+ color: white;
154
+ }
155
  </style>
156
  </head>
157
  <body class="bg-gray-50">
 
158
  <div class="min-h-screen">
 
159
  <header class="bg-white shadow-sm">
160
  <div class="max-w-7xl mx-auto px-4 py-4 sm:px-6 lg:px-8">
161
  <h1 class="text-3xl font-bold text-indigo-600">Mariam AI</h1>
 
163
  </div>
164
  </header>
165
 
 
166
  <main class="max-w-7xl mx-auto px-4 py-8 sm:px-6 lg:px-8">
 
167
  <div class="bg-white rounded-lg shadow p-6 mb-8">
168
  <form id="uploadForm" class="space-y-6">
169
  <div class="upload-zone rounded-lg p-8 text-center">
170
  <input type="file" id="imageInput" accept="image/*" required
171
+ class="hidden" onchange="handleImageSelect()">
172
  <label for="imageInput" class="cursor-pointer">
173
  <div class="space-y-2">
174
  <svg class="mx-auto h-12 w-12 text-indigo-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
 
181
  </div>
182
  </label>
183
  </div>
184
+
185
+ <div id="imagePreview" class="hidden image-preview-container">
186
+ <img id="preview" src="#" alt="Prévisualisation">
187
+ <button type="button" class="remove-image" onclick="removeImage()">
188
+ <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
189
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
190
+ </svg>
191
+ </button>
192
+ </div>
193
+
194
  <div class="flex justify-center">
195
  <button type="submit"
196
  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">
 
200
  </form>
201
  </div>
202
 
 
203
  <div id="loading" class="hidden">
204
  <div class="flex flex-col items-center justify-center space-y-4">
205
  <span class="loader"></span>
 
207
  </div>
208
  </div>
209
 
 
210
  <div id="results" class="space-y-8 hidden">
 
211
  <div class="flex justify-center">
212
  <button id="showTableau"
213
  class="px-6 py-3 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 transition-colors duration-200">
 
215
  </button>
216
  </div>
217
 
 
218
  <div class="bg-white rounded-lg shadow p-6">
219
  <h2 class="text-2xl font-bold text-gray-900 mb-4">Dissertation</h2>
220
  <div id="dissertationResult" class="prose max-w-none markdown-content">
 
227
  <script>
228
  let tableauContent = '';
229
 
230
+ function handleImageSelect() {
231
  const input = document.getElementById('imageInput');
232
+ const preview = document.getElementById('preview');
233
+ const previewContainer = document.getElementById('imagePreview');
234
  const fileName = document.getElementById('fileName');
235
+
236
+ if (input.files && input.files[0]) {
237
+ const reader = new FileReader();
238
+
239
+ reader.onload = function(e) {
240
+ preview.src = e.target.result;
241
+ previewContainer.classList.remove('hidden');
242
+ previewContainer.classList.add('fade-in');
243
+ };
244
+
245
+ reader.readAsDataURL(input.files[0]);
246
  fileName.textContent = input.files[0].name;
247
  } else {
248
+ removeImage();
249
  }
250
  }
251
 
252
+ function removeImage() {
253
+ const input = document.getElementById('imageInput');
254
+ const preview = document.getElementById('preview');
255
+ const previewContainer = document.getElementById('imagePreview');
256
+ const fileName = document.getElementById('fileName');
257
+
258
+ input.value = '';
259
+ preview.src = '#';
260
+ previewContainer.classList.add('hidden');
261
+ fileName.textContent = 'Cliquez ou glissez une image ici';
262
+ }
263
+
264
  function showScrollIndicator(container) {
265
  if (container.scrollWidth > container.clientWidth) {
266
  const indicator = document.createElement('div');
 
279
  indicator.classList.remove('visible');
280
  }
281
 
 
282
  clearTimeout(container.scrollTimeout);
283
  container.scrollTimeout = setTimeout(() => {
284
  indicator.classList.remove('visible');
 
299
  const container = document.querySelector('.markdown-content');
300
  showScrollIndicator(container);
301
 
 
302
  container.addEventListener('scroll', () => {
303
  const maxScroll = container.scrollWidth - container.clientWidth;
304
  container.style.boxShadow = container.scrollLeft > 0 ?