Metamigo frontend build fixes

This commit is contained in:
Darren Clarke 2023-05-25 08:57:24 +00:00
parent 7aeb903a9e
commit de17d54434
3 changed files with 15 additions and 13 deletions

View file

@ -4,7 +4,7 @@ import dynamic from "next/dynamic";
import MicIcon from "@mui/icons-material/Mic";
import StopIcon from "@mui/icons-material/Stop";
import Button from "@mui/material/Button";
import { makeStyles, useTheme } from "@mui/material/styles";
import { useTheme } from "@mui/material/styles"; // makeStyles,
// import AudioPlayer from "material-ui-audio-player";
import { useStopwatch } from "react-timer-hook";
import style from "./MicInput.module.css";
@ -43,22 +43,22 @@ const blobToResult = async (blob: Blob) => {
return result;
};
const resultToDataUri = (result: Record<string, any>): string => {
/* const resultToDataUri = (result: Record<string, any>): string => {
if (!result || !result["audio/webm"]) return "";
const base64 = result["audio/webm"];
const r = `data:audio/webm;base64,${base64}`;
return r;
};
}; */
const MicInput = (props: any) => {
const { seconds, minutes, hours, start, reset, pause } = useStopwatch();
const theme = useTheme();
const {
field: { value, onChange },
field: { onChange }, // value
} = useInput(props);
const [record, setRecorder] = useState({ record: false });
const decodedValue = resultToDataUri(value);
// const decodedValue = resultToDataUri(value);
const startRecording = () => {
setRecorder({ record: true });
reset();
@ -80,11 +80,12 @@ const MicInput = (props: any) => {
}
const isRecording = record.record;
const canPlay = !isRecording && decodedValue;
// const canPlay = !isRecording && decodedValue;
const duration = `${hours.toString().padStart(2, "0")}:${minutes
.toString()
.padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
/*
const useStyles = makeStyles(() => ({
volumeIcon: {
display: "none",
@ -93,7 +94,7 @@ const MicInput = (props: any) => {
display: "none",
},
}));
*/
return (
<div className="MuiFormControl-marginDense RaFormInput-input-40">
<div className={style.content}>

View file

@ -1,4 +1,5 @@
/* eslint-disable unicorn/no-null */
/* eslint-disable max-params */
import type { Adapter } from "next-auth/adapters";
// @ts-expect-error: Missing export
import type { AppOptions } from "next-auth";
@ -17,7 +18,7 @@ export interface Profile {
createdBy: string;
}
export type User = Profile & { id: string; createdAt: Date; updatedAt: Date };
export type User = Profile & { id: string; createdAt: Date; updatedAt: Date; };
export interface Session {
userId: string;

View file

@ -13,11 +13,11 @@ export const sanitizeE164Number = (phoneNumber: string) => {
if (!phoneNumber) return "";
if (!phoneNumber.trim()) return "";
const sanitized = phoneNumber
.replace(/\s/g, "")
.replace(/\./g, "")
.replace(/-/g, "")
.replace(/\(/g, "")
.replace(/\)/g, "");
.replaceAll(/\s/g, "")
.replaceAll(".", "")
.replaceAll("-", "")
.replaceAll("(", "")
.replaceAll(")", "");
if (sanitized[0] !== "+") return `+${sanitized}`;
return sanitized;