shortcuts for announcements
This commit is contained in:
@@ -12,6 +12,7 @@ import { useAuth } from "./authContext";
|
|||||||
import { SendService } from "../services/sendService";
|
import { SendService } from "../services/sendService";
|
||||||
import { useTeamDashboardContext } from "./teamDashboardContext";
|
import { useTeamDashboardContext } from "./teamDashboardContext";
|
||||||
import isValidHttpUrl from "../helpers/urlHelper";
|
import isValidHttpUrl from "../helpers/urlHelper";
|
||||||
|
import { GlobalHotKeys, KeyMap } from "react-hotkeys";
|
||||||
|
|
||||||
interface KeyboardContextInterface {
|
interface KeyboardContextInterface {
|
||||||
selectedTeammate: string; // can only have one selected
|
selectedTeammate: string; // can only have one selected
|
||||||
@@ -22,10 +23,6 @@ interface KeyboardContextInterface {
|
|||||||
|
|
||||||
isRecording: Boolean; // can only record if someone is selected or maybe for an announcement
|
isRecording: Boolean; // can only record if someone is selected or maybe for an announcement
|
||||||
|
|
||||||
// inputDevice: string;
|
|
||||||
|
|
||||||
// outputDevice: string;
|
|
||||||
|
|
||||||
isMuted: Boolean;
|
isMuted: Boolean;
|
||||||
isSilenceMode: Boolean; // won't automatically listen to notifications or sounds
|
isSilenceMode: Boolean; // won't automatically listen to notifications or sounds
|
||||||
muteOrUnmute: Function;
|
muteOrUnmute: Function;
|
||||||
@@ -529,8 +526,31 @@ export default function KeyboardContextProvider({ children }) {
|
|||||||
setAudioQueue((prevQueue) => [...prevQueue, ...urls]);
|
setAudioQueue((prevQueue) => [...prevQueue, ...urls]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startAnnouncement() {
|
||||||
|
toast.success("recording announcement");
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendAnnouncement() {
|
||||||
|
toast.success("announcement sent to team");
|
||||||
|
}
|
||||||
|
|
||||||
|
const keyMap: KeyMap = {
|
||||||
|
RECORD_ANNOUNCEMENT: "a",
|
||||||
|
STOP_RECORDING_ANNOUNCEMENT: {
|
||||||
|
name: "Stop recording",
|
||||||
|
sequence: "a",
|
||||||
|
action: "keyup",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const handlers = {
|
||||||
|
RECORD_ANNOUNCEMENT: startAnnouncement,
|
||||||
|
STOP_RECORDING_ANNOUNCEMENT: sendAnnouncement,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<KeyboardContext.Provider value={value}>
|
<KeyboardContext.Provider value={value}>
|
||||||
|
<GlobalHotKeys keyMap={keyMap} handlers={handlers} />
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
|
|
||||||
{/* player for audio messages */}
|
{/* player for audio messages */}
|
||||||
|
|||||||
Reference in New Issue
Block a user