mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
Fixes discussed during call w/ Mathieu
This commit is contained in:
@@ -35,6 +35,6 @@ body {
|
|||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.audio-source-dropdown .Dropdown-control {
|
.audio-source-dropdown .Dropdown-control {
|
||||||
max-width: 90px;
|
max-width: 200px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,11 @@ export function Dashboard({
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{topics.length === 0 && (
|
{topics.length === 0 && (
|
||||||
<div className="text-center text-gray-500">No topics yet</div>
|
<div className="text-center text-gray-500">
|
||||||
|
Discussion topics will appear here after you start recording. It
|
||||||
|
may take up to 5 minutes of conversation for the first topic to
|
||||||
|
appear.
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const App = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const api = getApi();
|
const api = getApi();
|
||||||
const transcript = useTranscript();
|
const transcript = useTranscript(api);
|
||||||
const webRTC = useWebRTC(stream, transcript.response?.id, api);
|
const webRTC = useWebRTC(stream, transcript.response?.id, api);
|
||||||
const webSockets = useWebSockets(transcript.response?.id);
|
const webSockets = useWebSockets(transcript.response?.id);
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export default function Recorder(props: RecorderProps) {
|
|||||||
const [wavesurfer, setWavesurfer] = useState<WaveSurfer | null>(null);
|
const [wavesurfer, setWavesurfer] = useState<WaveSurfer | null>(null);
|
||||||
const [record, setRecord] = useState<RecordPlugin | null>(null);
|
const [record, setRecord] = useState<RecordPlugin | null>(null);
|
||||||
const [isRecording, setIsRecording] = useState<boolean>(false);
|
const [isRecording, setIsRecording] = useState<boolean>(false);
|
||||||
|
const [hasRecorded, setHasRecorded] = useState<boolean>(false);
|
||||||
const [isPlaying, setIsPlaying] = useState<boolean>(false);
|
const [isPlaying, setIsPlaying] = useState<boolean>(false);
|
||||||
const [deviceId, setDeviceId] = useState<string | null>(null);
|
const [deviceId, setDeviceId] = useState<string | null>(null);
|
||||||
const [currentTime, setCurrentTime] = useState<number>(0);
|
const [currentTime, setCurrentTime] = useState<number>(0);
|
||||||
@@ -210,8 +211,7 @@ export default function Recorder(props: RecorderProps) {
|
|||||||
props.onStop();
|
props.onStop();
|
||||||
record.stopRecording();
|
record.stopRecording();
|
||||||
setIsRecording(false);
|
setIsRecording(false);
|
||||||
const playBtn = document.getElementById("play-btn");
|
setHasRecorded(true);
|
||||||
if (playBtn) playBtn.removeAttribute("disabled");
|
|
||||||
} else {
|
} else {
|
||||||
const stream = await props.getAudioStream(deviceId);
|
const stream = await props.getAudioStream(deviceId);
|
||||||
props.setStream(stream);
|
props.setStream(stream);
|
||||||
@@ -236,36 +236,45 @@ export default function Recorder(props: RecorderProps) {
|
|||||||
return (
|
return (
|
||||||
<div className="relative flex flex-col items-center justify-center max-w-[75vw] w-full">
|
<div className="relative flex flex-col items-center justify-center max-w-[75vw] w-full">
|
||||||
<div className="flex my-2 mx-auto audio-source-dropdown">
|
<div className="flex my-2 mx-auto audio-source-dropdown">
|
||||||
<AudioInputsDropdown
|
{!hasRecorded && (
|
||||||
audioDevices={props.audioDevices}
|
<>
|
||||||
setDeviceId={setDeviceId}
|
<AudioInputsDropdown
|
||||||
disabled={isRecording}
|
audioDevices={props.audioDevices}
|
||||||
/>
|
setDeviceId={setDeviceId}
|
||||||
|
disabled={isRecording}
|
||||||
<button
|
/>
|
||||||
className="w-20"
|
|
||||||
onClick={handleRecClick}
|
<button
|
||||||
data-color={isRecording ? "red" : "blue"}
|
className="w-20"
|
||||||
disabled={!deviceId}
|
onClick={handleRecClick}
|
||||||
>
|
data-color={isRecording ? "red" : "blue"}
|
||||||
{isRecording ? "Stop" : "Record"}
|
disabled={!deviceId}
|
||||||
</button>
|
>
|
||||||
|
{isRecording ? "Stop" : "Record"}
|
||||||
<button
|
</button>
|
||||||
className="w-20"
|
|
||||||
id="play-btn"
|
</>
|
||||||
onClick={handlePlayClick}
|
)}
|
||||||
data-color={isPlaying ? "orange" : "green"}
|
|
||||||
>
|
{hasRecorded && (
|
||||||
{isPlaying ? "Pause" : "Play"}
|
<>
|
||||||
</button>
|
<button
|
||||||
<a
|
className="w-20"
|
||||||
id="download-recording"
|
id="play-btn"
|
||||||
title="Download recording"
|
onClick={handlePlayClick}
|
||||||
className="invisible w-9 m-auto text-center cursor-pointer text-blue-300 hover:text-blue-700"
|
data-color={isPlaying ? "orange" : "green"}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={faDownload} />
|
{isPlaying ? "Pause" : "Play"}
|
||||||
</a>
|
</button>
|
||||||
|
<a
|
||||||
|
id="download-recording"
|
||||||
|
title="Download recording"
|
||||||
|
className="invisible w-9 m-auto text-center cursor-pointer text-blue-300 hover:text-blue-700"
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={faDownload} />
|
||||||
|
</a>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div ref={waveformRef} className="w-full shadow-xl rounded-2xl"></div>
|
<div ref={waveformRef} className="w-full shadow-xl rounded-2xl"></div>
|
||||||
<div className="absolute bottom-0 right-2 text-xs text-black">
|
<div className="absolute bottom-0 right-2 text-xs text-black">
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { DefaultApi, V1TranscriptsCreateRequest } from "../api/apis/DefaultApi";
|
import { DefaultApi, V1TranscriptsCreateRequest } from "../api/apis/DefaultApi";
|
||||||
import { Configuration } from "../api/runtime";
|
|
||||||
import { GetTranscript } from "../api";
|
import { GetTranscript } from "../api";
|
||||||
import getApi from "../lib/getApi";
|
import getApi from "../lib/getApi";
|
||||||
|
|
||||||
@@ -11,13 +10,11 @@ type UseTranscript = {
|
|||||||
createTranscript: () => void;
|
createTranscript: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useTranscript = (): UseTranscript => {
|
const useTranscript = (api: DefaultApi): UseTranscript => {
|
||||||
const [response, setResponse] = useState<GetTranscript | null>(null);
|
const [response, setResponse] = useState<GetTranscript | null>(null);
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
const api = getApi();
|
|
||||||
|
|
||||||
const createTranscript = () => {
|
const createTranscript = () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const requestParameters: V1TranscriptsCreateRequest = {
|
const requestParameters: V1TranscriptsCreateRequest = {
|
||||||
|
|||||||
Reference in New Issue
Block a user