"use client"; import Modal from "../modal"; import useTranscript from "../useTranscript"; import useTopics from "../useTopics"; import useWaveform from "../useWaveform"; import useMp3 from "../useMp3"; import { TopicList } from "../topicList"; import { Topic } from "../webSocketTypes"; import React, { useEffect, useState } from "react"; import "../../../styles/button.css"; import FinalSummary from "../finalSummary"; import ShareLink from "../shareLink"; import QRCode from "react-qr-code"; import TranscriptTitle from "../transcriptTitle"; import ShareModal from "./shareModal"; import Player from "../player"; import WaveformLoading from "../waveformLoading"; import { useRouter } from "next/navigation"; import { faSpinner } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; type TranscriptDetails = { params: { transcriptId: string; }; }; export default function TranscriptDetails(details: TranscriptDetails) { const transcriptId = details.params.transcriptId; const router = useRouter(); const transcript = useTranscript(transcriptId); const topics = useTopics(transcriptId); const waveform = useWaveform(transcriptId); const useActiveTopic = useState(null); const mp3 = useMp3(transcriptId); const [showModal, setShowModal] = useState(false); useEffect(() => { const statusToRedirect = ["idle", "recording", "processing"]; if (statusToRedirect.includes(transcript.response?.status)) { const newUrl = "/transcripts/" + details.params.transcriptId + "/record"; // Shallow redirection does not work on NextJS 13 // https://github.com/vercel/next.js/discussions/48110 // https://github.com/vercel/next.js/discussions/49540 router.push(newUrl, undefined); // history.replaceState({}, "", newUrl); } }, [transcript.response?.status]); const fullTranscript = topics.topics ?.map((topic) => topic.transcript) .join("\n\n") .replace(/ +/g, " ") .trim() || ""; if ( (transcript?.response?.longSummary === null || true) && transcript && transcript.response ) { transcript.response.longSummary = ` **Meeting Summary:** **Date:** November 21, 2023 **Attendees:** Alice Johnson, Bob Smith, Carlos Gomez, Dana Lee **Agenda Items:** 1. **Project Alpha Update:** - Discussed current progress and minor setbacks. - Agreed on extending the deadline by two weeks. - Assigned new tasks to team members. 2. **Budget Review for Quarter 4:** - Reviewed financial performance. - Identified areas of overspending and discussed cost-cutting measures. - Decided to allocate additional funds to marketing. 3. **New Product Launch Strategy:** - Brainstormed ideas for the upcoming product launch. - Agreed on a digital-first marketing approach. - Set a tentative launch date for January 15, 2024. **Key Decisions:** - Extend Project Alpha's deadline to allow for quality enhancement. - Implement cost-saving strategies in non-essential departments. - Proceed with the digital marketing plan for the new product launch. **Action Items:** - Alice to coordinate with the marketing team for the new campaign. - Bob to oversee the budget adjustments and report back in one week. - Carlos to lead the task force for Project Alpha's final phase. - Dana to prepare a detailed report on competitor analysis for the next meeting. **Next Meeting:** Scheduled for December 5, 2023, to review progress and finalize the new product launch details. `; if (transcript.error || topics?.error) { return ( ); } if (!transcriptId || transcript?.loading || topics?.loading) { return ; } return ( <> setShowModal(v)} title={transcript?.response?.title} summary={transcript?.response?.longSummary} date={transcript?.response?.createdAt} url={window.location.href} />
{transcript?.response?.title && ( )} {waveform.waveform && mp3.media ? ( ) : waveform.error ? (
"error loading this recording"
) : ( )}
{transcript.response.longSummary ? ( setShowModal(true)} /> ) : (
{transcript.response.status == "processing" ? (

Loading Transcript

) : (

There was an error generating the final summary, please come back later

)}
)}
); } }