fix: disabled shortcut create new thread on starter screen (#4074)

This commit is contained in:
Faisal Amir 2024-11-22 12:53:04 +07:00 committed by GitHub
parent 1c68c819ca
commit 8b485ba44f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,8 @@ import { MainViewState } from '@/constants/screens'
import { useCreateNewThread } from '@/hooks/useCreateNewThread'
import { useStarterScreen } from '@/hooks/useStarterScreen'
import {
mainViewStateAtom,
showLeftPanelAtom,
@ -32,6 +34,7 @@ export default function KeyListener({ children }: Props) {
const assistants = useAtomValue(assistantsAtom)
const activeThread = useAtomValue(activeThreadAtom)
const setModalActionThread = useSetAtom(modalActionThreadAtom)
const { isShowStarterScreen } = useStarterScreen()
useEffect(() => {
const onKeyDown = (e: KeyboardEvent) => {
@ -60,7 +63,7 @@ export default function KeyListener({ children }: Props) {
return
}
if (e.code === 'KeyN' && prefixKey) {
if (e.code === 'KeyN' && prefixKey && !isShowStarterScreen) {
if (mainViewState !== MainViewState.Thread) return
requestCreateNewThread(assistants[0])
setMainViewState(MainViewState.Thread)
@ -82,6 +85,7 @@ export default function KeyListener({ children }: Props) {
}, [
activeThread,
assistants,
isShowStarterScreen,
mainViewState,
requestCreateNewThread,
setMainViewState,