/** * ========================================================================= * PLATEFORME ECO-PANNEAU.FR - VERSION 1.0.0 * Socle Messagerie (1/3) - Composants UI et Utilitaires (Bulles, Modération) * ========================================================================= */ const { memo } = React; // ------------------------------------------------------------------------- // UTILITAIRES ET MODALES TRANSVERSES // ------------------------------------------------------------------------- window.pano_ModerationModal = ({ word, onModify, onRequestControl }) => { const { AlertTriangleIcon, ShieldIcon } = window.pano_getIcons(); const Button = window.pano_Button; return (
e.stopPropagation()}>

Avertissement

À cause de l'utilisation de l'expression "{word}", vous devez modifier votre message.

Vous avez également la possibilité de faire contrôler votre message par le support technique avant envoi au client.
); }; window.pano_checkForBlacklist = (text, settings) => { if (!settings || !settings.blacklist) return null; const words = settings.blacklist.split(',') .map(w => w.trim().toLowerCase()) .filter(w => w); const lowerText = text.toLowerCase(); for (let w of words) { if (lowerText.includes(w)) return w; } return null; }; // ------------------------------------------------------------------------- // COMPOSANT : BULLE DE MESSAGE (MÉMORISÉE POUR PERFORMANCES) // ------------------------------------------------------------------------- window.pano_MessageBubble = memo(({ msg, isMe, displayAuthor, onImageLoad, onViewAttachment }) => { const { AlertTriangleIcon, LoaderIcon, FileTextIcon, EditIcon } = window.pano_getIcons(); const Button = window.pano_Button; const PdfThumbnail = window.pano_PdfThumbnail; const attachments = []; const regex = /\[ATTACHMENT:([a-zA-Z0-9_.\/-]+):(image|pdf)\]/g; let match; while ((match = regex.exec(msg.detail || '')) !== null) { attachments.push({ id: match[1], type: match[2] }); } const textContent = (msg.detail || '').replace(regex, '').trim(); const isHtmlAllowed = msg.authorType === 'Admin' || msg.authorType === 'Système' || msg.authorType === 'Systeme'; const suspendRegex = /Le panneau "([^"]+)" a été suspendu jusqu'à correction/; const suspendMatch = textContent.match(suspendRegex); const handleCorrigerClick = (e) => { e.preventDefault(); const panelTab = Array.from(document.querySelectorAll('div[role="button"]')).find(el => el.textContent.includes('Mes panneaux')); if (panelTab) { panelTab.click(); setTimeout(() => { const targetTitle = Array.from(document.querySelectorAll('h3')).find(h3 => h3.textContent.includes(suspendMatch[1])); if (targetTitle) { const card = targetTitle.closest('.bg-white'); if (card) { const corrigerBtn = Array.from(card.querySelectorAll('div[role="button"]')).find(btn => btn.textContent.includes('Corriger')); if (corrigerBtn) corrigerBtn.click(); } } }, 150); } else { window.location.href = '?tab=panels'; } }; return (
{msg.isAlert === 2 && (
En attente de contrôle
)}
{textContent && ( isHtmlAllowed ? (
/g, '>').replace(/"/g, '"').replace(/'/g, ''') }} className="text-sm leading-relaxed whitespace-pre-wrap admin-html" /> ) : (

{textContent}

) )} {suspendMatch && msg.authorType === 'Admin' && !isMe && (
)} {attachments.length > 0 && (
{attachments.map((att, i) => ( {att.type === 'image' && (
onViewAttachment(att)} className="cursor-pointer shrink-0"> Pièce jointe
)} {att.type === 'pdf' && PdfThumbnail && (
onViewAttachment(att)} className={`cursor-pointer overflow-hidden rounded-xl border flex flex-col group text-left transition-transform hover:scale-[1.02] shrink-0 ${isMe ? 'border-white/20 bg-emerald-700/50' : 'border-slate-200 bg-white'} w-32`}>
Aperçu PDF
)}
))}
)}
{displayAuthor} • {new Date(String(msg.created_at || '').replace(' ', 'T')).toLocaleString('fr-FR')} {msg.id.toString().startsWith('temp_') && }
); }, (prevProps, nextProps) => { return prevProps.msg.id === nextProps.msg.id && prevProps.msg.resolved === nextProps.msg.resolved && prevProps.msg.isAlert === nextProps.msg.isAlert; }); /* EOF ========== [_react/_socle_messagerie_ui.jsx] */