adds loading indicator

This commit is contained in:
Sara
2023-09-22 15:50:38 +02:00
parent 58505ec09b
commit b989f2b54a
2 changed files with 22 additions and 4 deletions

View File

@@ -9,9 +9,10 @@ import useAudioDevice from "../useAudioDevice";
import "../../styles/button.css"; import "../../styles/button.css";
import { Topic } from "../webSocketTypes"; import { Topic } from "../webSocketTypes";
import getApi from "../../lib/getApi"; import getApi from "../../lib/getApi";
import AudioInputsDropdown from "../audioInputsDropdown";
import LiveTrancription from "../liveTranscription"; import LiveTrancription from "../liveTranscription";
import DisconnectedIndicator from "../disconnectedIndicator"; import DisconnectedIndicator from "../disconnectedIndicator";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faGear } from "@fortawesome/free-solid-svg-icons";
const TranscriptCreate = () => { const TranscriptCreate = () => {
const [stream, setStream] = useState<MediaStream | null>(null); const [stream, setStream] = useState<MediaStream | null>(null);
@@ -40,6 +41,7 @@ const TranscriptCreate = () => {
requestPermission, requestPermission,
getAudioStream, getAudioStream,
} = useAudioDevice(); } = useAudioDevice();
const [hasRecorded, setHasRecorded] = useState(false);
return ( return (
<> <>
@@ -50,6 +52,7 @@ const TranscriptCreate = () => {
onStop={() => { onStop={() => {
webRTC?.peer?.send(JSON.stringify({ cmd: "STOP" })); webRTC?.peer?.send(JSON.stringify({ cmd: "STOP" }));
setStream(null); setStream(null);
setHasRecorded(true);
}} }}
topics={webSockets.topics} topics={webSockets.topics}
getAudioStream={getAudioStream} getAudioStream={getAudioStream}
@@ -64,9 +67,21 @@ const TranscriptCreate = () => {
useActiveTopic={useActiveTopic} useActiveTopic={useActiveTopic}
/> />
<section className="w-full h-full bg-blue-400/20 rounded-lg md:rounded-xl px-2 md:px-4 flex flex-col justify-center align-center"> <section className="w-full h-full bg-blue-400/20 rounded-lg md:rounded-xl px-2 md:px-4 flex flex-col justify-center align-center">
<div className="py-2 h-auto"> {!hasRecorded ? (
<LiveTrancription text={webSockets.transcriptText} /> <div className="py-2 h-auto">
</div> <LiveTrancription text={webSockets.transcriptText} />
</div>
) : (
<div className="flex flex-col justify-center align center text-center">
<div className="p-4">
<FontAwesomeIcon
icon={faGear}
className="animate-spin-slow h-20 w-20"
/>
</div>
<p>Your final summary is being processed.</p>
</div>
)}
</section> </section>
</div> </div>

View File

@@ -12,6 +12,9 @@ module.exports = {
layout: "auto auto minmax(0, 1fr)", layout: "auto auto minmax(0, 1fr)",
"mobile-inner": "minmax(0, 2fr) minmax(0, 1fr)", "mobile-inner": "minmax(0, 2fr) minmax(0, 1fr)",
}, },
animation: {
"spin-slow": "spin 3s linear infinite",
},
}, },
}, },
plugins: [], plugins: [],