"use client"; import { ChatSession } from "../lib/types"; import LanguageDisplay from "./LanguageDisplay"; import CountryDisplay from "./CountryDisplay"; interface SessionDetailsProps { session: ChatSession; } /** * Component to display session details with formatted country and language names */ export default function SessionDetails({ session }: SessionDetailsProps) { return (

Session Details

Session ID: {session.sessionId || session.id}
Start Time: {new Date(session.startTime).toLocaleString()}
{session.endTime && (
End Time: {new Date(session.endTime).toLocaleString()}
)} {session.category && (
Category: {session.category}
)} {session.language && (
Language: ({session.language.toUpperCase()})
)} {session.country && (
Country: ({session.country})
)} {session.sentiment !== null && session.sentiment !== undefined && (
Sentiment: 0.3 ? "text-green-500" : session.sentiment < -0.3 ? "text-red-500" : "text-orange-500" }`} > {session.sentiment > 0.3 ? "Positive" : session.sentiment < -0.3 ? "Negative" : "Neutral"}{" "} ({session.sentiment.toFixed(2)})
)}
Messages Sent: {session.messagesSent || 0}
{typeof session.tokens === "number" && (
Tokens: {session.tokens}
)} {typeof session.tokensEur === "number" && (
Cost: €{session.tokensEur.toFixed(4)}
)} {session.avgResponseTime !== null && session.avgResponseTime !== undefined && (
Avg Response Time: {session.avgResponseTime.toFixed(2)}s
)} {session.escalated !== null && session.escalated !== undefined && (
Escalated: {session.escalated ? "Yes" : "No"}
)} {session.forwardedHr !== null && session.forwardedHr !== undefined && (
Forwarded to HR: {session.forwardedHr ? "Yes" : "No"}
)} {/* Transcript rendering is now handled by the parent page (app/dashboard/sessions/[id]/page.tsx) */} {/* Fallback to link only if we only have the URL but no content - this might also be redundant if parent handles all transcript display */} {(!session.transcriptContent || session.transcriptContent.length === 0) && session.fullTranscriptUrl && (
Transcript: View Full Transcript
)}
); }