Put PTTButton shortcuts behind the new shortcut
This commit is contained in:
parent
b30ef953b4
commit
c67e7ebc2c
1 changed files with 13 additions and 0 deletions
|
@ -23,6 +23,7 @@ import { ReactComponent as MicIcon } from "../icons/Mic.svg";
|
||||||
import { useEventTarget } from "../useEvents";
|
import { useEventTarget } from "../useEvents";
|
||||||
import { Avatar } from "../Avatar";
|
import { Avatar } from "../Avatar";
|
||||||
import { usePrefersReducedMotion } from "../usePrefersReducedMotion";
|
import { usePrefersReducedMotion } from "../usePrefersReducedMotion";
|
||||||
|
import { getSetting } from "../settings/useSetting";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
@ -134,6 +135,12 @@ export const PTTButton: React.FC<Props> = ({
|
||||||
(e: KeyboardEvent) => {
|
(e: KeyboardEvent) => {
|
||||||
if (e.code === "Space") {
|
if (e.code === "Space") {
|
||||||
if (!enabled) return;
|
if (!enabled) return;
|
||||||
|
// Check if keyboard shortcuts are enabled
|
||||||
|
const keyboardShortcuts = getSetting("keyboard-shortcuts", true);
|
||||||
|
if (!keyboardShortcuts) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
hold();
|
hold();
|
||||||
|
@ -148,6 +155,12 @@ export const PTTButton: React.FC<Props> = ({
|
||||||
useCallback(
|
useCallback(
|
||||||
(e: KeyboardEvent) => {
|
(e: KeyboardEvent) => {
|
||||||
if (e.code === "Space") {
|
if (e.code === "Space") {
|
||||||
|
// Check if keyboard shortcuts are enabled
|
||||||
|
const keyboardShortcuts = getSetting("keyboard-shortcuts", true);
|
||||||
|
if (!keyboardShortcuts) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
unhold();
|
unhold();
|
||||||
|
|
Loading…
Add table
Reference in a new issue