import React, { useState, useEffect } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faChevronRight, faChevronDown, faLinkSlash, } from "@fortawesome/free-solid-svg-icons"; export function Dashboard({ transcriptionText, finalSummary, topics, disconnected, useActiveTopic, }) { const [activeTopic, setActiveTopic] = useActiveTopic; const [autoscrollEnabled, setAutoscrollEnabled] = useState(true); useEffect(() => { if (autoscrollEnabled) scrollToBottom(); }, [topics.length]); const scrollToBottom = () => { const topicsDiv = document.getElementById("topics-div"); 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 formatTime = (seconds) => { let hours = Math.floor(seconds / 3600); let minutes = Math.floor((seconds % 3600) / 60); let secs = Math.floor(seconds % 60); let timeString = `${hours > 0 ? hours + ":" : ""}${minutes .toString() .padStart(2, "0")}:${secs.toString().padStart(2, "0")}`; return timeString; }; return ( <>

Meeting Notes

Timestamp
Topic
{topics.map((item, index) => (
setActiveTopic( activeTopic == item.timestamp ? null : item.timestamp, ) } >
{formatTime(item.timestamp)}
{item.title}
{activeTopic == item.timestamp && (
{item.transcript}
)}
))} {topics.length === 0 && (
No topics yet
)}
{finalSummary && (

Final Summary

{finalSummary.summary}

)}
{disconnected && (
Disconnected
)} ); }