Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lift up z-index of toast. #197

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/ui/AudioRecorder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import { IoMdMicrophone, IoMdCheckmark } from "react-icons/io";
import "../../styles/ui/AudioRecorder.scss";
import PropType from "prop-types";
import { Base64audio } from "types";
import { showToast } from "../../helpers/toastService"

// stop recording after 5 seconds
const MAX_RECORDING_TIME = 5000;
const MIC_PERMISSION_TOAST_DURATION = 5000;

export const AudioRecorder = React.forwardRef((props, ref) => {
const waveformRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -271,6 +273,9 @@ export const AudioRecorder = React.forwardRef((props, ref) => {
.then((stream) => {
recorder.current?.startRecording();
setIsRecording(true);
})
.catch((error) => {
showToast("Failed to get microphone access, please check your browser setting.", "error", MIC_PERMISSION_TOAST_DURATION);
});
// once recording is started, enable interaction
// should be placed in onRecordEnd event, but it's not working
Expand Down
2 changes: 1 addition & 1 deletion src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const MAX_PASSWORD_LENGTH = 20;

export const MAX_ROOM_NAME_LENGTH = 10;

export const DEFAULT_TIMEOUT = 1500;
export const DEFAULT_TIMEOUT = 2000;

export const HTTP_STATUS = {
OK: 200,
Expand Down
1 change: 1 addition & 0 deletions src/helpers/toastService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { toast } from "react-toastify";
import { DEFAULT_TIMEOUT } from "../constants/constants"
import "styles/views/toast.scss"

export function showToast(message, type = "info", duration = DEFAULT_TIMEOUT) {
toast(message, {
Expand Down
3 changes: 3 additions & 0 deletions src/styles/views/toast.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Toastify{
--toastify-z-index: 999999;
}
Loading