"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.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 Score: 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)})
)} {session.sentimentCategory && (
AI Sentiment: {session.sentimentCategory}
)}
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"}
)} {session.ipAddress && (
IP Address: {session.ipAddress}
)} {session.processed !== null && session.processed !== undefined && (
AI Processed: {session.processed ? "Yes" : "No"}
)} {session.initialMsg && (
Initial Message:
"{session.initialMsg}"
)} {session.summary && (
AI Summary:
{session.summary}
)} {session.questions && (
Questions Asked:
{(() => { try { const questions = JSON.parse(session.questions); if (Array.isArray(questions) && questions.length > 0) { return (
    {questions.map((question: string, index: number) => (
  • {question}
  • ))}
); } return "No questions identified"; } catch { return session.questions; } })()}
)} {session.fullTranscriptUrl && (
Transcript: View Full Transcript
)}
); }