import React, { useState, useEffect } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faChevronRight, faChevronDown, } from "@fortawesome/free-solid-svg-icons"; import { formatTime } from "../lib/time"; import ScrollToBottom from "./scrollToBottom"; import DisconnectedIndicator from "./disconnectedIndicator"; import LiveTrancription from "./liveTranscription"; import FinalSummary from "./finalSummary"; import { Topic, FinalSummary as FinalSummaryType } from "./webSocketTypes"; type DashboardProps = { transcriptionText: string; finalSummary: FinalSummaryType; topics: Topic[]; disconnected: boolean; useActiveTopic: [ Topic | null, React.Dispatch>, ]; }; export function Dashboard({ transcriptionText, finalSummary, topics, disconnected, useActiveTopic, }: DashboardProps) { const [activeTopic, setActiveTopic] = useActiveTopic; const [autoscrollEnabled, setAutoscrollEnabled] = useState(true); useEffect(() => { if (autoscrollEnabled) scrollToBottom(); console.log(topics); }, [topics.length]); const scrollToBottom = () => { const topicsDiv = document.getElementById("topics-div"); if (!topicsDiv) console.error("Could not find topics div to scroll to bottom"); else topicsDiv.scrollTop = topicsDiv.scrollHeight; }; const handleScroll = (e) => { const bottom = e.target.scrollHeight - e.target.scrollTop === e.target.clientHeight; if (!bottom && autoscrollEnabled) { setAutoscrollEnabled(false); } else if (bottom && !autoscrollEnabled) { setAutoscrollEnabled(true); } }; const faketopic = { id: "641fbc68-dc2e-4c9d-aafd-89bdbf8cfc26", summary: "Explore the history of hypnotica music, a genre that has been deeply influential on modern music. From its origins in the 60s to its current status, this music has a unique and hypnotic quality that can be felt in the gut. Dive into the canon of modern hypnotica and discover its impact on music today.", timestamp: 0, title: "The Origins and Influence of Hypnotica Music", transcript: " vertically oriented music ultimately hypnotic So, that's what we're talking about. Uh, when does it start? I mean, technically, I think... It's always been here but Hypnotica, much like Exotica, which is also sort of a fraught genre. a sort of a western interpretive genre, a fetishizing genre. I would say, uh, it starts in the 60s when all these wh- weird things started, you know, and I started fucking around and... You can go into Woodstock or whatever, that's usually when these things start. Anything that ends with a at the end of a word usually started in By some dirty hippie. Yeah. By some dirty hippie. Yeah. It was like, uh. Okay. So. That's hypnotica, I don't care to explain it to be honest I think everyone can feel it in their gut. We're mostly gonna ex- Explore this kind of the canon of the modern canon of what what I might call hypnotic It's been deeply influential on me and, uh...", }; const faketopics = new Array(10).fill(faketopic); return (
{/* Topic Section */}
{faketopics.length > 0 ? ( <>
{faketopics.map((item, index) => (
setActiveTopic(activeTopic?.id == item.id ? null : item) } >

[{formatTime(item.timestamp)}]   {item.title}

{activeTopic?.id == item.id && (
{item.transcript}
)}
))}
) : (
Discussion topics will appear here after you start recording. It may take up to 5 minutes of conversation for the first topic to appear.
)}
{finalSummary.summary ? ( ) : ( )}
{disconnected && }
); }