diff --git a/data/testimonials.json b/data/testimonials.json new file mode 100644 index 0000000..2e7d780 --- /dev/null +++ b/data/testimonials.json @@ -0,0 +1,37 @@ +{ + "testimonials": [ + { + "id": 1, + "quote": "Excellent travail ! Le site a été livré dans les délais avec une qualité irréprochable. Communication fluide tout au long du projet.", + "author_name": "Marie Dupont", + "author_role": "Directrice Marketing", + "author_company": "Entreprise XYZ", + "author_photo": "marie-dupont.webp", + "project_slug": "ecommerce-xyz", + "date": "2025-06-15", + "featured": true + }, + { + "id": 2, + "quote": "Un développeur rigoureux et créatif. Il a su comprendre nos besoins et proposer des solutions adaptées.", + "author_name": "Jean Martin", + "author_role": "CEO", + "author_company": "Startup ABC", + "author_photo": null, + "project_slug": "app-gestion", + "date": "2025-03-20", + "featured": true + }, + { + "id": 3, + "quote": "Travail soigné et professionnel. Je recommande vivement.", + "author_name": "Sophie Leroy", + "author_role": "Gérante", + "author_company": "Restaurant Le Bon Goût", + "author_photo": null, + "project_slug": null, + "date": "2024-11-10", + "featured": false + } + ] +} \ No newline at end of file diff --git a/docs/stories/4.5.section-temoignages.md b/docs/stories/4.5.section-temoignages.md index fd6cd3a..69e710f 100644 --- a/docs/stories/4.5.section-temoignages.md +++ b/docs/stories/4.5.section-temoignages.md @@ -2,7 +2,7 @@ ## Status -Ready for Dev +review ## Story @@ -24,32 +24,32 @@ Ready for Dev ## Tasks / Subtasks -- [] **Task 1 : Créer le fichier testimonials.json** (AC: 1, 2) - - [] Créer `data/testimonials.json` - - [] Définir la structure complète - - [] Ajouter 3 témoignages de test +- [x] **Task 1 : Créer le fichier testimonials.json** (AC: 1, 2) + - [x] Créer `data/testimonials.json` + - [x] Définir la structure complète + - [x] Ajouter 3 témoignages de test -- [] **Task 2 : Créer les fonctions PHP** (AC: 3) - - [] `getTestimonials()` - tous les témoignages - - [] `getFeaturedTestimonials()` - témoignages mis en avant - - [] `getTestimonialByProject($slug)` - témoignage lié à un projet +- [x] **Task 2 : Créer les fonctions PHP** (AC: 3) + - [x] `getTestimonials()` - tous les témoignages + - [x] `getFeaturedTestimonials()` - témoignages mis en avant + - [x] `getTestimonialByProject($slug)` - témoignage lié à un projet -- [] **Task 3 : Créer le template testimonial.php** (AC: 5, 9) - - [] Style citation avec guillemets SVG - - [] Photo de l'auteur (optionnelle, sinon initiale) - - [] Nom, rôle, entreprise +- [x] **Task 3 : Créer le template testimonial.php** (AC: 5, 9) + - [x] Style citation avec guillemets SVG + - [x] Photo de l'auteur (optionnelle, sinon initiale) + - [x] Nom, rôle, entreprise -- [] **Task 4 : Ajouter la section dans about.php** (AC: 4, 8) - - [] Grille de témoignages (1→2→3 colonnes) - - [] Gestion du cas vide (section masquée) +- [x] **Task 4 : Ajouter la section dans about.php** (AC: 4, 8) + - [x] Grille de témoignages (1→2→3 colonnes) + - [x] Gestion du cas vide (section masquée) -- [] **Task 5 : Lien vers le projet** (AC: 6) - - [] Si project_slug existe, afficher le lien - - [] "Voir le projet →" avec icône +- [x] **Task 5 : Lien vers le projet** (AC: 6) + - [x] Si project_slug existe, afficher le lien + - [x] "Voir le projet →" avec icône -- [] **Task 6 : Témoignages sur l'accueil** (AC: 7) - - [] Afficher 2 témoignages featured sur home.php - - [] Lien "Voir tous les témoignages" +- [x] **Task 6 : Témoignages sur l'accueil** (AC: 7) + - [x] Afficher 2 témoignages featured sur home.php + - [x] Lien "Voir tous les témoignages" ## Dev Notes @@ -249,7 +249,7 @@ assets/img/testimonials/ ## Dev Agent Record ### Agent Model Used -Claude Opus 4.5 (claude-opus-4-5-20251101) +GPT-5 Codex ### File List | File | Action | Description | @@ -259,6 +259,8 @@ Claude Opus 4.5 (claude-opus-4-5-20251101) | `templates/testimonial.php` | Created | Template avec guillemets, auteur, lien projet | | `pages/about.php` | Modified | Section "Ce Qu'ils Disent" | | `pages/home.php` | Modified | 2 témoignages featured | +| `tests/testimonials.test.php` | Created | Tests témoignages | +| `tests/run.ps1` | Modified | Ajout tests témoignages | ### Completion Notes - Structure JSON complète : id, quote, author_name, author_role, author_company, author_photo, project_slug, date, featured @@ -268,7 +270,7 @@ Claude Opus 4.5 (claude-opus-4-5-20251101) - Lien vers projet optionnel (paramètre showProjectLink) - Section masquée si JSON vide - 2 témoignages featured sur la home avec lien "Voir tous" -- Note: Les photos peuvent être ajoutées dans `/assets/img/testimonials/` +- Tests: `powershell -ExecutionPolicy Bypass -File tests/run.ps1` ### Debug Log References Aucun problème rencontré. @@ -278,4 +280,4 @@ Aucun problème rencontré. | Date | Version | Description | Author | |------|---------|-------------|--------| | 2026-01-22 | 0.1 | Création initiale | Sarah (PO) | -| 2026-01-23 | 1.0 | Implémentation complète | James (Dev) | +| 2026-02-04 | 1.0 | Implémentation complète | Amelia | diff --git a/includes/functions.php b/includes/functions.php index 095881a..58f4f45 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -150,4 +150,34 @@ function getToolIcon(string $icon): string ]; return $icons[$icon] ?? '🛠'; +} + +/** + * Récupère tous les témoignages + */ +function getTestimonials(): array +{ + $data = loadJsonData('testimonials.json'); + return $data['testimonials'] ?? []; +} + +/** + * Récupère les témoignages mis en avant + */ +function getFeaturedTestimonials(): array +{ + return array_values(array_filter(getTestimonials(), fn($t) => ($t['featured'] ?? false) === true)); +} + +/** + * Récupère le témoignage lié à un projet + */ +function getTestimonialByProject(string $projectSlug): ?array +{ + foreach (getTestimonials() as $testimonial) { + if (($testimonial['project_slug'] ?? '') === $projectSlug) { + return $testimonial; + } + } + return null; } \ No newline at end of file diff --git a/pages/about.php b/pages/about.php index 46ab945..ff52f1c 100644 --- a/pages/about.php +++ b/pages/about.php @@ -196,6 +196,26 @@ include_template('navbar', compact('currentPage')); + + +
+
+
+

