From f85c57bda1db87704c710fa0772440e4e805316a Mon Sep 17 00:00:00 2001 From: Sara Date: Thu, 7 Dec 2023 17:06:01 +0100 Subject: [PATCH] mock topics FE --- www/app/[domain]/transcripts/mockTopics.json | 31 ++++++++++++++++++++ www/app/[domain]/transcripts/useTopics.ts | 14 ++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 www/app/[domain]/transcripts/mockTopics.json diff --git a/www/app/[domain]/transcripts/mockTopics.json b/www/app/[domain]/transcripts/mockTopics.json new file mode 100644 index 00000000..2e974dac --- /dev/null +++ b/www/app/[domain]/transcripts/mockTopics.json @@ -0,0 +1,31 @@ +[ + { + "id": "27c07e49-d7a3-4b86-905c-f1a047366f91", + "title": "Issue one", + "summary": "The team discusses the first issue in the list", + "timestamp": 0.0, + "transcript": "", + "segments": [ + { + "text": "Let's start with issue one, Alice you've been working on that, can you give an update ?", + "start": 0.0, + "speaker": 0 + }, + { + "text": "Yes, I've run into an issue with the task system but Bob helped me out and I have a POC ready, should I present it now ?", + "start": 0.38, + "speaker": 1 + }, + { + "text": "Yeah, I had to modify the task system because it didn't account for incoming blobs", + "start": 4.5, + "speaker": 2 + }, + { + "text": "Cool, yeah lets see it", + "start": 5.96, + "speaker": 0 + } + ] + } +] diff --git a/www/app/[domain]/transcripts/useTopics.ts b/www/app/[domain]/transcripts/useTopics.ts index de4097b3..4f640024 100644 --- a/www/app/[domain]/transcripts/useTopics.ts +++ b/www/app/[domain]/transcripts/useTopics.ts @@ -1,12 +1,10 @@ import { useEffect, useState } from "react"; -import { - DefaultApi, - V1TranscriptGetTopicsRequest, -} from "../../api/apis/DefaultApi"; +import { V1TranscriptGetTopicsRequest } from "../../api/apis/DefaultApi"; import { useError } from "../../(errors)/errorContext"; import { Topic } from "./webSocketTypes"; import getApi from "../../lib/getApi"; import { shouldShowError } from "../../lib/errorUtils"; +import mockTopics from "./mockTopics.json"; type TranscriptTopics = { topics: Topic[] | null; @@ -21,6 +19,14 @@ const useTopics = (id: string): TranscriptTopics => { const { setError } = useError(); const api = getApi(); + useEffect(() => { + document.onkeyup = (e) => { + if (e.key === "t" && process.env.NEXT_PUBLIC_ENV === "development") { + setTopics(mockTopics); + } + }; + }); + useEffect(() => { if (!id || !api) return;