From 68899bd9bf397eccdf22dcfa1085c6fe7cb6b74d Mon Sep 17 00:00:00 2001 From: Jose B Date: Tue, 18 Jul 2023 17:36:30 -0500 Subject: [PATCH] re-arrange code --- app/components/audioVisualizer.js | 5 +---- app/components/dashboard.js | 27 ++++----------------------- app/components/record.js | 23 ++++++++++------------- app/page.js | 24 ++++++++++++++++-------- 4 files changed, 31 insertions(+), 48 deletions(-) diff --git a/app/components/audioVisualizer.js b/app/components/audioVisualizer.js index 12954d63..fedaa5da 100644 --- a/app/components/audioVisualizer.js +++ b/app/components/audioVisualizer.js @@ -56,10 +56,7 @@ function AudioVisualizer(props) { }, []); return ( - <> -

Is recording: {props.isRecording ? "true" : "false"}

- - + ); } diff --git a/app/components/dashboard.js b/app/components/dashboard.js index 952c7f47..d8dd0aa3 100644 --- a/app/components/dashboard.js +++ b/app/components/dashboard.js @@ -1,13 +1,10 @@ import { Mulberry32 } from "../utils.js"; import React, { useState, useEffect } from "react"; -import AudioVisualizer from "./audioVisualizer.js"; export function Dashboard(props) { const [openIndex, setOpenIndex] = useState(null); const [liveTranscript, setLiveTranscript] = useState(""); - const [fakeTranscriptIndex, setFakeTranscriptIndex] = useState(0); - const fakeTranscripts = [ "This is the first transcript. We are discussing the current situation of our company. We are currently leading the market with a significant margin, and our future outlook is also very promising...", "Here is the second transcript. We are now moving to our next topic, which is the progress in our ongoing projects. Most of them are on schedule and the quality of work is up to our standard...", @@ -104,11 +101,7 @@ export function Dashboard(props) { return ( <> -
-
-

Reflector

-

Capture The Signal, Not The Noise

-
+
Timestamp
Topic
@@ -136,11 +129,11 @@ export function Dashboard(props) {
{openIndex === index && ( -
{item.transcript}
+
{item.transcript}
)}
))} -
+
Live
Transcript
@@ -148,21 +141,9 @@ export function Dashboard(props) { {generateDecibelGraph(generateDecibelData())}
-
{liveTranscript}
+
{liveTranscript}
- - - -
- Reflector © 2023 Monadical -
); diff --git a/app/components/record.js b/app/components/record.js index 03c9c4aa..26bcc984 100644 --- a/app/components/record.js +++ b/app/components/record.js @@ -1,4 +1,6 @@ -export default function Record(props) { +import AudioVisualizer from "./audioVisualizer.js"; + +export default function Recorder(props) { let mediaRecorder = null; // mediaRecorder instance const startRecording = () => { @@ -17,23 +19,18 @@ export default function Record(props) { }; return ( -
-
-

Reflector

-

Capture The Signal, Not The Noise

-
+
+ {props.isRecording && } -
- {!props.isRecording ? ( - - ) : ( + {props.isRecording ? ( + ) : ( + )}
-
); } diff --git a/app/page.js b/app/page.js index 563a9942..5130b47a 100644 --- a/app/page.js +++ b/app/page.js @@ -1,6 +1,6 @@ "use client"; import React, { useState, useEffect } from "react"; -import Record from "./components/record.js"; +import Recorder from "./components/record.js"; import { Dashboard } from "./components/dashboard.js"; import useWebRTC from "./components/webrtc.js"; import "../public/button.css"; @@ -36,19 +36,27 @@ const App = () => { console.log(serverData); return ( -
- {splashScreen && ( - handleRecord(recording)} - /> - )} +
+
+

Reflector

+

Capture The Signal, Not The Noise

+
+ + handleRecord(recording)} + /> + {!splashScreen && ( handleRecord(recording)} /> )} + +
); };