Skip to content

Commit

Permalink
Disable search global shortcut in translation tool
Browse files Browse the repository at this point in the history
  • Loading branch information
vicr123 committed Feb 6, 2025
1 parent bb0d354 commit 06fbc5e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Parlance.ClientApp/src/components/NavMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import LoginUsernameModal from "./modals/account/LoginUsernameModal";
import UserManager from "../helpers/UserManager";
import UserModal from "./modals/account/UserModal";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { useMatch, useNavigate } from "react-router-dom";
import ParlanceLogo from "../images/parlance.svg";
import Icon from "@/components/Icon";
import { GlobalSearch } from "@/components/search/GlobalSearch";
Expand All @@ -20,14 +20,21 @@ export default function NavMenu() {
const [globalSearchOpen, setGlobalSearchOpen] = useState(false);
const [overlayMenuOpen, setOverlayMenuOpen] = useState(false);
const isMobile = useMediaQuery("(max-width: 600px)");
const isInTranslation = useMatch(
"/projects/:project/:subproject/:language/translate/*",
);

useHotkeys(
navigator.userAgent.toLowerCase().includes("mac")
? "Meta+k"
: "Control+k",
() => {
e => {
e.preventDefault();
setGlobalSearchOpen(x => !x);
},
{
enabled: !isInTranslation,
},
);

UserManager.on("currentUserChanged", () => {
Expand Down

0 comments on commit 06fbc5e

Please sign in to comment.