Skip to content

Commit

Permalink
Merge pull request #197 from sopra-fs24-group-09/toast-z-index
Browse files Browse the repository at this point in the history
lift up z-index of toast.
  • Loading branch information
petertheprocess authored May 20, 2024
2 parents d6be12d + 8f6f755 commit aba26d5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
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;
}

0 comments on commit aba26d5

Please sign in to comment.