Docfile commited on
Commit
71d8e2e
·
verified ·
1 Parent(s): b21bde5

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +25 -107
templates/index.html CHANGED
@@ -65,37 +65,6 @@
65
  border-bottom-color: #60a5fa;
66
  }
67
 
68
- .custom-file-input {
69
- position: relative;
70
- display: inline-block;
71
- width: 100%;
72
- }
73
-
74
- .custom-file-input input[type="file"] {
75
- opacity: 0;
76
- position: absolute;
77
- top: 0;
78
- left: 0;
79
- width: 100%;
80
- height: 100%;
81
- cursor: pointer;
82
- }
83
-
84
- .custom-file-label {
85
- padding: 1rem 1.5rem;
86
- background: rgba(255, 255, 255, 0.05);
87
- border: 2px dashed rgba(255, 255, 255, 0.2);
88
- border-radius: 0.75rem;
89
- text-align: center;
90
- cursor: pointer;
91
- transition: all 0.3s ease;
92
- }
93
-
94
- .custom-file-input:hover .custom-file-label {
95
- border-color: rgba(96, 165, 250, 0.5);
96
- background: rgba(96, 165, 250, 0.1);
97
- }
98
-
99
  @keyframes rotation {
100
  0% { transform: rotate(0deg) }
101
  100% { transform: rotate(360deg) }
@@ -121,55 +90,27 @@
121
  <div class="max-w-4xl mx-auto">
122
  <!-- Input Section -->
123
  <div class="glass-morph rounded-2xl p-8 mb-12 card-hover">
124
- <form @submit.prevent="generateFlashcards" enctype="multipart/form-data">
125
- <div class="mb-6">
126
- <label for="topic" class="block text-lg font-medium mb-3 text-gray-300">
127
- Quel sujet souhaitez-vous explorer ?
128
- </label>
129
- <div class="relative">
130
- <input
131
- type="text"
132
- id="topic"
133
- v-model="topic"
134
- class="w-full px-6 py-4 bg-gray-800/50 rounded-xl border border-gray-700 focus:ring-2 focus:ring-blue-500 focus:border-transparent text-lg transition-all duration-300"
135
- placeholder="Ex: Intelligence Artificielle, Quantum Computing..."
136
- :disabled="isLoading"
137
- >
138
- </div>
139
- </div>
140
-
141
- <div class="mb-8">
142
- <label class="block text-lg font-medium mb-3 text-gray-300">
143
- Document PDF (optionnel)
144
- </label>
145
- <div class="custom-file-input">
146
- <input
147
- type="file"
148
- ref="fileInput"
149
- accept=".pdf"
150
- @change="handleFileChange"
151
- :disabled="isLoading"
152
- >
153
- <div class="custom-file-label">
154
- <div v-if="selectedFile">
155
- <span class="text-blue-400">[[selectedFile.name]]</span>
156
- </div>
157
- <div v-else>
158
- <span class="text-gray-400">Glissez votre fichier PDF ici ou cliquez pour sélectionner</span>
159
- </div>
160
- </div>
161
- </div>
162
  </div>
163
-
164
- <button
165
- type="submit"
166
- :disabled="isLoading"
167
- class="w-full bg-gradient-to-r from-blue-500 to-purple-600 text-white py-4 px-8 rounded-xl font-medium text-lg hover:opacity-90 transition-all duration-300 flex items-center justify-center space-x-3"
168
- >
169
- <span v-if="!isLoading">Générer les Flashcards</span>
170
- <span v-else class="custom-loader"></span>
171
- </button>
172
- </form>
173
  </div>
174
 
175
  <!-- Error Message -->
@@ -250,26 +191,10 @@
250
  flashcards: [],
251
  activeTab: 'study',
252
  isLoading: false,
253
- error: null,
254
- selectedFile: null
255
  }
256
  },
