✨ feat(frontend): système narrateur contextuel avec arc de révélation
Story 3.3 : Textes narrateur contextuels et arc de révélation - Composable useNarrator.ts avec queue de messages prioritaires - Composable useIdleDetection.ts (détection inactivité 30s) - Plugin narrator-transitions.client.ts (déclencheurs de navigation) - Layout adventure.vue avec NarratorBubble intégré - Store progression: narratorStage devient un getter calculé (0-20-40-60-80%) - Pages projets, competences, temoignages, parcours utilisent layout adventure - Messages: intro, transitions, encouragements 25/50/75%, hints, contact_unlocked Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
42
frontend/app/plugins/narrator-transitions.client.ts
Normal file
42
frontend/app/plugins/narrator-transitions.client.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
export default defineNuxtPlugin(() => {
|
||||
const narrator = useNarrator()
|
||||
const router = useRouter()
|
||||
const progressionStore = useProgressionStore()
|
||||
|
||||
const routeContextMap: Record<string, 'projects' | 'skills' | 'testimonials' | 'journey'> = {
|
||||
'/projets': 'projects',
|
||||
'/en/projects': 'projects',
|
||||
'/competences': 'skills',
|
||||
'/en/skills': 'skills',
|
||||
'/temoignages': 'testimonials',
|
||||
'/en/testimonials': 'testimonials',
|
||||
'/parcours': 'journey',
|
||||
'/en/journey': 'journey',
|
||||
}
|
||||
|
||||
const announcedSections = new Set<string>()
|
||||
|
||||
router.afterEach((to) => {
|
||||
const zone = routeContextMap[to.path]
|
||||
if (zone && !announcedSections.has(zone)) {
|
||||
announcedSections.add(zone)
|
||||
narrator.showTransition(zone)
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => progressionStore.completionPercent,
|
||||
(percent) => {
|
||||
narrator.showEncouragement(percent)
|
||||
},
|
||||
)
|
||||
|
||||
watch(
|
||||
() => progressionStore.contactUnlocked,
|
||||
(unlocked, wasUnlocked) => {
|
||||
if (unlocked && !wasUnlocked) {
|
||||
narrator.showContactUnlocked()
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user