import { Mulberry32 } from "../utils.js"; import React, { useState, useEffect } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faChevronRight, faChevronDown, } from "@fortawesome/free-solid-svg-icons"; export function Dashboard({ isRecording, onRecord, transcriptionText, finalSummary, topics, stream, }) { const [openIndex, setOpenIndex] = useState(null); 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 ( <>
{finalSummary.summary}