257
  methods: {
258
- handleFileChange(event) {
259
- const file = event.target.files[0]
260
- if (file) {
261
- if (file.type === 'application/pdf') {
262
- this.selectedFile = file
263
- this.error = null
264
- } else {
265
- this.error = 'Veuillez sélectionner un fichier PDF valide.'
266
- event.target.value = ''
267
- this.selectedFile = null
268
- }
269
- } else {
270
- this.selectedFile = null
271
- }
272
- },
273
  async generateFlashcards() {
274
  if (!this.topic) {
275
  this.error = 'Veuillez entrer un sujet.'
@@ -281,17 +206,8 @@
281
  this.flashcards = []
282
 
283
  try {
284
- const formData = new FormData()
285
- formData.append('topic', this.topic)
286
-
287
- if (this.selectedFile) {
288
- formData.append('file', this.selectedFile)
289
- }
290
-
291
- const response = await axios.post('/generate', formData, {
292
- headers: {
293
- 'Content-Type': 'multipart/form-data'
294
- }
295
  })
296
 
297
  if (response.data.success) {
@@ -300,6 +216,7 @@
300
  showAnswer: false
301
  }))
302
 
 
303
  setTimeout(() => {
304
  this.flashcards = cards
305
  this.$nextTick(() => {
@@ -320,6 +237,7 @@
320
  }
321
  },
322
  mounted() {
 
323
  gsap.from('.gradient-text', {
324
  y: -50,
325
  opacity: 0,
 
65
  border-bottom-color: #60a5fa;
66
  }
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  @keyframes rotation {
69
  0% { transform: rotate(0deg) }
70
  100% { transform: rotate(360deg) }
 
90
  <div class="max-w-4xl mx-auto">
91
  <!-- Input Section -->
92
  <div class="glass-morph rounded-2xl p-8 mb-12 card-hover">
93
+ <div class="mb-6">
94
+ <label for="topic" class="block text-lg font-medium mb-3 text-gray-300">Quel sujet souhaitez-vous explorer ?</label>
95
+ <div class="relative">
96
+ <input
97
+ type="text"
98
+ id="topic"
99
+ v-model="topic"
100
+ class="w-full px-6 py-4 bg-gray-800/50 rounded-xl border border-gray-700 focus:ring-2 focus:ring-blue-500 focus:border-transparent text-lg transition-all duration-300"
101
+ placeholder="Ex: Intelligence Artificielle, Quantum Computing..."
102
+ :disabled="isLoading"
103
+ >
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  </div>
105
+ </div>
106
+ <button
107
+ @click="generateFlashcards"
108
+ :disabled="isLoading"
109
+ class="w-full bg-gradient-to-r from-blue-500 to-purple-600 text-white py-4 px-8 rounded-xl font-medium text-lg hover:opacity-90 transition-all duration-300 flex items-center justify-center space-x-3"
110
+ >
111
+ <span v-if="!isLoading">Générer les Flashcards</span>
112
+ <span v-else class="custom-loader"></span>
113
+ </button>
 
114
  </div>
115
 
116
  <!-- Error Message -->
 
191
  flashcards: [],
192
  activeTab: 'study',
193
  isLoading: false,
194
+ error: null
 
195
  }
196
  },
197
  methods: {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  async generateFlashcards() {
199
  if (!this.topic) {
200
  this.error = 'Veuillez entrer un sujet.'
 
206
  this.flashcards = []
207
 
208
  try {
209
+ const response = await axios.post('/generate', {
210
+ topic: this.topic
 
 
 
 
 
 
 
 
 
211
  })
212
 
213
  if (response.data.success) {
 
216
  showAnswer: false
217
  }))
218
 
219
+ // Animation des cartes à leur apparition
220
  setTimeout(() => {
221
  this.flashcards = cards
222
  this.$nextTick(() => {
 
237
  }
238
  },
239
  mounted() {
240
+ // Animation du titre à l'entrée
241
  gsap.from('.gradient-text', {
242
  y: -50,
243
  opacity: 0,