Fix: Correction critique de la boucle OAuth - Empêcher les échanges multiples du code
PROBLÈME RÉSOLU: - Erreur "Code already used" répétée dans les logs Keycloak - Boucle infinie de tentatives d'échange du code d'autorisation OAuth - Utilisateurs bloqués à la connexion CORRECTIONS APPLIQUÉES: 1. Ajout de useRef pour protéger contre les exécutions multiples - hasExchanged.current: Flag pour prévenir les réexécutions - isProcessing.current: Protection pendant le traitement 2. Modification des dépendances useEffect - AVANT: [searchParams, router] → exécution à chaque changement - APRÈS: [] → exécution unique au montage du composant 3. Amélioration du logging - Console logs pour debug OAuth flow - Messages emoji pour faciliter le suivi 4. Nettoyage de l'URL - window.history.replaceState() pour retirer les paramètres OAuth - Évite les re-renders causés par les paramètres dans l'URL 5. Gestion d'erreurs améliorée - Capture des erreurs JSON du serveur - Messages d'erreur plus explicites FICHIERS AJOUTÉS: - app/(main)/aide/* - 4 pages du module Aide (documentation, tutoriels, support) - app/(main)/messages/* - 4 pages du module Messages (inbox, envoyés, archives) - app/auth/callback/page.tsx.backup - Sauvegarde avant modification IMPACT: ✅ Un seul échange de code par authentification ✅ Plus d'erreur "Code already used" ✅ Connexion fluide et sans boucle ✅ Logs propres et lisibles 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
241
app/(main)/aide/documentation/page.tsx
Normal file
241
app/(main)/aide/documentation/page.tsx
Normal file
@@ -0,0 +1,241 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import {
|
||||
BookOpen,
|
||||
Search,
|
||||
ChevronRight,
|
||||
FileText,
|
||||
Download,
|
||||
ExternalLink,
|
||||
ArrowLeft,
|
||||
} from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
/**
|
||||
* Page de documentation
|
||||
* Guides complets et documentation technique
|
||||
*/
|
||||
export default function DocumentationPage() {
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [selectedCategory, setSelectedCategory] = useState<string | null>(null);
|
||||
|
||||
const categories = [
|
||||
{
|
||||
id: "getting-started",
|
||||
title: "Démarrage",
|
||||
description: "Premiers pas avec BTPXpress",
|
||||
articles: [
|
||||
"Installation et configuration",
|
||||
"Créer votre premier chantier",
|
||||
"Comprendre l'interface",
|
||||
"Configuration du profil entreprise",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "chantiers",
|
||||
title: "Gestion des chantiers",
|
||||
description: "Tout sur la gestion des chantiers",
|
||||
articles: [
|
||||
"Créer un nouveau chantier",
|
||||
"Gérer les phases de chantier",
|
||||
"Suivi en temps réel",
|
||||
"Clôturer un chantier",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "factures",
|
||||
title: "Facturation",
|
||||
description: "Devis, factures et paiements",
|
||||
articles: [
|
||||
"Créer un devis",
|
||||
"Convertir un devis en facture",
|
||||
"Gérer les paiements",
|
||||
"Relances automatiques",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "equipes",
|
||||
title: "Équipes et planning",
|
||||
description: "Gérer vos équipes",
|
||||
articles: [
|
||||
"Créer une équipe",
|
||||
"Affecter des employés",
|
||||
"Planifier les interventions",
|
||||
"Gérer les disponibilités",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "materiel",
|
||||
title: "Matériel",
|
||||
description: "Gestion du matériel BTP",
|
||||
articles: [
|
||||
"Ajouter du matériel",
|
||||
"Planifier l'utilisation",
|
||||
"Maintenance préventive",
|
||||
"Historique d'utilisation",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rapports",
|
||||
title: "Rapports et analyses",
|
||||
description: "Générer des rapports",
|
||||
articles: [
|
||||
"Rapports d'activité",
|
||||
"Analyse financière",
|
||||
"Rapports personnalisés",
|
||||
"Export des données",
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const filteredCategories = selectedCategory
|
||||
? categories.filter((cat) => cat.id === selectedCategory)
|
||||
: categories;
|
||||
|
||||
const allArticles = categories.flatMap((cat) =>
|
||||
cat.articles.map((article) => ({ category: cat.title, article }))
|
||||
);
|
||||
|
||||
const searchResults = searchTerm
|
||||
? allArticles.filter((item) =>
|
||||
item.article.toLowerCase().includes(searchTerm.toLowerCase())
|
||||
)
|
||||
: [];
|
||||
|
||||
return (
|
||||
<div className="space-y-6 p-6">
|
||||
{/* En-tête */}
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-4">
|
||||
<Link href="/aide">
|
||||
<Button variant="ghost" size="sm">
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
Retour à l'aide
|
||||
</Button>
|
||||
</Link>
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-gray-900">Documentation</h1>
|
||||
<p className="text-gray-500 mt-1">
|
||||
Guides complets et documentation technique
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Button variant="outline">
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
Télécharger PDF
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Barre de recherche */}
|
||||
<Card className="p-4">
|
||||
<div className="relative">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" />
|
||||
<Input
|
||||
placeholder="Rechercher dans la documentation..."
|
||||
className="pl-10"
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Résultats de recherche */}
|
||||
{searchTerm && searchResults.length > 0 && (
|
||||
<div className="mt-4 border-t pt-4">
|
||||
<p className="text-sm text-gray-600 mb-3">
|
||||
{searchResults.length} résultat{searchResults.length > 1 ? "s" : ""}{" "}
|
||||
trouvé{searchResults.length > 1 ? "s" : ""}
|
||||
</p>
|
||||
<div className="space-y-2">
|
||||
{searchResults.map((result, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="p-3 hover:bg-gray-50 rounded cursor-pointer flex items-center justify-between"
|
||||
>
|
||||
<div>
|
||||
<p className="font-medium">{result.article}</p>
|
||||
<p className="text-sm text-gray-500">{result.category}</p>
|
||||
</div>
|
||||
<ChevronRight className="h-4 w-4 text-gray-400" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
|
||||
{/* Catégories de documentation */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{filteredCategories.map((category) => (
|
||||
<Card
|
||||
key={category.id}
|
||||
className="p-6 hover:shadow-lg transition-shadow"
|
||||
>
|
||||
<div className="flex items-start gap-4 mb-4">
|
||||
<div className="p-3 bg-blue-100 rounded-lg">
|
||||
<BookOpen className="h-6 w-6 text-blue-600" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-lg mb-1">{category.title}</h3>
|
||||
<p className="text-sm text-gray-600">{category.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{category.articles.map((article, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="flex items-center gap-2 p-2 hover:bg-gray-50 rounded cursor-pointer group"
|
||||
>
|
||||
<FileText className="h-4 w-4 text-gray-400" />
|
||||
<span className="text-sm flex-1">{article}</span>
|
||||
<ExternalLink className="h-3 w-3 text-gray-400 opacity-0 group-hover:opacity-100 transition-opacity" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<Button
|
||||
variant="link"
|
||||
className="mt-4 p-0 h-auto text-blue-600"
|
||||
onClick={() => setSelectedCategory(category.id)}
|
||||
>
|
||||
Voir tous les articles
|
||||
<ChevronRight className="ml-1 h-4 w-4" />
|
||||
</Button>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Guides de démarrage rapide */}
|
||||
<Card className="p-6 bg-gradient-to-r from-blue-50 to-purple-50">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="p-3 bg-blue-600 rounded-lg">
|
||||
<BookOpen className="h-6 w-6 text-white" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-lg mb-2">
|
||||
Guide de démarrage rapide
|
||||
</h3>
|
||||
<p className="text-sm text-gray-700 mb-4">
|
||||
Téléchargez notre guide PDF complet pour démarrer rapidement avec
|
||||
BTPXpress. Il contient tous les concepts essentiels et les meilleures
|
||||
pratiques.
|
||||
</p>
|
||||
<div className="flex gap-3">
|
||||
<Button className="bg-blue-600 hover:bg-blue-700">
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
Télécharger le guide (PDF)
|
||||
</Button>
|
||||
<Button variant="outline">
|
||||
Voir la version en ligne
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
226
app/(main)/aide/page.tsx
Normal file
226
app/(main)/aide/page.tsx
Normal file
@@ -0,0 +1,226 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import {
|
||||
BookOpen,
|
||||
Video,
|
||||
MessageCircle,
|
||||
Search,
|
||||
FileText,
|
||||
HelpCircle,
|
||||
Lightbulb,
|
||||
Phone,
|
||||
Mail,
|
||||
ExternalLink,
|
||||
} from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
/**
|
||||
* Page principale du centre d'aide
|
||||
* Point d'entrée pour accéder à toute l'aide et la documentation
|
||||
*/
|
||||
export default function AidePage() {
|
||||
const categories = [
|
||||
{
|
||||
title: "Démarrage rapide",
|
||||
description: "Premiers pas avec BTPXpress",
|
||||
icon: Lightbulb,
|
||||
color: "bg-blue-100 text-blue-600",
|
||||
articles: 12,
|
||||
},
|
||||
{
|
||||
title: "Gestion des chantiers",
|
||||
description: "Créer et gérer vos chantiers",
|
||||
icon: FileText,
|
||||
color: "bg-green-100 text-green-600",
|
||||
articles: 25,
|
||||
},
|
||||
{
|
||||
title: "Facturation",
|
||||
description: "Devis, factures et paiements",
|
||||
icon: BookOpen,
|
||||
color: "bg-purple-100 text-purple-600",
|
||||
articles: 18,
|
||||
},
|
||||
{
|
||||
title: "Équipes et planning",
|
||||
description: "Gérer vos équipes et plannings",
|
||||
icon: Video,
|
||||
color: "bg-orange-100 text-orange-600",
|
||||
articles: 15,
|
||||
},
|
||||
];
|
||||
|
||||
const articlesPopulaires = [
|
||||
"Comment créer un nouveau chantier ?",
|
||||
"Gérer les devis et les factures",
|
||||
"Planifier l'utilisation du matériel",
|
||||
"Ajouter des membres à une équipe",
|
||||
"Générer des rapports d'activité",
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="space-y-8 p-6">
|
||||
{/* En-tête */}
|
||||
<div className="text-center space-y-4">
|
||||
<h1 className="text-4xl font-bold text-gray-900">
|
||||
Comment pouvons-nous vous aider ?
|
||||
</h1>
|
||||
<p className="text-lg text-gray-600">
|
||||
Recherchez dans notre base de connaissances ou contactez notre support
|
||||
</p>
|
||||
<div className="max-w-2xl mx-auto">
|
||||
<div className="relative">
|
||||
<Search className="absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400" />
|
||||
<Input
|
||||
placeholder="Rechercher dans l'aide..."
|
||||
className="pl-12 h-12 text-lg"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Accès rapide */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<Link href="/aide/documentation">
|
||||
<Card className="p-6 hover:shadow-lg transition-shadow cursor-pointer">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="p-3 bg-blue-100 rounded-lg">
|
||||
<BookOpen className="h-6 w-6 text-blue-600" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-lg mb-2">Documentation</h3>
|
||||
<p className="text-sm text-gray-600">
|
||||
Guides complets et documentation technique
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Link>
|
||||
|
||||
<Link href="/aide/tutoriels">
|
||||
<Card className="p-6 hover:shadow-lg transition-shadow cursor-pointer">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="p-3 bg-green-100 rounded-lg">
|
||||
<Video className="h-6 w-6 text-green-600" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-lg mb-2">Tutoriels</h3>
|
||||
<p className="text-sm text-gray-600">
|
||||
Vidéos et guides pas-à-pas
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Link>
|
||||
|
||||
<Link href="/aide/support">
|
||||
<Card className="p-6 hover:shadow-lg transition-shadow cursor-pointer">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="p-3 bg-purple-100 rounded-lg">
|
||||
<MessageCircle className="h-6 w-6 text-purple-600" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-lg mb-2">Support</h3>
|
||||
<p className="text-sm text-gray-600">
|
||||
Contactez notre équipe d'assistance
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
{/* Catégories populaires */}
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold text-gray-900 mb-6">
|
||||
Catégories populaires
|
||||
</h2>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
{categories.map((category) => (
|
||||
<Card
|
||||
key={category.title}
|
||||
className="p-6 hover:shadow-lg transition-shadow cursor-pointer"
|
||||
>
|
||||
<div className={`p-3 ${category.color} rounded-lg w-fit mb-4`}>
|
||||
<category.icon className="h-6 w-6" />
|
||||
</div>
|
||||
<h3 className="font-semibold text-lg mb-2">{category.title}</h3>
|
||||
<p className="text-sm text-gray-600 mb-4">{category.description}</p>
|
||||
<p className="text-sm text-blue-600 font-medium">
|
||||
{category.articles} articles
|
||||
</p>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Articles populaires */}
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold text-gray-900 mb-6">
|
||||
Articles populaires
|
||||
</h2>
|
||||
<Card>
|
||||
<div className="divide-y">
|
||||
{articlesPopulaires.map((article, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="p-4 hover:bg-gray-50 cursor-pointer flex items-center justify-between group"
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<HelpCircle className="h-5 w-5 text-gray-400" />
|
||||
<span className="text-gray-900">{article}</span>
|
||||
</div>
|
||||
<ExternalLink className="h-4 w-4 text-gray-400 opacity-0 group-hover:opacity-100 transition-opacity" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* Contact direct */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<Card className="p-6 bg-blue-50 border-blue-200">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="p-3 bg-blue-600 rounded-lg">
|
||||
<Phone className="h-6 w-6 text-white" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-lg mb-2 text-blue-900">
|
||||
Support téléphonique
|
||||
</h3>
|
||||
<p className="text-sm text-blue-700 mb-3">
|
||||
Disponible du lundi au vendredi de 9h à 18h
|
||||
</p>
|
||||
<Button className="bg-blue-600 hover:bg-blue-700">
|
||||
+33 1 23 45 67 89
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card className="p-6 bg-green-50 border-green-200">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="p-3 bg-green-600 rounded-lg">
|
||||
<Mail className="h-6 w-6 text-white" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-lg mb-2 text-green-900">
|
||||
Support par email
|
||||
</h3>
|
||||
<p className="text-sm text-green-700 mb-3">
|
||||
Réponse sous 24h ouvrées
|
||||
</p>
|
||||
<Button className="bg-green-600 hover:bg-green-700">
|
||||
support@btpxpress.fr
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
348
app/(main)/aide/support/page.tsx
Normal file
348
app/(main)/aide/support/page.tsx
Normal file
@@ -0,0 +1,348 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import {
|
||||
MessageCircle,
|
||||
Phone,
|
||||
Mail,
|
||||
Clock,
|
||||
CheckCircle,
|
||||
AlertCircle,
|
||||
Send,
|
||||
ArrowLeft,
|
||||
Headphones,
|
||||
} from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
/**
|
||||
* Page de support technique
|
||||
* Formulaire de contact et informations de support
|
||||
*/
|
||||
export default function SupportPage() {
|
||||
const router = useRouter();
|
||||
const [formData, setFormData] = useState({
|
||||
nom: "",
|
||||
email: "",
|
||||
sujet: "",
|
||||
priorite: "normale",
|
||||
message: "",
|
||||
});
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
const handleChange = (
|
||||
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>
|
||||
) => {
|
||||
setFormData({
|
||||
...formData,
|
||||
[e.target.name]: e.target.value,
|
||||
});
|
||||
};
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setIsSubmitting(true);
|
||||
|
||||
// Simuler l'envoi
|
||||
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||
|
||||
alert("Ticket de support créé avec succès ! Notre équipe vous contactera bientôt.");
|
||||
router.push("/aide");
|
||||
};
|
||||
|
||||
const ticketsRecents = [
|
||||
{
|
||||
id: "#2024-1234",
|
||||
sujet: "Problème d'accès au dashboard",
|
||||
status: "resolved",
|
||||
date: "2025-10-28",
|
||||
},
|
||||
{
|
||||
id: "#2024-1189",
|
||||
sujet: "Question sur la facturation",
|
||||
status: "in-progress",
|
||||
date: "2025-10-25",
|
||||
},
|
||||
];
|
||||
|
||||
const getStatusBadge = (status: string) => {
|
||||
switch (status) {
|
||||
case "resolved":
|
||||
return (
|
||||
<Badge className="bg-green-100 text-green-800">
|
||||
<CheckCircle className="h-3 w-3 mr-1" />
|
||||
Résolu
|
||||
</Badge>
|
||||
);
|
||||
case "in-progress":
|
||||
return (
|
||||
<Badge className="bg-blue-100 text-blue-800">
|
||||
<Clock className="h-3 w-3 mr-1" />
|
||||
En cours
|
||||
</Badge>
|
||||
);
|
||||
default:
|
||||
return <Badge>Nouveau</Badge>;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-6 p-6">
|
||||
{/* En-tête */}
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-4">
|
||||
<Link href="/aide">
|
||||
<Button variant="ghost" size="sm">
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
Retour à l'aide
|
||||
</Button>
|
||||
</Link>
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-gray-900">Support technique</h1>
|
||||
<p className="text-gray-500 mt-1">
|
||||
Contactez notre équipe d'assistance
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
{/* Formulaire de contact */}
|
||||
<div className="lg:col-span-2 space-y-6">
|
||||
<Card className="p-6">
|
||||
<h2 className="text-xl font-semibold mb-6">Créer un ticket de support</h2>
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<Label htmlFor="nom">Nom complet *</Label>
|
||||
<Input
|
||||
id="nom"
|
||||
name="nom"
|
||||
type="text"
|
||||
placeholder="Votre nom"
|
||||
value={formData.nom}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="mt-2"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="email">Email *</Label>
|
||||
<Input
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
placeholder="votre@email.com"
|
||||
value={formData.email}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="mt-2"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="sujet">Sujet *</Label>
|
||||
<Input
|
||||
id="sujet"
|
||||
name="sujet"
|
||||
type="text"
|
||||
placeholder="Résumé de votre demande"
|
||||
value={formData.sujet}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="mt-2"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="priorite">Priorité</Label>
|
||||
<select
|
||||
id="priorite"
|
||||
name="priorite"
|
||||
value={formData.priorite}
|
||||
onChange={handleChange}
|
||||
className="mt-2 w-full border border-gray-300 rounded-md p-2"
|
||||
>
|
||||
<option value="basse">Basse</option>
|
||||
<option value="normale">Normale</option>
|
||||
<option value="haute">Haute</option>
|
||||
<option value="urgente">Urgente</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="message">Description du problème *</Label>
|
||||
<Textarea
|
||||
id="message"
|
||||
name="message"
|
||||
placeholder="Décrivez votre problème en détail..."
|
||||
value={formData.message}
|
||||
onChange={handleChange}
|
||||
required
|
||||
rows={8}
|
||||
className="mt-2"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-full bg-blue-600 hover:bg-blue-700"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
<Send className="mr-2 h-4 w-4" />
|
||||
{isSubmitting ? "Envoi en cours..." : "Envoyer le ticket"}
|
||||
</Button>
|
||||
</form>
|
||||
</Card>
|
||||
|
||||
{/* Tickets récents */}
|
||||
{ticketsRecents.length > 0 && (
|
||||
<Card className="p-6">
|
||||
<h2 className="text-xl font-semibold mb-4">Vos tickets récents</h2>
|
||||
<div className="space-y-3">
|
||||
{ticketsRecents.map((ticket) => (
|
||||
<div
|
||||
key={ticket.id}
|
||||
className="flex items-center justify-between p-3 bg-gray-50 rounded hover:bg-gray-100 cursor-pointer"
|
||||
>
|
||||
<div className="flex-1">
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="font-mono text-sm text-gray-600">
|
||||
{ticket.id}
|
||||
</span>
|
||||
{getStatusBadge(ticket.status)}
|
||||
</div>
|
||||
<p className="font-medium mt-1">{ticket.sujet}</p>
|
||||
<p className="text-sm text-gray-500">
|
||||
Créé le{" "}
|
||||
{new Date(ticket.date).toLocaleDateString("fr-FR", {
|
||||
day: "2-digit",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Sidebar - Informations de contact */}
|
||||
<div className="space-y-6">
|
||||
{/* Horaires de support */}
|
||||
<Card className="p-6">
|
||||
<div className="flex items-center gap-3 mb-4">
|
||||
<div className="p-3 bg-blue-100 rounded-lg">
|
||||
<Headphones className="h-6 w-6 text-blue-600" />
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-semibold">Support disponible</h3>
|
||||
<p className="text-sm text-gray-600">Lundi - Vendredi</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3 text-sm">
|
||||
<div className="flex items-center gap-2">
|
||||
<Clock className="h-4 w-4 text-gray-400" />
|
||||
<span>9h00 - 18h00 (CET)</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-500">
|
||||
Temps de réponse moyen : 2-4 heures pendant les horaires d'ouverture
|
||||
</p>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* Contact téléphonique */}
|
||||
<Card className="p-6 bg-blue-50 border-blue-200">
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="p-3 bg-blue-600 rounded-lg">
|
||||
<Phone className="h-5 w-5 text-white" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-blue-900 mb-1">
|
||||
Support téléphonique
|
||||
</h3>
|
||||
<p className="text-sm text-blue-700 mb-2">
|
||||
Pour une assistance immédiate
|
||||
</p>
|
||||
<Button
|
||||
variant="default"
|
||||
size="sm"
|
||||
className="bg-blue-600 hover:bg-blue-700 w-full"
|
||||
>
|
||||
+33 1 23 45 67 89
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* Contact email */}
|
||||
<Card className="p-6 bg-green-50 border-green-200">
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="p-3 bg-green-600 rounded-lg">
|
||||
<Mail className="h-5 w-5 text-white" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-green-900 mb-1">Email support</h3>
|
||||
<p className="text-sm text-green-700 mb-2">Réponse sous 24h</p>
|
||||
<Button
|
||||
variant="default"
|
||||
size="sm"
|
||||
className="bg-green-600 hover:bg-green-700 w-full"
|
||||
>
|
||||
support@btpxpress.fr
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* Chat en direct */}
|
||||
<Card className="p-6 bg-purple-50 border-purple-200">
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="p-3 bg-purple-600 rounded-lg">
|
||||
<MessageCircle className="h-5 w-5 text-white" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-purple-900 mb-1">
|
||||
Chat en direct
|
||||
</h3>
|
||||
<p className="text-sm text-purple-700 mb-2">
|
||||
Discutez avec un agent
|
||||
</p>
|
||||
<Button
|
||||
variant="default"
|
||||
size="sm"
|
||||
className="bg-purple-600 hover:bg-purple-700 w-full"
|
||||
>
|
||||
Démarrer le chat
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* Note importante */}
|
||||
<Card className="p-4 bg-yellow-50 border-yellow-200">
|
||||
<div className="flex items-start gap-2">
|
||||
<AlertCircle className="h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5" />
|
||||
<div className="flex-1">
|
||||
<p className="text-sm text-yellow-800">
|
||||
Pour les urgences critiques affectant votre production, appelez
|
||||
notre ligne d'urgence 24/7 au{" "}
|
||||
<span className="font-semibold">+33 1 98 76 54 32</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
271
app/(main)/aide/tutoriels/page.tsx
Normal file
271
app/(main)/aide/tutoriels/page.tsx
Normal file
@@ -0,0 +1,271 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import {
|
||||
Video,
|
||||
Search,
|
||||
Play,
|
||||
Clock,
|
||||
Star,
|
||||
ThumbsUp,
|
||||
Eye,
|
||||
ArrowLeft,
|
||||
Filter,
|
||||
} from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
/**
|
||||
* Page des tutoriels
|
||||
* Vidéos et guides pas-à-pas
|
||||
*/
|
||||
export default function TutorielsPage() {
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [selectedCategory, setSelectedCategory] = useState<string>("all");
|
||||
|
||||
const tutoriels = [
|
||||
{
|
||||
id: "1",
|
||||
title: "Créer votre premier chantier",
|
||||
description:
|
||||
"Apprenez à créer et configurer un nouveau chantier de A à Z",
|
||||
duration: "8:45",
|
||||
views: 1234,
|
||||
likes: 89,
|
||||
rating: 4.8,
|
||||
category: "Démarrage",
|
||||
level: "Débutant",
|
||||
thumbnail: "https://via.placeholder.com/400x225?text=Tutoriel+1",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
title: "Gérer les phases de chantier",
|
||||
description: "Comment planifier et suivre les différentes phases d'un projet",
|
||||
duration: "12:30",
|
||||
views: 956,
|
||||
likes: 72,
|
||||
rating: 4.9,
|
||||
category: "Chantiers",
|
||||
level: "Intermédiaire",
|
||||
thumbnail: "https://via.placeholder.com/400x225?text=Tutoriel+2",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
title: "Créer et envoyer un devis",
|
||||
description: "Créez des devis professionnels et envoyez-les à vos clients",
|
||||
duration: "10:15",
|
||||
views: 1567,
|
||||
likes: 124,
|
||||
rating: 4.7,
|
||||
category: "Facturation",
|
||||
level: "Débutant",
|
||||
thumbnail: "https://via.placeholder.com/400x225?text=Tutoriel+3",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
title: "Planifier les équipes efficacement",
|
||||
description:
|
||||
"Optimisez la gestion de vos équipes avec le planning intelligent",
|
||||
duration: "15:20",
|
||||
views: 823,
|
||||
likes: 65,
|
||||
rating: 4.6,
|
||||
category: "Équipes",
|
||||
level: "Avancé",
|
||||
thumbnail: "https://via.placeholder.com/400x225?text=Tutoriel+4",
|
||||
},
|
||||
{
|
||||
id: "5",
|
||||
title: "Maintenance préventive du matériel",
|
||||
description: "Mettez en place un programme de maintenance efficace",
|
||||
duration: "11:45",
|
||||
views: 645,
|
||||
likes: 51,
|
||||
rating: 4.5,
|
||||
category: "Matériel",
|
||||
level: "Intermédiaire",
|
||||
thumbnail: "https://via.placeholder.com/400x225?text=Tutoriel+5",
|
||||
},
|
||||
{
|
||||
id: "6",
|
||||
title: "Générer des rapports personnalisés",
|
||||
description: "Créez des rapports adaptés à vos besoins spécifiques",
|
||||
duration: "9:30",
|
||||
views: 734,
|
||||
likes: 58,
|
||||
rating: 4.8,
|
||||
category: "Rapports",
|
||||
level: "Avancé",
|
||||
thumbnail: "https://via.placeholder.com/400x225?text=Tutoriel+6",
|
||||
},
|
||||
];
|
||||
|
||||
const categories = ["all", "Démarrage", "Chantiers", "Facturation", "Équipes", "Matériel", "Rapports"];
|
||||
const levels = ["all", "Débutant", "Intermédiaire", "Avancé"];
|
||||
|
||||
const filteredTutoriels = tutoriels.filter((tuto) => {
|
||||
const matchesSearch =
|
||||
tuto.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
tuto.description.toLowerCase().includes(searchTerm.toLowerCase());
|
||||
const matchesCategory =
|
||||
selectedCategory === "all" || tuto.category === selectedCategory;
|
||||
return matchesSearch && matchesCategory;
|
||||
});
|
||||
|
||||
const getLevelColor = (level: string) => {
|
||||
switch (level) {
|
||||
case "Débutant":
|
||||
return "bg-green-100 text-green-800";
|
||||
case "Intermédiaire":
|
||||
return "bg-blue-100 text-blue-800";
|
||||
case "Avancé":
|
||||
return "bg-purple-100 text-purple-800";
|
||||
default:
|
||||
return "bg-gray-100 text-gray-800";
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-6 p-6">
|
||||
{/* En-tête */}
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-4">
|
||||
<Link href="/aide">
|
||||
<Button variant="ghost" size="sm">
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
Retour à l'aide
|
||||
</Button>
|
||||
</Link>
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-gray-900">Tutoriels vidéo</h1>
|
||||
<p className="text-gray-500 mt-1">
|
||||
{filteredTutoriels.length} tutoriel{filteredTutoriels.length > 1 ? "s" : ""}{" "}
|
||||
disponible{filteredTutoriels.length > 1 ? "s" : ""}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Barre de recherche et filtres */}
|
||||
<div className="flex gap-4 flex-wrap">
|
||||
<div className="flex-1 min-w-[300px]">
|
||||
<div className="relative">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" />
|
||||
<Input
|
||||
placeholder="Rechercher un tutoriel..."
|
||||
className="pl-10"
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
{categories.map((category) => (
|
||||
<Button
|
||||
key={category}
|
||||
variant={selectedCategory === category ? "default" : "outline"}
|
||||
size="sm"
|
||||
onClick={() => setSelectedCategory(category)}
|
||||
>
|
||||
{category === "all" ? "Toutes les catégories" : category}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Grid de tutoriels */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{filteredTutoriels.map((tutoriel) => (
|
||||
<Card
|
||||
key={tutoriel.id}
|
||||
className="overflow-hidden hover:shadow-lg transition-shadow cursor-pointer"
|
||||
>
|
||||
{/* Thumbnail */}
|
||||
<div className="relative">
|
||||
<img
|
||||
src={tutoriel.thumbnail}
|
||||
alt={tutoriel.title}
|
||||
className="w-full h-48 object-cover"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-black bg-opacity-40 flex items-center justify-center opacity-0 hover:opacity-100 transition-opacity">
|
||||
<div className="p-4 bg-white rounded-full">
|
||||
<Play className="h-8 w-8 text-blue-600" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="absolute bottom-2 right-2 bg-black bg-opacity-75 text-white px-2 py-1 rounded text-xs flex items-center gap-1">
|
||||
<Clock className="h-3 w-3" />
|
||||
{tutoriel.duration}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Contenu */}
|
||||
<div className="p-4">
|
||||
<div className="flex items-start justify-between gap-2 mb-2">
|
||||
<Badge className={getLevelColor(tutoriel.level)}>
|
||||
{tutoriel.level}
|
||||
</Badge>
|
||||
<Badge variant="outline">{tutoriel.category}</Badge>
|
||||
</div>
|
||||
|
||||
<h3 className="font-semibold text-lg mb-2">{tutoriel.title}</h3>
|
||||
<p className="text-sm text-gray-600 mb-4 line-clamp-2">
|
||||
{tutoriel.description}
|
||||
</p>
|
||||
|
||||
{/* Stats */}
|
||||
<div className="flex items-center justify-between text-sm text-gray-500">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex items-center gap-1">
|
||||
<Eye className="h-4 w-4" />
|
||||
{tutoriel.views.toLocaleString()}
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<ThumbsUp className="h-4 w-4" />
|
||||
{tutoriel.likes}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Star className="h-4 w-4 fill-yellow-400 text-yellow-400" />
|
||||
<span className="font-medium">{tutoriel.rating}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{filteredTutoriels.length === 0 && (
|
||||
<Card className="p-12">
|
||||
<div className="text-center">
|
||||
<Video className="h-12 w-12 text-gray-400 mx-auto mb-4" />
|
||||
<p className="text-gray-500">Aucun tutoriel trouvé</p>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{/* Section suggestions */}
|
||||
<Card className="p-6 bg-gradient-to-r from-purple-50 to-blue-50">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="p-3 bg-purple-600 rounded-lg">
|
||||
<Video className="h-6 w-6 text-white" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3 className="font-semibold text-lg mb-2">
|
||||
Vous ne trouvez pas ce que vous cherchez ?
|
||||
</h3>
|
||||
<p className="text-sm text-gray-700 mb-4">
|
||||
Suggérez-nous un nouveau tutoriel ! Nous sommes toujours à l'écoute de
|
||||
vos besoins pour améliorer notre contenu pédagogique.
|
||||
</p>
|
||||
<Button className="bg-purple-600 hover:bg-purple-700">
|
||||
Suggérer un tutoriel
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user