11
22import { Badge } from '@/components/ui/badge' ;
3- import { CheckCircle , Code , Globe , ShoppingBag } from 'lucide-react' ;
3+ import { CheckCircle , Code , Globe , ShoppingBag , AlertTriangle , XCircle , Clock } from 'lucide-react' ;
44
55interface IntegrationStatus {
66 hasCodeIntegration : boolean ;
@@ -12,6 +12,9 @@ interface IntegrationStatus {
1212 active : boolean ;
1313 } > ;
1414 activeIntegrationType ?: 'code' | 'plugin' ;
15+ codeIntegrationStatus ?: 'active' | 'pending' | 'error' | 'inactive' ;
16+ lastCodeActivity ?: Date ;
17+ errorMessage ?: string ;
1518}
1619
1720interface CampaignSettingsHeaderProps {
@@ -73,29 +76,107 @@ export const CampaignSettingsHeader = ({ activeTab, integrationStatus }: Campaig
7376 return null ;
7477 }
7578
76- const { activeIntegrationType, pluginConfigs } = integrationStatus ;
79+ const { activeIntegrationType, pluginConfigs, codeIntegrationStatus , lastCodeActivity , errorMessage } = integrationStatus ;
7780
7881 if ( activeIntegrationType === 'code' ) {
82+ const status = codeIntegrationStatus || 'pending' ;
83+
7984 return (
80- < div className = "flex items-center gap-2 mt-3" >
81- < CheckCircle className = "h-4 w-4 text-success" />
82- < Code className = "h-4 w-4" />
83- < Badge variant = "default" className = "text-xs" >
84- Intégration par code
85- </ Badge >
85+ < div className = "flex items-center gap-3 mt-4" >
86+ { /* Indicateur de statut */ }
87+ < div className = "flex items-center gap-2" >
88+ { status === 'active' && (
89+ < >
90+ < div className = "relative" >
91+ < CheckCircle className = "h-5 w-5 text-green-600" />
92+ < div className = "absolute -top-1 -right-1 w-3 h-3 bg-green-500 rounded-full animate-pulse" > </ div >
93+ </ div >
94+ < Code className = "h-4 w-4 text-green-600" />
95+ </ >
96+ ) }
97+ { status === 'pending' && (
98+ < >
99+ < Clock className = "h-5 w-5 text-amber-500" />
100+ < Code className = "h-4 w-4 text-amber-500" />
101+ </ >
102+ ) }
103+ { status === 'error' && (
104+ < >
105+ < XCircle className = "h-5 w-5 text-red-500" />
106+ < Code className = "h-4 w-4 text-red-500" />
107+ </ >
108+ ) }
109+ { status === 'inactive' && (
110+ < >
111+ < AlertTriangle className = "h-5 w-5 text-orange-500" />
112+ < Code className = "h-4 w-4 text-orange-500" />
113+ </ >
114+ ) }
115+ </ div >
116+
117+ { /* Badge de statut */ }
118+ < div className = "flex flex-col gap-1" >
119+ < div className = "flex items-center gap-2" >
120+ { status === 'active' && (
121+ < Badge className = "bg-green-100 text-green-800 border-green-200 text-xs font-medium" >
122+ ✅ Code intégré et fonctionnel
123+ </ Badge >
124+ ) }
125+ { status === 'pending' && (
126+ < Badge className = "bg-amber-100 text-amber-800 border-amber-200 text-xs font-medium" >
127+ ⏳ Code en attente de déploiement
128+ </ Badge >
129+ ) }
130+ { status === 'error' && (
131+ < Badge className = "bg-red-100 text-red-800 border-red-200 text-xs font-medium" >
132+ ❌ Erreur d'intégration
133+ </ Badge >
134+ ) }
135+ { status === 'inactive' && (
136+ < Badge className = "bg-orange-100 text-orange-800 border-orange-200 text-xs font-medium" >
137+ ⚠️ Code non déployé
138+ </ Badge >
139+ ) }
140+ </ div >
141+
142+ { /* Message d'erreur ou info supplémentaire */ }
143+ { status === 'error' && errorMessage && (
144+ < p className = "text-xs text-red-600 mt-1" >
145+ { errorMessage }
146+ </ p >
147+ ) }
148+ { status === 'active' && lastCodeActivity && (
149+ < p className = "text-xs text-green-600 mt-1" >
150+ Dernière activité: { new Date ( lastCodeActivity ) . toLocaleDateString ( 'fr-FR' ) }
151+ </ p >
152+ ) }
153+ { status === 'pending' && (
154+ < p className = "text-xs text-amber-600 mt-1" >
155+ Vérifiez que le code est bien installé sur votre site
156+ </ p >
157+ ) }
158+ { status === 'inactive' && (
159+ < p className = "text-xs text-orange-600 mt-1" >
160+ Aucune activité détectée - Vérifiez l'installation
161+ </ p >
162+ ) }
163+ </ div >
86164 </ div >
87165 ) ;
88166 } else {
89167 const activePlugins = pluginConfigs . filter ( p => p . active ) ;
90168 if ( activePlugins . length > 0 ) {
91169 return (
92- < div className = "flex items-center gap-2 mt-3" >
93- < CheckCircle className = "h-4 w-4 text-success" />
170+ < div className = "flex items-center gap-3 mt-4" >
171+ < div className = "relative" >
172+ < CheckCircle className = "h-5 w-5 text-green-600" />
173+ < div className = "absolute -top-1 -right-1 w-3 h-3 bg-green-500 rounded-full animate-pulse" > </ div >
174+ </ div >
94175 < div className = "flex flex-wrap items-center gap-2" >
95176 { activePlugins . map ( ( plugin ) => (
96- < Badge key = { plugin . id } variant = "default" className = "text-xs flex items-center gap-1" >
177+ < Badge key = { plugin . id } className = "bg-green-100 text-green-800 border-green-200 text- xs flex items-center gap-1 font-medium " >
97178 { plugin . type === 'wordpress' ? < Globe className = "h-3 w-3" /> : < ShoppingBag className = "h-3 w-3" /> }
98- { plugin . domain }
179+ ✅ { plugin . domain }
99180 </ Badge >
100181 ) ) }
101182 </ div >
0 commit comments