Updated the yarn version and recorder
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -36,3 +36,4 @@ yarn-error.log*
|
||||
next-env.d.ts
|
||||
|
||||
.env
|
||||
.yarn/*
|
||||
18536
.pnp.cjs
generated
Executable file
18536
.pnp.cjs
generated
Executable file
File diff suppressed because one or more lines are too long
2047
.pnp.loader.mjs
generated
Normal file
2047
.pnp.loader.mjs
generated
Normal file
File diff suppressed because it is too large
Load Diff
6
.vscode/extensions.json
vendored
Normal file
6
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"arcanis.vscode-zipfs",
|
||||
"dbaeumer.vscode-eslint"
|
||||
]
|
||||
}
|
||||
9
.vscode/settings.json
vendored
Normal file
9
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"search.exclude": {
|
||||
"**/.yarn": true,
|
||||
"**/.pnp.*": true
|
||||
},
|
||||
"eslint.nodePath": ".yarn/sdks",
|
||||
"typescript.tsdk": ".yarn/sdks/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
||||
}
|
||||
@@ -37,6 +37,7 @@
|
||||
"react-icons": "^4.8.0",
|
||||
"react-lineto": "^3.3.0",
|
||||
"react-media-recorder": "^1.6.6",
|
||||
"react-mic": "^12.4.6",
|
||||
"react-player": "^2.12.0",
|
||||
"react-string-replace": "^1.1.0",
|
||||
"react-toastify": "^9.1.2",
|
||||
|
||||
70
src/pages/test.tsx
Normal file
70
src/pages/test.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
import Head from "next/head";
|
||||
import Navbar from "@/components/Navbar";
|
||||
|
||||
import {ToastContainer} from "react-toastify";
|
||||
import {withIronSessionSsr} from "iron-session/next";
|
||||
import {sessionOptions} from "@/lib/session";
|
||||
import useUser from "@/hooks/useUser";
|
||||
import Sidebar from "@/components/Sidebar";
|
||||
import {ReactMediaRecorder} from "react-media-recorder";
|
||||
|
||||
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
const user = req.session.user;
|
||||
|
||||
if (!user) {
|
||||
res.setHeader("location", "/login");
|
||||
res.statusCode = 302;
|
||||
res.end();
|
||||
return {
|
||||
props: {
|
||||
user: null,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
props: {user: req.session.user},
|
||||
};
|
||||
}, sessionOptions);
|
||||
|
||||
export default function Page() {
|
||||
const {user} = useUser({redirectTo: "/login"});
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Exam | IELTS GPT</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="A training platform for the IELTS exam provided by the Muscat Training Institute and developed by eCrop."
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
<ToastContainer />
|
||||
{user && (
|
||||
<main className="w-full h-[100vh] flex flex-col bg-mti-gray-smoke">
|
||||
<Navbar user={user} />
|
||||
<div className="h-full w-full flex py-4 pb-8 gap-2">
|
||||
<Sidebar path="/exam" />
|
||||
<div className="w-5/6 h-full mr-8 bg-white shadow-md rounded-2xl p-12 flex flex-col gap-12">
|
||||
<ReactMediaRecorder
|
||||
audio
|
||||
askPermissionOnMount
|
||||
render={({status, startRecording, stopRecording, mediaBlobUrl}) => (
|
||||
<div>
|
||||
<p>{status}</p>
|
||||
<button onClick={startRecording}>Start Recording</button>
|
||||
<button onClick={stopRecording}>Stop Recording</button>
|
||||
<audio src={mediaBlobUrl} controls autoPlay loop />
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user