✨ Add testimonials page with personality-styled cards (Story 2.6)
- Add testimonials table migration with personality enum - Create Testimonial model with HasTranslations trait - Add TestimonialSeeder with 4 test testimonials - Create TestimonialController and TestimonialResource - Add useFetchTestimonials composable - Create TestimonialCard component with personality-based styling - Add temoignages.vue page with loading/error states - Add testimonials translations in FR/EN Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
21
api/app/Http/Controllers/Api/TestimonialController.php
Normal file
21
api/app/Http/Controllers/Api/TestimonialController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\TestimonialResource;
|
||||
use App\Models\Testimonial;
|
||||
|
||||
class TestimonialController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$testimonials = Testimonial::with('project')
|
||||
->active()
|
||||
->ordered()
|
||||
->get();
|
||||
|
||||
return TestimonialResource::collection($testimonials)
|
||||
->additional(['meta' => ['lang' => app()->getLocale()]]);
|
||||
}
|
||||
}
|
||||
30
api/app/Http/Resources/TestimonialResource.php
Normal file
30
api/app/Http/Resources/TestimonialResource.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class TestimonialResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'role' => $this->role,
|
||||
'company' => $this->company,
|
||||
'avatar' => $this->avatar,
|
||||
'text' => $this->getTranslated('text_key'),
|
||||
'personality' => $this->personality,
|
||||
'display_order' => $this->display_order,
|
||||
'project' => $this->whenLoaded('project', function () {
|
||||
return $this->project ? [
|
||||
'id' => $this->project->id,
|
||||
'slug' => $this->project->slug,
|
||||
'title' => $this->project->getTranslated('title_key'),
|
||||
] : null;
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
44
api/app/Models/Testimonial.php
Normal file
44
api/app/Models/Testimonial.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\HasTranslations;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Testimonial extends Model
|
||||
{
|
||||
use HasTranslations;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'role',
|
||||
'company',
|
||||
'avatar',
|
||||
'text_key',
|
||||
'personality',
|
||||
'project_id',
|
||||
'display_order',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function project(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
|
||||
public function scopeActive(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
|
||||
public function scopeOrdered(Builder $query): Builder
|
||||
{
|
||||
return $query->orderBy('display_order');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('testimonials', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('role');
|
||||
$table->string('company')->nullable();
|
||||
$table->string('avatar')->nullable();
|
||||
$table->string('text_key');
|
||||
$table->enum('personality', ['sage', 'sarcastique', 'enthousiaste', 'professionnel'])->default('professionnel');
|
||||
$table->foreignId('project_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->integer('display_order')->default(0);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('display_order');
|
||||
$table->index('is_active');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('testimonials');
|
||||
}
|
||||
};
|
||||
@@ -16,6 +16,7 @@ class DatabaseSeeder extends Seeder
|
||||
SkillSeeder::class,
|
||||
ProjectSeeder::class,
|
||||
SkillProjectSeeder::class,
|
||||
TestimonialSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
95
api/database/seeders/TestimonialSeeder.php
Normal file
95
api/database/seeders/TestimonialSeeder.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Testimonial;
|
||||
use App\Models\Translation;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class TestimonialSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$testimonials = [
|
||||
[
|
||||
'name' => 'Marie Dupont',
|
||||
'role' => 'CTO',
|
||||
'company' => 'TechStartup',
|
||||
'avatar' => null,
|
||||
'text_key' => 'testimonial.marie.text',
|
||||
'personality' => 'enthousiaste',
|
||||
'project_id' => 1,
|
||||
'display_order' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Pierre Martin',
|
||||
'role' => 'Lead Developer',
|
||||
'company' => 'DevAgency',
|
||||
'avatar' => null,
|
||||
'text_key' => 'testimonial.pierre.text',
|
||||
'personality' => 'professionnel',
|
||||
'project_id' => 2,
|
||||
'display_order' => 2,
|
||||
],
|
||||
[
|
||||
'name' => 'Sophie Bernard',
|
||||
'role' => 'Product Manager',
|
||||
'company' => 'InnovateCorp',
|
||||
'avatar' => null,
|
||||
'text_key' => 'testimonial.sophie.text',
|
||||
'personality' => 'sage',
|
||||
'project_id' => null,
|
||||
'display_order' => 3,
|
||||
],
|
||||
[
|
||||
'name' => 'Thomas Leroy',
|
||||
'role' => 'Freelance Designer',
|
||||
'company' => null,
|
||||
'avatar' => null,
|
||||
'text_key' => 'testimonial.thomas.text',
|
||||
'personality' => 'sarcastique',
|
||||
'project_id' => null,
|
||||
'display_order' => 4,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($testimonials as $data) {
|
||||
Testimonial::create($data);
|
||||
}
|
||||
|
||||
// Traductions
|
||||
$translations = [
|
||||
[
|
||||
'key' => 'testimonial.marie.text',
|
||||
'fr' => "Travailler avec Célian a été une révélation ! Son approche créative et sa maîtrise technique ont transformé notre projet. Je recommande sans hésitation !",
|
||||
'en' => "Working with Célian was a revelation! His creative approach and technical mastery transformed our project. I highly recommend!",
|
||||
],
|
||||
[
|
||||
'key' => 'testimonial.pierre.text',
|
||||
'fr' => "Code propre, architecture solide, communication claire. Célian sait exactement ce qu'il fait et le fait bien.",
|
||||
'en' => "Clean code, solid architecture, clear communication. Célian knows exactly what he's doing and does it well.",
|
||||
],
|
||||
[
|
||||
'key' => 'testimonial.sophie.text',
|
||||
'fr' => "Une personne rare qui combine vision produit et excellence technique. Les retours utilisateurs parlent d'eux-mêmes.",
|
||||
'en' => "A rare person who combines product vision and technical excellence. User feedback speaks for itself.",
|
||||
],
|
||||
[
|
||||
'key' => 'testimonial.thomas.text',
|
||||
'fr' => "Bon, j'avoue, au début je pensais que les devs ne comprenaient rien au design. Célian m'a prouvé le contraire. Presque agaçant.",
|
||||
'en' => "Okay, I admit, at first I thought devs didn't understand design. Célian proved me wrong. Almost annoying.",
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($translations as $t) {
|
||||
Translation::updateOrCreate(
|
||||
['lang' => 'fr', 'key_name' => $t['key']],
|
||||
['value' => $t['fr']]
|
||||
);
|
||||
Translation::updateOrCreate(
|
||||
['lang' => 'en', 'key_name' => $t['key']],
|
||||
['value' => $t['en']]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use App\Http\Controllers\Api\ProjectController;
|
||||
use App\Http\Controllers\Api\SkillController;
|
||||
use App\Http\Controllers\Api\TestimonialController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/health', function () {
|
||||
@@ -12,3 +13,4 @@ Route::get('/projects', [ProjectController::class, 'index']);
|
||||
Route::get('/projects/{slug}', [ProjectController::class, 'show']);
|
||||
Route::get('/skills', [SkillController::class, 'index']);
|
||||
Route::get('/skills/{slug}/projects', [SkillController::class, 'projects']);
|
||||
Route::get('/testimonials', [TestimonialController::class, 'index']);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Story 2.6: Page Témoignages et migrations BDD
|
||||
|
||||
Status: ready-for-dev
|
||||
Status: review
|
||||
|
||||
## Story
|
||||
|
||||
@@ -22,73 +22,73 @@ so that j'ai une validation sociale de ses compétences.
|
||||
|
||||
## Tasks / Subtasks
|
||||
|
||||
- [ ] **Task 1: Créer la migration table testimonials** (AC: #1)
|
||||
- [ ] Créer migration `create_testimonials_table`
|
||||
- [ ] Colonnes : id, name, role, company, avatar, text_key, personality (ENUM: sage, sarcastique, enthousiaste, professionnel), project_id (FK nullable), display_order, is_active (boolean), timestamps
|
||||
- [ ] Foreign key project_id → projects.id (nullable, ON DELETE SET NULL)
|
||||
- [ ] Index sur display_order pour le tri
|
||||
- [ ] Index sur is_active pour le filtrage
|
||||
- [x] **Task 1: Créer la migration table testimonials** (AC: #1)
|
||||
- [x] Créer migration `create_testimonials_table`
|
||||
- [x] Colonnes : id, name, role, company, avatar, text_key, personality (ENUM: sage, sarcastique, enthousiaste, professionnel), project_id (FK nullable), display_order, is_active (boolean), timestamps
|
||||
- [x] Foreign key project_id → projects.id (nullable, ON DELETE SET NULL)
|
||||
- [x] Index sur display_order pour le tri
|
||||
- [x] Index sur is_active pour le filtrage
|
||||
|
||||
- [ ] **Task 2: Créer le Model Testimonial** (AC: #1)
|
||||
- [ ] Créer `app/Models/Testimonial.php`
|
||||
- [ ] Définir les fillable : name, role, company, avatar, text_key, personality, project_id, display_order, is_active
|
||||
- [ ] Casts : is_active → boolean
|
||||
- [ ] Relation `project()` : belongsTo(Project::class)
|
||||
- [ ] Scope `scopeActive($query)` pour filtrer les actifs
|
||||
- [ ] Scope `scopeOrdered($query)` pour le tri
|
||||
- [x] **Task 2: Créer le Model Testimonial** (AC: #1)
|
||||
- [x] Créer `app/Models/Testimonial.php`
|
||||
- [x] Définir les fillable : name, role, company, avatar, text_key, personality, project_id, display_order, is_active
|
||||
- [x] Casts : is_active → boolean
|
||||
- [x] Relation `project()` : belongsTo(Project::class)
|
||||
- [x] Scope `scopeActive($query)` pour filtrer les actifs
|
||||
- [x] Scope `scopeOrdered($query)` pour le tri
|
||||
|
||||
- [ ] **Task 3: Créer le Seeder des témoignages** (AC: #2)
|
||||
- [ ] Créer `database/seeders/TestimonialSeeder.php`
|
||||
- [ ] Ajouter 4-5 témoignages de test avec différentes personnalités
|
||||
- [ ] Ajouter les traductions FR et EN dans TranslationSeeder
|
||||
- [ ] Lier certains témoignages à des projets existants
|
||||
- [ ] Mettre à jour `DatabaseSeeder.php`
|
||||
- [x] **Task 3: Créer le Seeder des témoignages** (AC: #2)
|
||||
- [x] Créer `database/seeders/TestimonialSeeder.php`
|
||||
- [x] Ajouter 4-5 témoignages de test avec différentes personnalités
|
||||
- [x] Ajouter les traductions FR et EN dans TranslationSeeder
|
||||
- [x] Lier certains témoignages à des projets existants
|
||||
- [x] Mettre à jour `DatabaseSeeder.php`
|
||||
|
||||
- [ ] **Task 4: Créer l'endpoint API testimonials** (AC: #3, #4, #6, #7)
|
||||
- [ ] Créer `app/Http/Controllers/Api/TestimonialController.php`
|
||||
- [ ] Méthode `index()` pour lister les témoignages actifs
|
||||
- [ ] Créer `app/Http/Resources/TestimonialResource.php`
|
||||
- [ ] Inclure le projet lié (si existe) avec titre traduit
|
||||
- [ ] Trier par display_order
|
||||
- [ ] Ajouter la route `GET /api/testimonials`
|
||||
- [x] **Task 4: Créer l'endpoint API testimonials** (AC: #3, #4, #6, #7)
|
||||
- [x] Créer `app/Http/Controllers/Api/TestimonialController.php`
|
||||
- [x] Méthode `index()` pour lister les témoignages actifs
|
||||
- [x] Créer `app/Http/Resources/TestimonialResource.php`
|
||||
- [x] Inclure le projet lié (si existe) avec titre traduit
|
||||
- [x] Trier par display_order
|
||||
- [x] Ajouter la route `GET /api/testimonials`
|
||||
|
||||
- [ ] **Task 5: Créer le composable useFetchTestimonials** (AC: #3)
|
||||
- [ ] Créer `frontend/app/composables/useFetchTestimonials.ts`
|
||||
- [ ] Typer la réponse avec interface Testimonial[]
|
||||
- [x] **Task 5: Créer le composable useFetchTestimonials** (AC: #3)
|
||||
- [x] Créer `frontend/app/composables/useFetchTestimonials.ts`
|
||||
- [x] Typer la réponse avec interface Testimonial[]
|
||||
|
||||
- [ ] **Task 6: Créer la page temoignages.vue** (AC: #3, #4, #5, #8)
|
||||
- [ ] Créer `frontend/app/pages/temoignages.vue`
|
||||
- [ ] Charger les données avec le composable
|
||||
- [ ] Afficher chaque témoignage comme une card
|
||||
- [ ] Appliquer un style visuel selon la personnalité
|
||||
- [ ] Préparer l'emplacement pour DialoguePNJ
|
||||
- [x] **Task 6: Créer la page temoignages.vue** (AC: #3, #4, #5, #8)
|
||||
- [x] Créer `frontend/app/pages/temoignages.vue`
|
||||
- [x] Charger les données avec le composable
|
||||
- [x] Afficher chaque témoignage comme une card
|
||||
- [x] Appliquer un style visuel selon la personnalité
|
||||
- [x] Préparer l'emplacement pour DialoguePNJ
|
||||
|
||||
- [ ] **Task 7: Créer le composant TestimonialCard** (AC: #4, #5, #6)
|
||||
- [ ] Créer `frontend/app/components/feature/TestimonialCard.vue`
|
||||
- [ ] Props : testimonial (avec name, role, company, avatar, text, personality, project)
|
||||
- [ ] Afficher l'avatar, le nom, le rôle, l'entreprise
|
||||
- [ ] Afficher le texte du témoignage
|
||||
- [ ] Style de bulle selon la personnalité
|
||||
- [ ] Lien vers le projet si présent
|
||||
- [x] **Task 7: Créer le composant TestimonialCard** (AC: #4, #5, #6)
|
||||
- [x] Créer `frontend/app/components/feature/TestimonialCard.vue`
|
||||
- [x] Props : testimonial (avec name, role, company, avatar, text, personality, project)
|
||||
- [x] Afficher l'avatar, le nom, le rôle, l'entreprise
|
||||
- [x] Afficher le texte du témoignage
|
||||
- [x] Style de bulle selon la personnalité
|
||||
- [x] Lien vers le projet si présent
|
||||
|
||||
- [ ] **Task 8: Styles visuels par personnalité** (AC: #5)
|
||||
- [ ] Définir 4 styles de bulles/cards selon personality :
|
||||
- sage : style calme, bordure subtile
|
||||
- sarcastique : style décalé, accent différent
|
||||
- enthousiaste : style vif, couleurs plus marquées
|
||||
- professionnel : style sobre, formel
|
||||
- [ ] Classes CSS ou Tailwind variants
|
||||
- [x] **Task 8: Styles visuels par personnalité** (AC: #5)
|
||||
- [x] Définir 4 styles de bulles/cards selon personality :
|
||||
- sage : style calme, bordure subtile (emerald)
|
||||
- sarcastique : style décalé, accent différent (purple)
|
||||
- enthousiaste : style vif, couleurs plus marquées (amber)
|
||||
- professionnel : style sobre, formel (sky)
|
||||
- [x] Classes CSS ou Tailwind variants
|
||||
|
||||
- [ ] **Task 9: Meta tags SEO** (AC: #9)
|
||||
- [ ] Titre : "Témoignages | Skycel"
|
||||
- [ ] Description dynamique
|
||||
- [x] **Task 9: Meta tags SEO** (AC: #9)
|
||||
- [x] Titre : "Témoignages | Skycel"
|
||||
- [x] Description dynamique
|
||||
|
||||
- [ ] **Task 10: Tests et validation**
|
||||
- [ ] Exécuter les migrations
|
||||
- [ ] Vérifier le seeding des données
|
||||
- [ ] Tester l'API en FR et EN
|
||||
- [ ] Valider l'affichage de la page
|
||||
- [ ] Vérifier les liens vers projets
|
||||
- [x] **Task 10: Tests et validation**
|
||||
- [x] Exécuter les migrations
|
||||
- [x] Vérifier le seeding des données
|
||||
- [x] Tester l'API en FR et EN
|
||||
- [x] Valider l'affichage de la page
|
||||
- [x] Vérifier les liens vers projets
|
||||
|
||||
## Dev Notes
|
||||
|
||||
@@ -655,6 +655,7 @@ frontend/app/
|
||||
| Date | Change | Author |
|
||||
|------|--------|--------|
|
||||
| 2026-02-04 | Story créée avec contexte complet | SM Agent |
|
||||
| 2026-02-06 | Implémentation complète: migration, model, seeder, API, frontend | Claude Opus 4.5 |
|
||||
|
||||
### File List
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ development_status:
|
||||
2-3-page-projet-detail: review
|
||||
2-4-page-competences-affichage-categories: review
|
||||
2-5-competences-cliquables-projets-lies: review
|
||||
2-6-page-temoignages-migrations-bdd: ready-for-dev
|
||||
2-6-page-temoignages-migrations-bdd: review
|
||||
2-7-composant-dialogue-pnj: ready-for-dev
|
||||
2-8-page-parcours-timeline-narrative: ready-for-dev
|
||||
epic-2-retrospective: optional
|
||||
|
||||
126
frontend/app/components/feature/TestimonialCard.vue
Normal file
126
frontend/app/components/feature/TestimonialCard.vue
Normal file
@@ -0,0 +1,126 @@
|
||||
<script setup lang="ts">
|
||||
import type { Testimonial, PersonalityType } from '~/types/testimonial'
|
||||
|
||||
interface Props {
|
||||
testimonial: Testimonial
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const personalityConfig: Record<PersonalityType, { border: string; avatar: string; badge: string; icon: string }> = {
|
||||
sage: {
|
||||
border: 'border-emerald-500/30',
|
||||
avatar: 'ring-emerald-500',
|
||||
badge: 'bg-emerald-500/20 text-emerald-400',
|
||||
icon: '🧙',
|
||||
},
|
||||
sarcastique: {
|
||||
border: 'border-purple-500/30',
|
||||
avatar: 'ring-purple-500',
|
||||
badge: 'bg-purple-500/20 text-purple-400',
|
||||
icon: '😏',
|
||||
},
|
||||
enthousiaste: {
|
||||
border: 'border-amber-500/30',
|
||||
avatar: 'ring-amber-500',
|
||||
badge: 'bg-amber-500/20 text-amber-400',
|
||||
icon: '🎉',
|
||||
},
|
||||
professionnel: {
|
||||
border: 'border-sky-500/30',
|
||||
avatar: 'ring-sky-500',
|
||||
badge: 'bg-sky-500/20 text-sky-400',
|
||||
icon: '💼',
|
||||
},
|
||||
}
|
||||
|
||||
const config = computed(() => personalityConfig[props.testimonial.personality])
|
||||
|
||||
const initials = computed(() => {
|
||||
const names = props.testimonial.name.split(' ')
|
||||
return names.map(n => n[0]).join('').toUpperCase().slice(0, 2)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<article
|
||||
class="testimonial-card group relative rounded-xl border bg-sky-dark/50 p-6 transition-all duration-300 hover:bg-sky-dark/70"
|
||||
:class="config.border"
|
||||
>
|
||||
<!-- Personality badge -->
|
||||
<span
|
||||
class="absolute right-4 top-4 rounded-full px-2 py-1 text-xs font-medium"
|
||||
:class="config.badge"
|
||||
>
|
||||
{{ config.icon }} {{ testimonial.personality }}
|
||||
</span>
|
||||
|
||||
<!-- Quote icon -->
|
||||
<div class="mb-4 text-4xl text-sky-500/30">"</div>
|
||||
|
||||
<!-- Testimonial text -->
|
||||
<blockquote class="mb-6 text-lg italic text-gray-300 leading-relaxed">
|
||||
{{ testimonial.text }}
|
||||
</blockquote>
|
||||
|
||||
<!-- Author info -->
|
||||
<footer class="flex items-center gap-4">
|
||||
<!-- Avatar -->
|
||||
<div
|
||||
v-if="testimonial.avatar"
|
||||
class="h-12 w-12 overflow-hidden rounded-full ring-2"
|
||||
:class="config.avatar"
|
||||
>
|
||||
<img
|
||||
:src="testimonial.avatar"
|
||||
:alt="testimonial.name"
|
||||
class="h-full w-full object-cover"
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="flex h-12 w-12 items-center justify-center rounded-full bg-sky-dark ring-2 text-sm font-bold text-sky-400"
|
||||
:class="config.avatar"
|
||||
>
|
||||
{{ initials }}
|
||||
</div>
|
||||
|
||||
<!-- Name and role -->
|
||||
<div class="flex-1">
|
||||
<cite class="block font-semibold text-white not-italic">
|
||||
{{ testimonial.name }}
|
||||
</cite>
|
||||
<div class="text-sm text-gray-400">
|
||||
{{ testimonial.role }}
|
||||
<template v-if="testimonial.company">
|
||||
· {{ testimonial.company }}
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Project link if available -->
|
||||
<NuxtLink
|
||||
v-if="testimonial.project"
|
||||
:to="`/projets/${testimonial.project.slug}`"
|
||||
class="mt-4 inline-flex items-center gap-2 text-sm text-sky-400 transition-colors hover:text-sky-300"
|
||||
>
|
||||
<span>📁</span>
|
||||
<span>{{ testimonial.project.title }}</span>
|
||||
<span class="transition-transform group-hover:translate-x-1">→</span>
|
||||
</NuxtLink>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.testimonial-card {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.testimonial-card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 10px 40px rgba(14, 165, 233, 0.1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
15
frontend/app/composables/useFetchTestimonials.ts
Normal file
15
frontend/app/composables/useFetchTestimonials.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { TestimonialsResponse } from '~/types/testimonial'
|
||||
|
||||
export function useFetchTestimonials() {
|
||||
const config = useRuntimeConfig()
|
||||
const { locale } = useI18n()
|
||||
|
||||
return useFetch<TestimonialsResponse>('/testimonials', {
|
||||
baseURL: config.public.apiUrl as string,
|
||||
headers: {
|
||||
'X-API-Key': config.public.apiKey as string,
|
||||
'Accept-Language': locale.value,
|
||||
},
|
||||
transform: (response) => response,
|
||||
})
|
||||
}
|
||||
@@ -1,16 +1,128 @@
|
||||
<template>
|
||||
<div class="min-h-screen p-8">
|
||||
<h1 class="text-3xl font-narrative text-sky-text">{{ $t('pages.testimonials.title') }}</h1>
|
||||
<p class="mt-4 text-sky-text/70">{{ $t('pages.testimonials.description') }}</p>
|
||||
<div class="min-h-screen">
|
||||
<!-- Hero section -->
|
||||
<section class="relative overflow-hidden bg-gradient-to-b from-sky-dark to-sky-darker py-16">
|
||||
<div class="container mx-auto px-4">
|
||||
<h1 class="text-center text-4xl font-narrative font-bold text-white md:text-5xl">
|
||||
{{ $t('testimonials.page_title') }}
|
||||
</h1>
|
||||
<p class="mx-auto mt-4 max-w-2xl text-center text-lg text-gray-400">
|
||||
{{ $t('testimonials.page_description') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Decorative elements -->
|
||||
<div class="absolute -left-20 top-20 h-40 w-40 rounded-full bg-sky-500/5 blur-3xl" />
|
||||
<div class="absolute -right-20 bottom-10 h-60 w-60 rounded-full bg-purple-500/5 blur-3xl" />
|
||||
</section>
|
||||
|
||||
<!-- Testimonials grid -->
|
||||
<section class="container mx-auto px-4 py-12">
|
||||
<!-- Loading state -->
|
||||
<div v-if="status === 'pending'" class="grid gap-6 md:grid-cols-2">
|
||||
<div
|
||||
v-for="i in 4"
|
||||
:key="i"
|
||||
class="h-64 animate-pulse rounded-xl bg-sky-dark/50"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Error state -->
|
||||
<div
|
||||
v-else-if="error"
|
||||
class="mx-auto max-w-md rounded-xl bg-red-500/10 p-8 text-center"
|
||||
>
|
||||
<span class="text-4xl">🕷️</span>
|
||||
<h2 class="mt-4 text-xl font-semibold text-red-400">
|
||||
{{ $t('testimonials.load_error') }}
|
||||
</h2>
|
||||
<button
|
||||
class="mt-4 rounded-lg bg-red-500/20 px-4 py-2 text-red-400 transition-colors hover:bg-red-500/30"
|
||||
@click="refresh()"
|
||||
>
|
||||
{{ $t('common.retry') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Empty state -->
|
||||
<div
|
||||
v-else-if="!testimonials.length"
|
||||
class="mx-auto max-w-md rounded-xl bg-sky-dark/50 p-8 text-center"
|
||||
>
|
||||
<span class="text-4xl">💬</span>
|
||||
<h2 class="mt-4 text-xl font-semibold text-gray-300">
|
||||
{{ $t('testimonials.no_testimonials') }}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<!-- Testimonials -->
|
||||
<div v-else class="grid gap-6 md:grid-cols-2">
|
||||
<TestimonialCard
|
||||
v-for="testimonial in testimonials"
|
||||
:key="testimonial.id"
|
||||
:testimonial="testimonial"
|
||||
class="testimonial-enter"
|
||||
:style="{ animationDelay: `${testimonial.display_order * 100}ms` }"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- CTA section -->
|
||||
<section class="container mx-auto px-4 pb-16">
|
||||
<div class="rounded-xl bg-gradient-to-r from-sky-500/10 to-purple-500/10 p-8 text-center">
|
||||
<h2 class="text-2xl font-semibold text-white">
|
||||
{{ $t('testimonials.cta_title') }}
|
||||
</h2>
|
||||
<p class="mt-2 text-gray-400">
|
||||
{{ $t('testimonials.cta_description') }}
|
||||
</p>
|
||||
<NuxtLink
|
||||
to="/contact"
|
||||
class="mt-4 inline-block rounded-lg bg-sky-500 px-6 py-3 font-medium text-white transition-colors hover:bg-sky-400"
|
||||
>
|
||||
{{ $t('testimonials.cta_button') }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Testimonial } from '~/types/testimonial'
|
||||
|
||||
const { setPageMeta } = useSeo()
|
||||
const { t } = useI18n()
|
||||
const progressStore = useProgressStore()
|
||||
|
||||
setPageMeta({
|
||||
title: t('pages.testimonials.title'),
|
||||
description: t('pages.testimonials.description'),
|
||||
title: t('testimonials.page_title'),
|
||||
description: t('testimonials.page_description'),
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
progressStore.visitSection('testimonials')
|
||||
})
|
||||
|
||||
const { data, status, error, refresh } = await useFetchTestimonials()
|
||||
|
||||
const testimonials = computed<Testimonial[]>(() => data.value?.data ?? [])
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.testimonial-enter {
|
||||
animation: testimonial-fade-in 0.5s ease-out both;
|
||||
}
|
||||
|
||||
@keyframes testimonial-fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
22
frontend/app/types/testimonial.ts
Normal file
22
frontend/app/types/testimonial.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export type PersonalityType = 'sage' | 'sarcastique' | 'enthousiaste' | 'professionnel'
|
||||
|
||||
export interface Testimonial {
|
||||
id: number
|
||||
name: string
|
||||
role: string
|
||||
company: string | null
|
||||
avatar: string | null
|
||||
text: string
|
||||
personality: PersonalityType
|
||||
display_order: number
|
||||
project?: {
|
||||
id: number
|
||||
slug: string
|
||||
title: string
|
||||
} | null
|
||||
}
|
||||
|
||||
export interface TestimonialsResponse {
|
||||
data: Testimonial[]
|
||||
meta: { lang: string }
|
||||
}
|
||||
@@ -108,6 +108,15 @@
|
||||
"load_projects_error": "Unable to load related projects",
|
||||
"no_related_projects": "No projects use this skill yet"
|
||||
},
|
||||
"testimonials": {
|
||||
"page_title": "Testimonials | Skycel",
|
||||
"page_description": "Discover what my collaborators and clients say about my work.",
|
||||
"load_error": "Unable to load testimonials...",
|
||||
"no_testimonials": "No testimonials yet",
|
||||
"cta_title": "Want to work together?",
|
||||
"cta_description": "Let's discuss your project and see how I can help.",
|
||||
"cta_button": "Contact me"
|
||||
},
|
||||
"pages": {
|
||||
"projects": {
|
||||
"title": "Projects",
|
||||
|
||||
@@ -108,6 +108,15 @@
|
||||
"load_projects_error": "Impossible de charger les projets li\u00e9s",
|
||||
"no_related_projects": "Aucun projet n'utilise encore cette comp\u00e9tence"
|
||||
},
|
||||
"testimonials": {
|
||||
"page_title": "T\u00e9moignages | Skycel",
|
||||
"page_description": "D\u00e9couvrez ce que disent mes collaborateurs et clients de mon travail.",
|
||||
"load_error": "Impossible de charger les t\u00e9moignages...",
|
||||
"no_testimonials": "Aucun t\u00e9moignage pour le moment",
|
||||
"cta_title": "Envie de travailler ensemble ?",
|
||||
"cta_description": "Discutons de votre projet et voyons comment je peux vous aider.",
|
||||
"cta_button": "Me contacter"
|
||||
},
|
||||
"pages": {
|
||||
"projects": {
|
||||
"title": "Projets",
|
||||
|
||||
Reference in New Issue
Block a user