MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / TranscriptPage

Function TranscriptPage

pages/analytics.tsx:46–279  ·  view source on GitHub ↗
(props: TranscriptPageProps)

Source from the content-addressed store, hash-verified

44};
45
46export default function TranscriptPage(props: TranscriptPageProps) {
47 const router = useRouter();
48 const supabase = useSupabaseClient<Database>();
49 const { profile } = useProfile();
50 const [selectedTranscriptId, setSelectedTranscriptId] = useState<
51 number | null
52 >(props.conversationId ?? null);
53 const [conversation, setConversation] = useState<FullConversationItem | null>(
54 null,
55 );
56 const [devMode, setDevMode] = useState<boolean>(false);
57 const [shareClicked, setShareClicked] = useState<boolean>(false);
58 const ref = useRef<HTMLDivElement | null>(null);
59
60 useEffect(() => {
61 if (selectedTranscriptId) {
62 if (Object.keys(router.query).length)
63 router.replace("/analytics", undefined, {
64 shallow: true,
65 });
66 (async () => {
67 const { data, error } = await supabase
68 .from("conversations")
69 .select(
70 "created_at,is_playground,chat_messages(id,role,content,name,conversation_index,created_at),feedback(id,feedback_positive,conversation_length_at_feedback,negative_feedback_text)",
71 )
72 .eq("id", selectedTranscriptId)
73 .order("conversation_index", {
74 ascending: true,
75 foreignTable: "chat_messages",
76 })
77 .single();
78 if (error) throw new Error(error.message);
79 setConversation(data);
80 })();
81 }
82 }, [selectedTranscriptId]);
83
84 return (
85 <div className="min-h-screen bg-gray-800">
86 <Headers />
87 <Navbar current={"Transcripts"} />
88 <div className={"flex flex-row w-screen overflow-x-hidden"}>
89 <TranscriptSearchSidebar
90 {...props}
91 selectedTranscriptId={selectedTranscriptId}
92 setSelectedTranscriptId={setSelectedTranscriptId}
93 />
94 <div
95 ref={ref}
96 className={classNames(
97 "relative max-h-[calc(100vh-4rem)] flex flex-grow",
98 selectedTranscriptId ? "bg-white" : "bg-gray-800",
99 )}
100 >
101 {selectedTranscriptId && (
102 <>
103 <div className="absolute top-0.5 left-1.5 flex flex-col tracking-tight leading-3 place-items-center text-center gap-y-1 text-xs text-gray-600 bg-white rounded px-1 py-1.5 z-20">

Callers

nothing calls this directly

Calls 2

useProfileFunction · 0.90
classNamesFunction · 0.90

Tested by

no test coverage detected