From 44e9631fc98d7eb45c860b113ada49fdf155d611 Mon Sep 17 00:00:00 2001 From: Kaj Kowalski Date: Thu, 22 May 2025 10:17:54 +0200 Subject: [PATCH] Refactor SessionDetails component: remove TranscriptViewer and update transcript handling comments --- components/SessionDetails.tsx | 12 +- components/SessionDetails.tsx.new | 175 ------------------------------ 2 files changed, 2 insertions(+), 185 deletions(-) delete mode 100644 components/SessionDetails.tsx.new diff --git a/components/SessionDetails.tsx b/components/SessionDetails.tsx index 36b994a..16172e4 100644 --- a/components/SessionDetails.tsx +++ b/components/SessionDetails.tsx @@ -3,7 +3,6 @@ import { ChatSession } from "../lib/types"; import LanguageDisplay from "./LanguageDisplay"; import CountryDisplay from "./CountryDisplay"; -import TranscriptViewer from "./TranscriptViewer"; interface SessionDetailsProps { session: ChatSession; @@ -143,15 +142,8 @@ export default function SessionDetails({ session }: SessionDetailsProps) { )} - {/* Display transcript using TranscriptViewer if content is available */} - {session.transcriptContent && session.transcriptContent.length > 0 && ( - - )} - - {/* Fallback to link only if we only have the URL but no content */} + {/* 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 && ( diff --git a/components/SessionDetails.tsx.new b/components/SessionDetails.tsx.new deleted file mode 100644 index 2acaa7b..0000000 --- a/components/SessionDetails.tsx.new +++ /dev/null @@ -1,175 +0,0 @@ -"use client"; - -import { ChatSession } from "../lib/types"; -import LanguageDisplay from "./LanguageDisplay"; -import CountryDisplay from "./CountryDisplay"; -import TranscriptViewer from "./TranscriptViewer"; - -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" - }`} - > - {/* TODO: Ensure sentiment display is accurate and potentially use icons/color-coding more explicitly */} - {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: - {/* TODO: Populate average response time, ensure formatting (e.g., "s" or "ms") */} - - {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"} - -
- )} - - {/* Display transcript using TranscriptViewer if content is available */} - {session.transcriptContent && session.transcriptContent.length > 0 && ( - - )} - - {/* Fallback to link only if we only have the URL but no content */} - {(!session.transcriptContent || session.transcriptContent.length === 0) && session.fullTranscriptUrl && ( -
- Transcript: - - View Full Transcript - -
- )} -
-
- ); -} - -// TODO: Review and finalize this component. Consider renaming to SessionDetails.tsx and removing/archiving SessionDetails.tsx and SessionDetails.tsx.bak.