Merge pull request #374 from Monadical-SAS/fix-recording-layout

Fix recording layout
This commit is contained in:
2024-07-19 12:00:17 +02:00
committed by GitHub
6 changed files with 27 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ import ShareAndPrivacy from "../shareAndPrivacy";
type FinalSummaryProps = { type FinalSummaryProps = {
transcriptResponse: GetTranscript; transcriptResponse: GetTranscript;
topicsResponse: GetTranscriptTopic[]; topicsResponse: GetTranscriptTopic[];
onUpdate?: (newSummary) => void;
}; };
export default function FinalSummary(props: FinalSummaryProps) { export default function FinalSummary(props: FinalSummaryProps) {
@@ -53,6 +54,9 @@ export default function FinalSummary(props: FinalSummaryProps) {
transcriptId, transcriptId,
requestBody, requestBody,
}); });
if (props.onUpdate) {
props.onUpdate(newSummary);
}
console.log("Updated long summary:", updatedTranscript); console.log("Updated long summary:", updatedTranscript);
} catch (err) { } catch (err) {
console.error("Failed to update long summary:", err); console.error("Failed to update long summary:", err);

View File

@@ -103,6 +103,9 @@ export default function TranscriptDetails(details: TranscriptDetails) {
<TranscriptTitle <TranscriptTitle
title={transcript.response.title || "Unnamed Transcript"} title={transcript.response.title || "Unnamed Transcript"}
transcriptId={transcriptId} transcriptId={transcriptId}
onUpdate={(newTitle) => {
transcript.reload();
}}
/> />
</GridItem> </GridItem>
<TopicList <TopicList
@@ -118,6 +121,9 @@ export default function TranscriptDetails(details: TranscriptDetails) {
<FinalSummary <FinalSummary
transcriptResponse={transcript.response} transcriptResponse={transcript.response}
topicsResponse={topics.topics} topicsResponse={topics.topics}
onUpdate={(newSummary) => {
transcript.reload();
}}
/> />
</> </>
) : ( ) : (

View File

@@ -93,8 +93,8 @@ const TranscriptRecord = (details: TranscriptDetails) => {
{status === "processing" ? "Processing meeting" : "Record meeting"} {status === "processing" ? "Processing meeting" : "Record meeting"}
</Heading> </Heading>
<Flex direction={{ base: "column-reverse", md: "row" }}> <Flex direction={{ base: "column-reverse", md: "row" }} h={"full"}>
<Box w={{ md: "50%" }}> <Box w={{ md: "50%" }} h={{ base: "80%", md: "full" }}>
<TopicList <TopicList
topics={webSockets.topics} topics={webSockets.topics}
useActiveTopic={useActiveTopic} useActiveTopic={useActiveTopic}

View File

@@ -112,7 +112,7 @@ export function TopicList({
<Flex <Flex
position={"relative"} position={"relative"}
w={"100%"} w={"100%"}
h={"100%"} h={"95%"}
flexDirection={"column"} flexDirection={"column"}
justify={"center"} justify={"center"}
align={"center"} align={"center"}

View File

@@ -7,6 +7,7 @@ import { FaPen } from "react-icons/fa";
type TranscriptTitle = { type TranscriptTitle = {
title: string; title: string;
transcriptId: string; transcriptId: string;
onUpdate?: (newTitle: string) => void;
}; };
const TranscriptTitle = (props: TranscriptTitle) => { const TranscriptTitle = (props: TranscriptTitle) => {
@@ -25,6 +26,9 @@ const TranscriptTitle = (props: TranscriptTitle) => {
transcriptId, transcriptId,
requestBody, requestBody,
}); });
if (props.onUpdate) {
props.onUpdate(newTitle);
}
console.log("Updated transcript:", updatedTranscript); console.log("Updated transcript:", updatedTranscript);
} catch (err) { } catch (err) {
console.error("Failed to update transcript:", err); console.error("Failed to update transcript:", err);

View File

@@ -8,18 +8,21 @@ type ErrorTranscript = {
error: Error; error: Error;
loading: false; loading: false;
response: null; response: null;
reload: () => void;
}; };
type LoadingTranscript = { type LoadingTranscript = {
response: null; response: null;
loading: true; loading: true;
error: false; error: false;
reload: () => void;
}; };
type SuccessTranscript = { type SuccessTranscript = {
response: GetTranscript; response: GetTranscript;
loading: false; loading: false;
error: null; error: null;
reload: () => void;
}; };
const useTranscript = ( const useTranscript = (
@@ -28,13 +31,17 @@ const useTranscript = (
const [response, setResponse] = useState<GetTranscript | null>(null); const [response, setResponse] = useState<GetTranscript | null>(null);
const [loading, setLoading] = useState<boolean>(true); const [loading, setLoading] = useState<boolean>(true);
const [error, setErrorState] = useState<Error | null>(null); const [error, setErrorState] = useState<Error | null>(null);
const [reload, setReload] = useState(0);
const { setError } = useError(); const { setError } = useError();
const api = useApi(); const api = useApi();
const reloadHandler = () => setReload((prev) => prev + 1);
useEffect(() => { useEffect(() => {
if (!id || !api) return; if (!id || !api) return;
setLoading(true); if (!response) {
setLoading(true);
}
api api
.v1TranscriptGet({ transcriptId: id }) .v1TranscriptGet({ transcriptId: id })
@@ -52,9 +59,9 @@ const useTranscript = (
} }
setErrorState(error); setErrorState(error);
}); });
}, [id, !api]); }, [id, !api, reload]);
return { response, loading, error } as return { response, loading, error, reload: reloadHandler } as
| ErrorTranscript | ErrorTranscript
| LoadingTranscript | LoadingTranscript
| SuccessTranscript; | SuccessTranscript;