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>
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
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()
|
|
}
|
|
},
|
|
)
|
|
})
|