diff --git a/components/ClientPortal.tsx b/components/ClientPortal.tsx
index de94550..03225f4 100644
--- a/components/ClientPortal.tsx
+++ b/components/ClientPortal.tsx
@@ -1,4 +1,5 @@
import React, { useState, useRef, useEffect } from 'react';
+import ReactMarkdown from 'react-markdown';
import { Ticket, KBArticle, ChatMessage, TicketPriority, TicketStatus, SurveyResult, Attachment, ClientUser, TicketQueue, AppSettings } from '../types';
import { getSupportResponse } from '../services/geminiService';
import { ToastType } from './Toast';
@@ -39,6 +40,23 @@ interface ClientPortalProps {
showToast: (message: string, type: ToastType) => void;
}
+// Configurazione stili per ReactMarkdown
+const MarkdownComponents = {
+ h1: (props: any) =>
,
+ h2: (props: any) => ,
+ h3: (props: any) => ,
+ p: (props: any) => ,
+ ul: (props: any) => ,
+ ol: (props: any) =>
,
+ li: (props: any) => ,
+ strong: (props: any) => ,
+ blockquote: (props: any) => ,
+ a: (props: any) => ,
+ code: (props: any) => ,
+ pre: (props: any) => ,
+ hr: (props: any) =>
,
+};
+
export const ClientPortal: React.FC = ({
currentUser,
articles,
@@ -524,7 +542,16 @@ export const ClientPortal: React.FC = ({
>
{article.category}
{article.title}
- {article.content}
+
+ ,
+ h2: ({node, ...props}) => ,
+ p: ({node, ...props}) => ,
+ li: ({node, ...props}) => ,
+ }}>
+ {article.content}
+
+
))}
@@ -534,11 +561,28 @@ export const ClientPortal: React.FC = ({
{/* KB Modal */}
{viewingArticle && (
-
-
-
{viewingArticle.title}
-
{viewingArticle.content}
- {viewingArticle.type === 'url' &&
Vai alla risorsa esterna}
+
+
+
{viewingArticle.title}
+
+ {viewingArticle.category}
+ •
+ Aggiornato il {viewingArticle.lastUpdated}
+
+
+
+
+ {viewingArticle.content}
+
+
+
+ {viewingArticle.type === 'url' && (
+
+ )}
)}
@@ -579,7 +623,18 @@ export const ClientPortal: React.FC
= ({
? 'bg-brand-600 text-white rounded-tr-none'
: 'bg-white text-gray-800 rounded-tl-none border border-gray-100'
}`}>
- {msg.content}
+ {/* Render Markdown in chat messages too for consistency if assistant */}
+ {msg.role === 'assistant' ? (
+ ,
+ ul: ({node, ...props}) => ,
+ li: ({node, ...props}) => ,
+ a: ({node, ...props}) => ,
+ strong: ({node, ...props}) =>
+ }}>{msg.content}
+ ) : (
+ msg.content
+ )}
))}