-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
3916 lines (3339 loc) · 143 KB
/
Copy pathscript.js
File metadata and controls
3916 lines (3339 loc) · 143 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Portfolio de Prince Noukounwoui - Organisé par domaines d'expertise
// Lecture dynamique des données depuis cv.json
// Fonction utilitaire pour générer le chemin des logos
function generateLogoPath(organizationName, type = 'company') {
// Mapping spécifique pour les organisations
const logoMappings = {
'JEEDOM': 'jeedom',
'Université de Rennes 1': 'UniversiteRennes',
'Université de Rennes': 'UniversiteRennes',
'Esmer (École Supérieure des Métiers des Énergies Renouvelables)': 'esmer',
'Université de Franche-Comté': 'universiteMLP',
'ISTIC Rennes': 'istic',
'Qotto': 'qotto',
'Songhaï Centre': 'Logo_Songhaï',
'Victron Energy': 'Victron',
'Victron': 'Victron'
};
// Vérifier d'abord le mapping direct
if (logoMappings[organizationName]) {
return `./assets/logos/${logoMappings[organizationName]}.png`;
}
// Sinon, utiliser la méthode de nettoyage standard
const cleanName = organizationName
.toLowerCase()
.replace(/\s+/g, '-')
.replace(/[^\w-]/g, '')
.replace(/université-de-/g, '')
.replace(/école-supérieure-des-métiers-des-énergies-renouvelables/g, 'esmer');
return `./assets/logos/${cleanName}.png`;
}
// Fonction pour créer un élément logo avec fallback
function createLogoElement(organizationName, type = 'company') {
const logoPath = generateLogoPath(organizationName, type);
const fallbackIcon = type === 'school' ? 'fas fa-graduation-cap' : 'fas fa-building';
return `
<div class="organization-logo">
<img src="${logoPath}" alt="Logo ${organizationName}"
onerror="this.style.display='none'; this.nextElementSibling.style.display='flex'">
<div class="organization-icon ${type}" style="display: none;">
<i class="${fallbackIcon}"></i>
</div>
</div>
`;
}
// Variables globales
let cvData = {};
let DOMAINS = {};
let COMPANY_DOMAINS = {};
let skillIcons = {};
let skillLogos = {};
// Fonction pour charger les données depuis cv.json
async function loadCVData() {
console.log('🔍 Chargement cv.json... Protocol:', window.location.protocol);
const isFileProtocol = window.location.protocol === 'file:';
const paths = ['./cv.json', 'cv.json', '/cv.json'];
if (isFileProtocol) {
console.warn('⚠️ Protocole file:// détecté - fetch peut échouer');
console.warn('⚠️ Utilisez un serveur local: python -m http.server 8000');
}
for (const path of paths) {
try {
const url = isFileProtocol ? path : `${path}?v=${Date.now()}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();
if (!data.nom || !data.projets) {
throw new Error('Données JSON incomplètes');
}
cvData = data;
DOMAINS = data.domains || {};
COMPANY_DOMAINS = data.company_domains || {};
skillIcons = data.skill_icons || {};
skillLogos = data.skill_logos || {};
console.log('✅ Données chargées:', {
projets: cvData.projets.length,
competences: cvData.competences.length,
certifications: cvData.certifications.length,
formation: cvData.formation.length,
experiences: cvData.experiences.length
});
return true;
} catch (error) {
console.warn(`❌ Échec avec ${path}:`, error.message);
}
}
console.error('❌ Impossible de charger cv.json');
// Fallback avec données minimales
cvData = {
nom: "Prince Noukounwoui",
titre: "Étudiant en Master 2 Ingénierie Durable des Bâtiments Communicants Intelligents",
localisation: "Lyon, Auvergne-Rhône-Alpes, France",
coordonnees: {
email: "noukounwouiprince@gmail.com",
telephone: "0612719903",
linkedin: "https://www.linkedin.com/in/prince-noukounwoui-ba1978217",
photo: "./assets/images/profile.jpg"
},
resume: "Portfolio en cours de chargement...",
experiences: [],
projets: [],
competences: [],
formation: [],
certifications: []
};
DOMAINS = {
'iot': {
name: 'IoT & Domotique',
icon: 'fas fa-home',
color: 'rgba(0, 122, 255, 0.8)',
description: 'Smart Home, Smart Building, Smart City',
technologies: ['IoT', 'Domotique', 'Capteurs'],
theme: 'iot'
},
'energy': {
name: 'Énergie & Photovoltaïque',
icon: 'fas fa-solar-panel',
color: 'rgba(255, 204, 0, 0.8)',
description: 'Systèmes solaires, monitoring énergétique',
technologies: ['Photovoltaïque', 'Monitoring'],
theme: 'solar'
},
'electricité': {
name: 'Réseau électrique',
icon: 'fas fa-cogs',
color: 'rgba(175, 82, 222, 0.8)',
description: 'Réseaux électriques, maintenance',
technologies: ['Électrotechnique', 'Maintenance'],
theme: 'network'
}
};
COMPANY_DOMAINS = {};
skillIcons = {};
console.log('🔄 Données de fallback chargées');
return false;
}
let currentDomain = 'iot'; // Domaine par défaut
// Données CV intégrées et prêtes
// Fonction pour calculer la durée totale d'expériences (en mois)
function calculateTotalDurationInMonths(experiences) {
let totalMonths = 0;
experiences.forEach(exp => {
const duration = calculateDurationInMonths(exp.periode);
totalMonths += duration;
});
return totalMonths;
}
// Fonction pour calculer la durée d'une expérience en mois
function calculateDurationInMonths(periode) {
if (!periode) return 0;
const parts = periode.split(' - ');
if (parts.length !== 2) return 0;
const startStr = parts[0].trim();
const endStr = parts[1].trim();
// Mapping des mois français
const monthMap = {
'janvier': 0, 'février': 1, 'mars': 2, 'avril': 3, 'mai': 4, 'juin': 5,
'juillet': 6, 'août': 7, 'septembre': 8, 'octobre': 9, 'novembre': 10, 'décembre': 11
};
function parseDate(dateStr) {
if (dateStr.toLowerCase() === 'présent' || dateStr.toLowerCase() === 'aujourd\'hui') {
return new Date();
}
const parts = dateStr.toLowerCase().split(' ');
if (parts.length >= 2) {
const month = monthMap[parts[0]];
const year = parseInt(parts[1]);
if (month !== undefined && year) {
return new Date(year, month, 1);
}
}
return null;
}
const startDate = parseDate(startStr);
const endDate = parseDate(endStr);
if (!startDate || !endDate) return 0;
const diffInMonths = (endDate.getFullYear() - startDate.getFullYear()) * 12 +
(endDate.getMonth() - startDate.getMonth());
return Math.max(0, diffInMonths);
}
// Fonction pour formater une durée en mois vers texte français
function formatDuration(totalMonths) {
if (totalMonths === 0) return '';
if (totalMonths < 1) return '< 1 mois';
if (totalMonths === 1) return '1 mois';
if (totalMonths < 12) return `${totalMonths} mois`;
const years = Math.floor(totalMonths / 12);
const months = totalMonths % 12;
if (months === 0) {
return years === 1 ? '1 an' : `${years} ans`;
} else {
const yearStr = years === 1 ? '1 an' : `${years} ans`;
const monthStr = months === 1 ? '1 mois' : `${months} mois`;
return `${yearStr} ${monthStr}`;
}
}
// Fonction pour calculer la durée d'une expérience
function calculateDuration(periode) {
const months = calculateDurationInMonths(periode);
return formatDuration(months);
}
// Organiser les expériences par domaines
function organizeExperiencesByDomain() {
if (!cvData?.experiences) return {};
const domainExperiences = {};
// Initialiser tous les domaines
Object.keys(DOMAINS).forEach(domain => {
domainExperiences[domain] = [];
});
// Classer les expériences par domaine
cvData.experiences.forEach(experience => {
const domain = COMPANY_DOMAINS[experience.entreprise];
if (domain && domainExperiences[domain]) {
domainExperiences[domain].push({
...experience,
domain: domain
});
}
});
// Expériences organisées par domaine
return domainExperiences;
}
// Organiser les projets par domaine
function organizeProjectsByDomain() {
if (!cvData?.projets) return {};
const domainProjects = {};
// Initialiser tous les domaines
Object.keys(DOMAINS).forEach(domain => {
domainProjects[domain] = [];
});
// Classer les projets par domaine (basé sur la propriété domain)
cvData.projets.forEach(project => {
// Utiliser la propriété domain du projet si elle existe, sinon iot par défaut
const assignedDomain = project.domain || 'iot';
// Vérifier que le domaine existe dans notre configuration
if (domainProjects[assignedDomain]) {
domainProjects[assignedDomain].push({
...project,
domain: assignedDomain
});
} else {
// Si le domaine n'existe pas, l'ajouter à iot par défaut
domainProjects['iot'].push({
...project,
domain: 'iot'
});
}
});
// Projets organisés par domaine
return domainProjects;
}
// Chargement du DOM
document.addEventListener('DOMContentLoaded', async function() {
console.log('🚀 Démarrage du portfolio...');
try {
// Charger les données depuis cv.json
const dataLoaded = await loadCVData();
if (!dataLoaded) {
console.warn('⚠️ Données chargées en mode fallback');
}
// Vérifier que les données essentielles sont présentes
if (!cvData || !cvData.nom) {
throw new Error('Données CV manquantes ou invalides');
}
console.log('📊 Initialisation des composants...');
// Initialiser les composants de base (qui ne dépendent pas des données)
if (typeof initNavigation === 'function') initNavigation();
if (typeof initEnhancedNavigation === 'function') initEnhancedNavigation();
if (typeof initSmoothScroll === 'function') initSmoothScroll();
if (typeof createScrollIndicator === 'function') createScrollIndicator();
if (typeof initCustomCursor === 'function') initCustomCursor();
// Remplir le contenu (dépend des données)
console.log('📝 Remplissage du contenu...');
if (typeof populateContent === 'function') {
populateContent();
} else {
console.warn('⚠️ Fonction populateContent non trouvée');
}
// Initialiser les fonctionnalités avancées
console.log('⚙️ Initialisation des fonctionnalités...');
if (typeof initDomainNavigation === 'function') initDomainNavigation();
if (typeof initScrollAnimations === 'function') initScrollAnimations();
if (typeof initSmoothScrolling === 'function') initSmoothScrolling();
if (typeof initMessaging === 'function') initMessaging();
if (typeof initCalendlyListeners === 'function') initCalendlyListeners();
// Initialiser l'arrière-plan IoT après que tout soit chargé
setTimeout(() => {
if (typeof initIoTBackground === 'function') {
initIoTBackground();
}
}, 1000);
// Mettre à jour les effets de survol après le chargement du contenu
setTimeout(() => {
if (typeof updateHoverEffects === 'function') {
updateHoverEffects();
}
}, 1500);
console.log('✅ Portfolio initialisé avec succès');
} catch (error) {
console.error('❌ Erreur lors de l\'initialisation du portfolio:', error);
// Afficher un message d'erreur à l'utilisateur
document.body.innerHTML = `
<div style="padding: 20px; text-align: center; color: red;">
<h2>Erreur de chargement</h2>
<p>Une erreur s'est produite lors du chargement du portfolio.</p>
<p>Détails: ${error.message}</p>
</div>
`;
}
});
// Remplir le contenu de la page
function populateContent() {
// Remplissage du contenu
// Informations personnelles
populatePersonalInfo();
// Organiser les données par domaines
const domainExperiences = organizeExperiencesByDomain();
const domainProjects = organizeProjectsByDomain();
// Remplir les sections
populateAboutSection();
populateDomainCards(domainExperiences, domainProjects);
populateSkillsByDomain();
populateProjects();
populateFormation();
populateCertifications();
// Contenu rempli avec succès
}
// Remplir les informations personnelles
function populatePersonalInfo() {
// Titre et nom
const nomElement = document.getElementById('nom-titre');
const titreElement = document.getElementById('titre-professionnel');
const localisationElement = document.getElementById('localisation');
if (nomElement) nomElement.textContent = cvData.nom;
if (titreElement) titreElement.textContent = cvData.titre;
if (localisationElement) localisationElement.textContent = `📍 ${cvData.localisation}`;
// Photo de profil
const profilePhoto = document.getElementById('profile-photo');
if (profilePhoto && cvData.coordonnees?.photo) {
profilePhoto.src = cvData.coordonnees.photo;
profilePhoto.alt = cvData.nom;
profilePhoto.onerror = function() {
console.warn('⚠️ Photo non trouvée, affichage de l\'icône par défaut');
this.style.display = 'none';
const iconElement = this.parentElement.querySelector('i');
if (iconElement) iconElement.style.display = 'block';
};
}
// Informations de contact
const emailElement = document.getElementById('email-contact');
const phoneElement = document.getElementById('telephone-contact');
const linkedinElement = document.getElementById('linkedin-contact');
if (emailElement && cvData.coordonnees?.email) {
emailElement.textContent = cvData.coordonnees.email;
}
if (phoneElement && cvData.coordonnees?.telephone) {
phoneElement.textContent = cvData.coordonnees.telephone;
}
if (linkedinElement && cvData.coordonnees?.linkedin) {
linkedinElement.href = cvData.coordonnees.linkedin;
linkedinElement.textContent = 'LinkedIn';
}
// Démarrer les animations du hero
initTypewriterEffect();
animateHeroStats();
// Informations personnelles remplies
}
// Animation de frappe (typewriter) avec curseur qui suit
function initTypewriterEffect() {
const specialties = [
'IoT & Domotique',
'Smart Buildings',
'Énergie Renouvelable',
'Systèmes Électriques',
'LoRaWAN & ZigBee',
'Photovoltaïque'
];
const typewriterElement = document.getElementById('typewriter-text');
const cursorElement = document.querySelector('.cursor');
if (!typewriterElement) return;
// Cacher le curseur fixe s'il existe
if (cursorElement) {
cursorElement.style.display = 'none';
}
let currentTextIndex = 0;
let currentCharIndex = 0;
let isDeleting = false;
let isPaused = false;
function updateDisplay() {
const currentText = specialties[currentTextIndex];
const displayText = currentText.substring(0, currentCharIndex);
// Intégrer le curseur directement dans le texte
if (isPaused) {
// Curseur clignotant à la fin du texte complet
typewriterElement.innerHTML = `${displayText}<span class="typing-cursor blink">|</span>`;
} else {
// Curseur fixe pendant la frappe/effacement
typewriterElement.innerHTML = `${displayText}<span class="typing-cursor">|</span>`;
}
}
function type() {
const currentText = specialties[currentTextIndex];
if (!isDeleting && currentCharIndex <= currentText.length) {
// Écriture
updateDisplay();
currentCharIndex++;
if (currentCharIndex > currentText.length) {
// Fin d'écriture - pause avec curseur clignotant
isPaused = true;
updateDisplay();
setTimeout(() => {
isPaused = false;
isDeleting = true;
type();
}, 2000); // Pause de 2 secondes
return;
}
} else if (isDeleting && currentCharIndex >= 0) {
// Suppression
updateDisplay();
currentCharIndex--;
if (currentCharIndex < 0) {
isDeleting = false;
currentTextIndex = (currentTextIndex + 1) % specialties.length;
currentCharIndex = 0;
// Petite pause avant de commencer le mot suivant
setTimeout(() => {
type();
}, 500);
return;
}
}
if (!isPaused) {
const typingSpeed = isDeleting ? 50 : 120;
setTimeout(type, typingSpeed);
}
}
// Démarrer l'animation après un délai
setTimeout(() => {
type();
}, 1500);
}
// Animer les statistiques du hero
function animateHeroStats() {
// Calculer les années d'expérience basées sur le cumul des expériences
const totalMonths = calculateTotalDurationInMonths(cvData.experiences || []);
const yearsExperience = Math.ceil(totalMonths / 12); // Arrondi à la valeur supérieure
const stats = {
'years-experience': yearsExperience,
'projects-count': cvData.projets?.length || 0,
'domains-count': 3 // IoT, Énergie, electricité
};
Object.entries(stats).forEach(([id, target]) => {
const element = document.getElementById(id);
if (!element) return;
let current = 0;
const increment = target / 30; // 30 frames pour l'animation
const animate = () => {
current += increment;
if (current >= target) {
element.textContent = target;
} else {
element.textContent = Math.floor(current);
requestAnimationFrame(animate);
}
};
// Démarrer avec un délai
setTimeout(animate, 1500);
});
}
// Remplir la section À propos
function populateAboutSection() {
const resumeText = document.getElementById('resume-text');
if (resumeText && cvData.resume) {
resumeText.textContent = cvData.resume;
}
// Statistiques (calculées automatiquement)
const stats = calculateStats();
updateStatsDisplay(stats);
// Section À propos remplie
}
// Calculer les statistiques
function calculateStats() {
// Calculer les années d'expérience basées sur le cumul des expériences
const totalMonths = calculateTotalDurationInMonths(cvData.experiences || []);
const yearsExperience = Math.ceil(totalMonths / 12); // Arrondi à la valeur supérieure
return {
experience: yearsExperience,
projets: cvData.projets?.length || 0,
competences: cvData.competences?.length || 0,
certifications: cvData.certifications?.length || 0
};
}
// Mettre à jour l'affichage des statistiques avec animation
function updateStatsDisplay(stats) {
const statsData = [
stats.experience,
stats.projets,
stats.competences,
stats.certifications
];
// Mettre à jour les targets des éléments animés
const animatedStats = document.querySelectorAll('.animated-stat');
animatedStats.forEach((element, index) => {
if (statsData[index] !== undefined) {
element.setAttribute('data-target', statsData[index]);
}
});
// Démarrer l'animation des compteurs
animateCounters();
}
// Animation des compteurs
function animateCounters() {
const counters = document.querySelectorAll('.animated-stat');
const observerOptions = {
threshold: 0.3,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting && !entry.target.classList.contains('animated')) {
entry.target.classList.add('animated');
animateCounter(entry.target);
}
});
}, observerOptions);
counters.forEach(counter => {
observer.observe(counter);
});
}
// Animer un compteur spécifique
function animateCounter(element) {
const target = parseInt(element.getAttribute('data-target'));
const numberElement = element.querySelector('.stat-number');
const duration = 2000; // 2 secondes
const start = 0;
const increment = target / (duration / 16); // 60 FPS
let current = start;
const timer = setInterval(() => {
current += increment;
if (current >= target) {
numberElement.textContent = target;
clearInterval(timer);
// Ajouter une animation de pulse à la fin
element.classList.add('stat-completed');
} else {
numberElement.textContent = Math.floor(current);
}
}, 16);
}
// Initialiser les animations de scroll
function initScrollAnimations() {
// Attendre que tous les éléments soient créés
setTimeout(() => {
// Observer pour les éléments à animer au scroll
const elementsToAnimate = document.querySelectorAll('.skills-grid:not(.skills-orbit-layout) .skill-item, .projects-grid .project-card, .certifications-grid .certification-item, .education-timeline .education-item, .cards-grid .domain-card');
console.log('🎬 Elements trouvés pour animation:', elementsToAnimate.length);
if (elementsToAnimate.length === 0) {
console.log('⚠️ Aucun élément trouvé, réessai dans 500ms...');
setTimeout(() => initScrollAnimations(), 500);
return;
}
const observerOptions = {
threshold: 0.2,
rootMargin: '0px 0px -50px 0px'
};
const scrollObserver = new IntersectionObserver((entries) => {
entries.forEach((entry, index) => {
if (entry.isIntersecting && !entry.target.classList.contains('animated')) {
// Délai progressif pour un effet de cascade
setTimeout(() => {
entry.target.classList.add('slide-in-up', 'animated');
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}, index * 100);
}
});
}, observerOptions);
elementsToAnimate.forEach(element => {
// État initial pour l'animation
element.style.opacity = '0';
element.style.transform = 'translateY(30px)';
element.style.transition = 'all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1)';
scrollObserver.observe(element);
});
// Animation des barres de progression pour les compétences
const skillBars = document.querySelectorAll('.skill-level');
skillBars.forEach(bar => {
scrollObserver.observe(bar.parentElement);
bar.parentElement.addEventListener('animationstart', () => {
const level = bar.getAttribute('data-level') || '80';
setTimeout(() => {
bar.style.width = level + '%';
}, 300);
});
});
// Forcer l'initialisation des animations pour les éléments déjà visibles
setTimeout(() => {
forceVisibleAnimations();
}, 100);
}, 300); // Fermer le setTimeout principal
}
// Forcer les animations pour les éléments déjà visibles
function forceVisibleAnimations() {
const elementsToCheck = document.querySelectorAll('.skills-grid:not(.skills-orbit-layout) .skill-item, .projects-grid .project-card, .certifications-grid .certification-item, .education-timeline .education-item, .cards-grid .domain-card');
elementsToCheck.forEach((element, index) => {
if (!element.classList.contains('animated')) {
const rect = element.getBoundingClientRect();
const isVisible = rect.top < window.innerHeight && rect.bottom > 0;
if (isVisible) {
setTimeout(() => {
element.classList.add('slide-in-up', 'animated');
element.style.opacity = '1';
element.style.transform = 'translateY(0)';
}, index * 50);
}
}
});
}
// Remplir les cartes des domaines
function populateDomainCards(domainExperiences, domainProjects) {
const container = document.querySelector('#experiences .cards-grid');
if (!container) return;
container.innerHTML = '';
Object.entries(DOMAINS).forEach(([domainKey, domain]) => {
const experiences = domainExperiences[domainKey] || [];
const projects = domainProjects[domainKey] || [];
// Calculer la durée totale d'expérience pour ce domaine
const totalMonths = calculateTotalDurationInMonths(experiences);
const totalDuration = formatDuration(totalMonths);
const card = document.createElement('div');
card.className = 'card domain-card';
card.dataset.domain = domainKey;
card.innerHTML = `
<div class="domain-header">
<div class="domain-icon">
<i class="${domain.icon}"></i>
</div>
<div class="domain-info">
<h3>${domain.name}</h3>
<p>${domain.description}</p>
</div>
</div>
<div class="domain-stats">
<div class="domain-stat">
<span class="stat-number">${experiences.length}</span>
<span class="stat-label">Expérience${experiences.length > 1 ? 's' : ''}</span>
</div>
<div class="domain-stat">
<span class="stat-number">${projects.length}</span>
<span class="stat-label">Projet${projects.length > 1 ? 's' : ''}</span>
</div>
${totalDuration ? `
<div class="domain-stat">
<span class="stat-number"><i class="fas fa-clock" style="color: var(--primary-color);"></i></span>
<span class="stat-label">${totalDuration}</span>
</div>` : ''}
</div>
<div class="domain-technologies">
${(domain.technologies || []).map(tech =>
`<span class="tech-tag">${tech}</span>`
).join('')}
</div>
<div class="domain-actions">
<button class="btn btn-secondary btn-explore" data-domain="${domainKey}">
<i class="fas fa-search"></i>
Explorer ce domaine
</button>
</div>
`;
container.appendChild(card);
});
// Cartes des domaines créées
}
// Explorer un domaine spécifique
function exploreDomain(domainKey) {
if (!domainKey || !DOMAINS[domainKey]) return;
currentDomain = domainKey;
const domain = DOMAINS[domainKey];
// Changer le thème d'arrière-plan
if (window.changeBackgroundTheme) {
window.changeBackgroundTheme(domain.theme);
}
// Ouvrir le panel du domaine
openDomainPanel(domainKey);
}
// Ouvrir le panel d'un domaine
function openDomainPanel(domainKey) {
const domain = DOMAINS[domainKey];
if (!domain) return;
const domainExperiences = organizeExperiencesByDomain()[domainKey] || [];
const domainProjects = organizeProjectsByDomain()[domainKey] || [];
const panel = document.getElementById('domain-side-panel');
if (!panel) return;
// Remplir le contenu du panel
document.getElementById('panel-domain-icon').className = domain.icon;
document.getElementById('panel-domain-name').textContent = domain.name;
document.getElementById('panel-domain-description').textContent = domain.description;
// Technologies
const technologiesContainer = document.getElementById('panel-technologies');
technologiesContainer.innerHTML = (domain.technologies || []).map(tech =>
`<div class="tech-item">${tech}</div>`
).join('');
// Expériences
const experiencesContainer = document.getElementById('panel-experiences');
if (domainExperiences.length > 0) {
experiencesContainer.innerHTML = domainExperiences.map(exp => {
const duration = calculateDuration(exp.periode);
return `
<div class="panel-experience-item">
<div class="panel-item-header">
<div>
<div class="panel-item-title">${exp.poste}</div>
<div class="panel-item-company">
${createLogoElement(exp.entreprise, 'company')}
${exp.entreprise} - ${exp.lieu}
</div>
</div>
<div class="panel-item-period">${duration || exp.periode}</div>
</div>
<ul class="experience-missions">
${exp.missions.map(mission => `<li>${mission}</li>`).join('')}
</ul>
</div>
`;
}).join('');
document.querySelector('#panel-experiences').parentElement.style.display = 'block';
} else {
document.querySelector('#panel-experiences').parentElement.style.display = 'none';
}
// Projets
const projectsContainer = document.getElementById('panel-projects');
if (domainProjects.length > 0) {
projectsContainer.innerHTML = domainProjects.map(project => {
const orgType = project.organisation.toLowerCase().includes('université') ||
project.organisation.toLowerCase().includes('école') ||
project.organisation.toLowerCase().includes('esmer') ? 'school' : 'company';
return `
<div class="panel-project-item">
<div class="panel-item-header">
<div>
<div class="panel-item-title">${project.nom}</div>
<div class="panel-item-company">
${project.organisation !== 'Projet personnel' ? createLogoElement(project.organisation, orgType) : ''}
${project.organisation}
</div>
</div>
<div class="panel-item-period">${project.statut}</div>
</div>
<div class="panel-item-description">${project.description}</div>
<div class="panel-skills">
${project.competences.map(skill =>
`<span class="panel-skill-tag">${skill}</span>`
).join('')}
</div>
</div>
`;
}).join('');
document.querySelector('#panel-projects').parentElement.style.display = 'block';
} else {
document.querySelector('#panel-projects').parentElement.style.display = 'none';
}
// Ajouter les événements de fermeture
const overlay = panel.querySelector('.side-panel-overlay');
const closeBtn = panel.querySelector('.panel-close');
// Nettoyer les anciens event listeners
if (overlay) {
overlay.removeEventListener('click', closeDomainPanel);
overlay.addEventListener('click', closeDomainPanel);
}
if (closeBtn) {
closeBtn.removeEventListener('click', closeDomainPanel);
closeBtn.addEventListener('click', closeDomainPanel);
}
// Échapper pour fermer
const escapeHandler = function(e) {
if (e.key === 'Escape') {
closeDomainPanel();
document.removeEventListener('keydown', escapeHandler);
}
};
document.addEventListener('keydown', escapeHandler);
// Afficher le panel
panel.classList.add('active');
document.body.style.overflow = 'hidden';
}
// Fermer le panel de domaine
function closeDomainPanel() {
const panel = document.getElementById('domain-side-panel');
if (panel) {
panel.classList.remove('active');
}
document.body.style.overflow = 'auto';
// Retour au thème IoT par défaut
if (window.changeBackgroundTheme) {
window.changeBackgroundTheme('iot');
}
}
// Remplir les compétences par domaine
function buildSkillWheel() {
const wrapper = document.getElementById('skillwheel-wrapper');
const ring = document.getElementById('skillwheel-ring');
const activeArc = document.getElementById('skillwheel-active-arc');
const domainsEl = document.getElementById('skillwheel-domains');
const calloutsEl = document.getElementById('skillwheel-callouts');
const detailsEl = document.getElementById('skillwheel-details');
if (!wrapper || !ring || !domainsEl || !detailsEl) return false;
const data = window.SkillSphereData || null;
const domains = [];
const skillsByDomain = {};
const domainMap = {};
let skillLogoMap = {};
if (data && data.domains && data.skills) {
Object.keys(data.domains).forEach((id) => {
const d = data.domains[id];
const entry = {
id,
name: d.name,
color: d.color,
description: d.description || '',
logo: data.domainLogos ? data.domainLogos[id] : null,
};
domains.push(entry);
domainMap[id] = entry;
skillsByDomain[id] = [];
});
skillLogoMap = data.skillLogos || {};
data.skills.forEach((skill) => {
if (!skillsByDomain[skill.domain]) {
skillsByDomain[skill.domain] = [];
}
skillsByDomain[skill.domain].push({
id: skill.id,
label: skill.label,
logo: skillLogoMap[skill.id] || null,
});
});
} else if (cvData.domains) {
Object.keys(cvData.domains).forEach((id) => {
const d = cvData.domains[id];
const entry = {
id,
name: d.name,