Ce Qu'ils Disent

+

+ Retours de clients et collaborateurs. +

+
+ +
+ + $testimonial]); ?> + +
+
+
+ +

Envie d'en savoir plus ?

diff --git a/pages/home.php b/pages/home.php index a927cdb..d64bac5 100644 --- a/pages/home.php +++ b/pages/home.php @@ -9,6 +9,8 @@ $pageTitle = 'Accueil'; $pageDescription = 'Portfolio de développeur web full-stack. Découvrez mes projets, compétences et parcours.'; $currentPage = 'home'; +$featuredTestimonials = array_slice(getFeaturedTestimonials(), 0, 2); + include_template('header', compact('pageTitle', 'pageDescription')); include_template('navbar', compact('currentPage')); ?> @@ -98,6 +100,27 @@ include_template('navbar', compact('currentPage'));
+ + +
+
+
+

Ils m'ont fait confiance

+

Quelques retours de clients et collaborateurs.

+
+ +
+ + $testimonial, 'showProjectLink' => false]); ?> + +
+ + +
+
+ \ No newline at end of file diff --git a/templates/testimonial.php b/templates/testimonial.php new file mode 100644 index 0000000..6273c09 --- /dev/null +++ b/templates/testimonial.php @@ -0,0 +1,61 @@ + + +
+ + + + +

+ "" +

+ + + + + + Voir le projet + + + + + +
\ No newline at end of file diff --git a/tests/run.ps1 b/tests/run.ps1 index d2014c1..6a28d66 100644 --- a/tests/run.ps1 +++ b/tests/run.ps1 @@ -19,4 +19,5 @@ php (Join-Path $here 'skills.test.php') php (Join-Path $here 'tools.test.php') php (Join-Path $here 'about.test.php') php (Join-Path $here 'passions.test.php') +php (Join-Path $here 'testimonials.test.php') 'OK' \ No newline at end of file diff --git a/tests/testimonials.test.php b/tests/testimonials.test.php new file mode 100644 index 0000000..cce2edf --- /dev/null +++ b/tests/testimonials.test.php @@ -0,0 +1,26 @@ +