diff --git a/components/quotes/ticket-detail-modal.tsx b/components/quotes/ticket-detail-modal.tsx index e83f875..68f3c0e 100644 --- a/components/quotes/ticket-detail-modal.tsx +++ b/components/quotes/ticket-detail-modal.tsx @@ -34,6 +34,55 @@ import { // noteType values that are system/automated (workflow rules, monitoring, auto-close, etc.) const SYSTEM_NOTE_TYPES = new Set([13, 91, 93, 94, 99, 101]); +const URL_REGEX = /https?:\/\/[^\s<>"')]+/g; + +function renderTextWithLinks(text: string): React.ReactNode[] { + const parts: React.ReactNode[] = []; + let lastIndex = 0; + let match: RegExpExecArray | null; + URL_REGEX.lastIndex = 0; + while ((match = URL_REGEX.exec(text)) !== null) { + if (match.index > lastIndex) { + parts.push(text.slice(lastIndex, match.index)); + } + const url = match[0].replace(/[.,;:!?)]+$/, ''); + let label: string; + try { + label = new URL(url).hostname.replace(/^www\./, ''); + } catch { + label = 'link'; + } + parts.push( + + {label} + + ); + lastIndex = match.index + match[0].length; + } + if (lastIndex < text.length) parts.push(text.slice(lastIndex)); + return parts; +} + +function LinkedText({ text, className }: { text: string; className?: string }) { + const lines = text.split('\n'); + return ( + + {lines.map((line, i) => ( + + {renderTextWithLinks(line)} + {i < lines.length - 1 &&
} +
+ ))} +
+ ); +} + interface TicketDetailModalProps { ticketNumber: string; open: boolean; @@ -179,7 +228,7 @@ export function TicketDetailModal({ ticketNumber, open, onOpenChange }: TicketDe return ( - + @@ -202,7 +251,7 @@ export function TicketDetailModal({ ticketNumber, open, onOpenChange }: TicketDe )} {ticket && !loading && ( -
+
{/* Metadata */}
{getStatusBadge(ticket.status, ticket.statusLabel)} @@ -250,8 +299,8 @@ export function TicketDetailModal({ ticketNumber, open, onOpenChange }: TicketDe {ticket.description && (

Description

-
- {ticket.description} +
+
)} @@ -260,8 +309,8 @@ export function TicketDetailModal({ ticketNumber, open, onOpenChange }: TicketDe {ticket.resolution && (

Resolution

-
- {ticket.resolution} +
+
)} @@ -340,7 +389,7 @@ export function TicketDetailModal({ ticketNumber, open, onOpenChange }: TicketDe
{!isLast &&
}
-
+
{e.resourceName || 'Unknown'}
@@ -349,7 +398,9 @@ export function TicketDetailModal({ ticketNumber, open, onOpenChange }: TicketDe
{e.summaryNotes && ( -

{e.summaryNotes}

+

+ +

)}
@@ -370,14 +421,16 @@ export function TicketDetailModal({ ticketNumber, open, onOpenChange }: TicketDe
{!isLast &&
}
-
+
{n.creatorName || (isSystem ? 'System' : 'Unknown')} {formatDate(n.createDateTime)}
{n.title &&

{n.title}

} {n.description && ( -

{n.description}

+

+ +

)}