Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +109 -108
templates/index.html
CHANGED
|
@@ -4,9 +4,8 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>AI Flashcards Generator</title>
|
| 7 |
-
<!-- Chargement des scripts dans le bon ordre -->
|
| 8 |
-
<script src="https://unpkg.com/[email protected]/dist/vue.global.js"></script>
|
| 9 |
<script src="https://cdn.tailwindcss.com"></script>
|
|
|
|
| 10 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.6.2/axios.min.js"></script>
|
| 11 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet">
|
| 12 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
|
|
@@ -25,6 +24,15 @@
|
|
| 25 |
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 26 |
}
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
.gradient-text {
|
| 29 |
background: linear-gradient(45deg, #60a5fa, #a855f7);
|
| 30 |
-webkit-background-clip: text;
|
|
@@ -57,48 +65,52 @@
|
|
| 57 |
border-bottom-color: #60a5fa;
|
| 58 |
}
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
perspective: 1000px;
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
}
|
| 65 |
|
| 66 |
-
.
|
| 67 |
position: relative;
|
| 68 |
width: 100%;
|
| 69 |
height: 100%;
|
| 70 |
-
text-align: left;
|
| 71 |
transition: transform 0.8s;
|
| 72 |
transform-style: preserve-3d;
|
| 73 |
}
|
| 74 |
|
| 75 |
-
.
|
| 76 |
transform: rotateY(180deg);
|
| 77 |
}
|
| 78 |
|
| 79 |
-
.
|
| 80 |
-
.flashcard-back {
|
| 81 |
position: absolute;
|
| 82 |
width: 100%;
|
| 83 |
height: 100%;
|
| 84 |
backface-visibility: hidden;
|
| 85 |
-
-webkit-backface-visibility: hidden;
|
| 86 |
}
|
| 87 |
|
| 88 |
-
.
|
| 89 |
-
|
| 90 |
}
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
.fade-enter-active, .fade-leave-active {
|
| 98 |
-
transition: opacity 0.5s ease;
|
| 99 |
-
}
|
| 100 |
-
.fade-enter-from, .fade-leave-to {
|
| 101 |
-
opacity: 0;
|
| 102 |
}
|
| 103 |
</style>
|
| 104 |
</head>
|
|
@@ -113,7 +125,7 @@
|
|
| 113 |
<!-- Main Content -->
|
| 114 |
<div class="max-w-4xl mx-auto">
|
| 115 |
<!-- Input Section -->
|
| 116 |
-
<div class="glass-morph rounded-2xl p-8 mb-12">
|
| 117 |
<div class="mb-6">
|
| 118 |
<label for="topic" class="block text-lg font-medium mb-3 text-gray-300">Quel sujet souhaitez-vous explorer ?</label>
|
| 119 |
<div class="relative">
|
|
@@ -175,33 +187,25 @@
|
|
| 175 |
<div
|
| 176 |
v-for="(card, index) in flashcards"
|
| 177 |
:key="index"
|
| 178 |
-
class="
|
| 179 |
-
:class="{
|
| 180 |
-
@click="card.
|
| 181 |
>
|
| 182 |
-
<div class="
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
</
|
| 189 |
-
<div class="flex-1">
|
| 190 |
-
<h3 class="text-xl font-medium">[[card.question]]</h3>
|
| 191 |
-
<p class="text-gray-400 mt-2">(Cliquez pour voir la réponse)</p>
|
| 192 |
-
</div>
|
| 193 |
</div>
|
| 194 |
</div>
|
| 195 |
-
|
| 196 |
-
<div class="
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
</
|
| 201 |
-
<div class="flex-1">
|
| 202 |
-
<p class="text-gray-300">[[card.answer]]</p>
|
| 203 |
-
<p class="text-gray-400 mt-2">(Cliquez pour voir la question)</p>
|
| 204 |
-
</div>
|
| 205 |
</div>
|
| 206 |
</div>
|
| 207 |
</div>
|
|
@@ -219,74 +223,71 @@
|
|
| 219 |
</div>
|
| 220 |
|
| 221 |
<script>
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
}
|
| 236 |
-
},
|
| 237 |
-
methods: {
|
| 238 |
-
async generateFlashcards() {
|
| 239 |
-
if (!this.topic) {
|
| 240 |
-
this.error = 'Veuillez entrer un sujet.'
|
| 241 |
-
return
|
| 242 |
-
}
|
| 243 |
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
})
|
| 269 |
})
|
| 270 |
-
}
|
| 271 |
-
}
|
| 272 |
-
} catch (error) {
|
| 273 |
-
this.error = error.response?.data?.error || 'Une erreur est survenue lors de la génération.'
|
| 274 |
-
} finally {
|
| 275 |
-
this.isLoading = false
|
| 276 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
}
|
| 278 |
-
},
|
| 279 |
-
mounted() {
|
| 280 |
-
// Animation du titre à l'entrée
|
| 281 |
-
gsap.from('.gradient-text', {
|
| 282 |
-
y: -50,
|
| 283 |
-
opacity: 0,
|
| 284 |
-
duration: 1,
|
| 285 |
-
ease: 'power3.out'
|
| 286 |
-
})
|
| 287 |
}
|
| 288 |
-
}
|
| 289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
</script>
|
| 291 |
</body>
|
| 292 |
</html>
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>AI Flashcards Generator</title>
|
|
|
|
|
|
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
| 9 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.6.2/axios.min.js"></script>
|
| 10 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet">
|
| 11 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
|
|
|
|
| 24 |
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 25 |
}
|
| 26 |
|
| 27 |
+
.card-hover {
|
| 28 |
+
transition: all 0.3s ease;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.card-hover:hover {
|
| 32 |
+
transform: translateY(-5px);
|
| 33 |
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
.gradient-text {
|
| 37 |
background: linear-gradient(45deg, #60a5fa, #a855f7);
|
| 38 |
-webkit-background-clip: text;
|
|
|
|
| 65 |
border-bottom-color: #60a5fa;
|
| 66 |
}
|
| 67 |
|
| 68 |
+
@keyframes rotation {
|
| 69 |
+
0% { transform: rotate(0deg) }
|
| 70 |
+
100% { transform: rotate(360deg) }
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.fade-enter-active, .fade-leave-active {
|
| 74 |
+
transition: opacity 0.5s ease;
|
| 75 |
+
}
|
| 76 |
+
.fade-enter-from, .fade-leave-to {
|
| 77 |
+
opacity: 0;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/* Styles pour l'effet de rotation */
|
| 81 |
+
.card-container {
|
| 82 |
perspective: 1000px;
|
| 83 |
+
position: relative;
|
| 84 |
+
width: 100%;
|
| 85 |
+
height: 250px; /* Ajustez la hauteur selon vos besoins */
|
| 86 |
}
|
| 87 |
|
| 88 |
+
.card-inner {
|
| 89 |
position: relative;
|
| 90 |
width: 100%;
|
| 91 |
height: 100%;
|
|
|
|
| 92 |
transition: transform 0.8s;
|
| 93 |
transform-style: preserve-3d;
|
| 94 |
}
|
| 95 |
|
| 96 |
+
.card-container.is-flipped .card-inner {
|
| 97 |
transform: rotateY(180deg);
|
| 98 |
}
|
| 99 |
|
| 100 |
+
.card-face {
|
|
|
|
| 101 |
position: absolute;
|
| 102 |
width: 100%;
|
| 103 |
height: 100%;
|
| 104 |
backface-visibility: hidden;
|
|
|
|
| 105 |
}
|
| 106 |
|
| 107 |
+
.card-front {
|
| 108 |
+
/* Vos styles existants pour la face avant */
|
| 109 |
}
|
| 110 |
|
| 111 |
+
.card-back {
|
| 112 |
+
transform: rotateY(180deg);
|
| 113 |
+
/* Vos styles pour la face arrière */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
| 115 |
</style>
|
| 116 |
</head>
|
|
|
|
| 125 |
<!-- Main Content -->
|
| 126 |
<div class="max-w-4xl mx-auto">
|
| 127 |
<!-- Input Section -->
|
| 128 |
+
<div class="glass-morph rounded-2xl p-8 mb-12 card-hover">
|
| 129 |
<div class="mb-6">
|
| 130 |
<label for="topic" class="block text-lg font-medium mb-3 text-gray-300">Quel sujet souhaitez-vous explorer ?</label>
|
| 131 |
<div class="relative">
|
|
|
|
| 187 |
<div
|
| 188 |
v-for="(card, index) in flashcards"
|
| 189 |
:key="index"
|
| 190 |
+
class="card-container"
|
| 191 |
+
:class="{'is-flipped': card.isFlipped}"
|
| 192 |
+
@click="card.isFlipped = !card.isFlipped"
|
| 193 |
>
|
| 194 |
+
<div class="card-inner glass-morph rounded-xl">
|
| 195 |
+
<div class="card-face card-front p-6 flex items-start space-x-4">
|
| 196 |
+
<div class="w-12 h-12 flex items-center justify-center rounded-full bg-blue-500/20 text-blue-400 font-bold">
|
| 197 |
+
[[index + 1]]
|
| 198 |
+
</div>
|
| 199 |
+
<div class="flex-1">
|
| 200 |
+
<h3 class="text-xl font-medium">[[card.question]]</h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
</div>
|
| 202 |
</div>
|
| 203 |
+
<div class="card-face card-back p-6 flex items-start space-x-4">
|
| 204 |
+
<div class="w-12 h-12 flex items-center justify-center rounded-full bg-blue-500/20 text-blue-400 font-bold">
|
| 205 |
+
[[index + 1]]
|
| 206 |
+
</div>
|
| 207 |
+
<div class="flex-1">
|
| 208 |
+
<p class="text-gray-300">[[card.answer]]</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
</div>
|
| 210 |
</div>
|
| 211 |
</div>
|
|
|
|
| 223 |
</div>
|
| 224 |
|
| 225 |
<script>
|
| 226 |
+
const { createApp } = Vue
|
| 227 |
+
|
| 228 |
+
createApp({
|
| 229 |
+
delimiters: ['[[', ']]'],
|
| 230 |
+
data() {
|
| 231 |
+
return {
|
| 232 |
+
topic: '',
|
| 233 |
+
flashcards: [],
|
| 234 |
+
activeTab: 'study',
|
| 235 |
+
isLoading: false,
|
| 236 |
+
error: null
|
| 237 |
+
}
|
| 238 |
+
},
|
| 239 |
+
methods: {
|
| 240 |
+
async generateFlashcards() {
|
| 241 |
+
if (!this.topic) {
|
| 242 |
+
this.error = 'Veuillez entrer un sujet.'
|
| 243 |
+
return
|
| 244 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
+
this.isLoading = true
|
| 247 |
+
this.error = null
|
| 248 |
+
this.flashcards = []
|
| 249 |
|
| 250 |
+
try {
|
| 251 |
+
const response = await axios.post('/generate', {
|
| 252 |
+
topic: this.topic
|
| 253 |
+
})
|
| 254 |
|
| 255 |
+
if (response.data.success) {
|
| 256 |
+
const cards = response.data.flashcards.map(card => ({
|
| 257 |
+
...card,
|
| 258 |
+
isFlipped: false
|
| 259 |
+
}))
|
| 260 |
+
|
| 261 |
+
// Animation des cartes à leur apparition
|
| 262 |
+
setTimeout(() => {
|
| 263 |
+
this.flashcards = cards
|
| 264 |
+
this.$nextTick(() => {
|
| 265 |
+
gsap.from('.card-hover', {
|
| 266 |
+
y: 30,
|
| 267 |
+
opacity: 0,
|
| 268 |
+
duration: 0.5,
|
| 269 |
+
stagger: 0.1
|
|
|
|
| 270 |
})
|
| 271 |
+
})
|
| 272 |
+
}, 300)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
}
|
| 274 |
+
} catch (error) {
|
| 275 |
+
this.error = error.response?.data?.error || 'Une erreur est survenue lors de la génération.'
|
| 276 |
+
} finally {
|
| 277 |
+
this.isLoading = false
|
| 278 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
}
|
| 280 |
+
},
|
| 281 |
+
mounted() {
|
| 282 |
+
// Animation du titre à l'entrée
|
| 283 |
+
gsap.from('.gradient-text', {
|
| 284 |
+
y: -50,
|
| 285 |
+
opacity: 0,
|
| 286 |
+
duration: 1,
|
| 287 |
+
ease: 'power3.out'
|
| 288 |
+
})
|
| 289 |
+
}
|
| 290 |
+
}).mount('#app')
|
| 291 |
</script>
|
| 292 |
</body>
|
| 293 |
</html>
|