Refactor based on NextJS 13 Routing / Dir Layout

This commit is contained in:
Koper
2023-08-14 19:50:25 +07:00
parent 63636b52e1
commit eb4fd6dcd0
15 changed files with 22 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
import "./globals.scss"; import "./styles/globals.scss";
import { Roboto } from "next/font/google"; import { Roboto } from "next/font/google";
import Head from "next/head"; import Head from "next/head";

View File

@@ -17,15 +17,3 @@ export function Mulberry32(seed) {
return ((t ^ (t >>> 14)) >>> 0) / 4294967296; return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
}; };
} }
export const formatTime = (seconds) => {
let hours = Math.floor(seconds / 3600);
let minutes = Math.floor((seconds % 3600) / 60);
let secs = Math.floor(seconds % 60);
let timeString = `${hours > 0 ? hours + ":" : ""}${minutes
.toString()
.padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
return timeString;
};

11
www/app/lib/time.js Normal file
View File

@@ -0,0 +1,11 @@
export const formatTime = (seconds) => {
let hours = Math.floor(seconds / 3600);
let minutes = Math.floor((seconds % 3600) / 60);
let secs = Math.floor(seconds % 60);
let timeString = `${hours > 0 ? hours + ":" : ""}${minutes
.toString()
.padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
return timeString;
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

View File

@@ -1,11 +1,11 @@
"use client"; "use client";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import Recorder from "./components/record.js"; import Recorder from "../recorder";
import { Dashboard } from "./components/dashboard.js"; import { Dashboard } from "../dashboard";
import useWebRTC from "./components/webrtc.js"; import useWebRTC from "../useWebRTC";
import useTranscript from "./components/transcript.js"; import useTranscript from "../useTranscript";
import { useWebSockets } from "./components/websocket.js"; import { useWebSockets } from "../useWebSockets";
import "../public/button.css"; import "../../styles/button.css";
const App = () => { const App = () => {
const [stream, setStream] = useState(null); const [stream, setStream] = useState(null);
@@ -39,6 +39,9 @@ const App = () => {
setStream(null); setStream(null);
}} }}
/> />
<hr />
<Dashboard <Dashboard
transcriptionText={webSockets.transcriptText} transcriptionText={webSockets.transcriptText}
finalSummary={webSockets.finalSummary} finalSummary={webSockets.finalSummary}

View File

@@ -9,7 +9,7 @@ import Dropdown from "react-dropdown";
import "react-dropdown/style.css"; import "react-dropdown/style.css";
import CustomRecordPlugin from "./CustomRecordPlugin"; import CustomRecordPlugin from "./CustomRecordPlugin";
import { formatTime } from "../utils"; import { formatTime } from "../lib/time";
const AudioInputsDropdown = (props) => { const AudioInputsDropdown = (props) => {
const [ddOptions, setDdOptions] = useState([]); const [ddOptions, setDdOptions] = useState([]);

View File

@@ -1,5 +0,0 @@
// A faulty API route to test Sentry's error monitoring
export default function handler(_req, res) {
throw new Error("Sentry Example API Route Error");
res.status(200).json({ name: "John Doe" });
}