diff --git a/pages/_app.tsx b/pages/_app.tsx index 3e434a2ed2..a056c3f72c 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -10,7 +10,7 @@ import { useRouter } from 'next/router'; import NextNProgress from 'nextjs-progressbar'; import { useEffect, useState } from 'react'; import AppLayout from 'src/components/AppLayout'; -import CMDK from 'src/components/CMDK'; +// import CMDK from 'src/components/CMDK'; import { antdTheme } from 'styles/antdTheme'; import { ApiContextProvider } from '~src/context/ApiContext'; @@ -93,7 +93,7 @@ function App({ Component, pageProps }: AppProps) { {showSplashScreen && }
- + {/* */} (false); const [justStart, setJustStart] = useState(true); const currentUser = useUserDetailsSelector(); + const inputRef = useRef(null); + + useEffect(() => { + if (openModal) { + setTimeout(() => inputRef.current?.focus(), 0); + } + }, [openModal]); Object.keys(post_topic).map((topic) => topicOptions.push(topicToOptionText(topic))); @@ -491,6 +498,7 @@ const NewSearch = ({ className, openModal, setOpenModal, isSuperSearch, setIsSup >
= (props) => { const [isSuperSearch, setIsSuperSearch] = useState(false); const { resolvedTheme: theme } = useTheme(); + useEffect(() => { + const handleKeyDown = (event: KeyboardEvent) => { + if ((event.metaKey || event.ctrlKey) && event.key === 'k') { + setOpen((prev) => !prev); + } + }; + document.addEventListener('keydown', handleKeyDown); + return () => { + document.removeEventListener('keydown', handleKeyDown); + }; + }, [open]); + return allowedNetwork.includes(network?.toUpperCase()) ? (
{isSmallScreen ? (