fix: disabled shortcut create new thread on starter screen (#4074)
This commit is contained in:
parent
1c68c819ca
commit
8b485ba44f
@ -8,6 +8,8 @@ import { MainViewState } from '@/constants/screens'
|
|||||||
|
|
||||||
import { useCreateNewThread } from '@/hooks/useCreateNewThread'
|
import { useCreateNewThread } from '@/hooks/useCreateNewThread'
|
||||||
|
|
||||||
|
import { useStarterScreen } from '@/hooks/useStarterScreen'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
mainViewStateAtom,
|
mainViewStateAtom,
|
||||||
showLeftPanelAtom,
|
showLeftPanelAtom,
|
||||||
@ -32,6 +34,7 @@ export default function KeyListener({ children }: Props) {
|
|||||||
const assistants = useAtomValue(assistantsAtom)
|
const assistants = useAtomValue(assistantsAtom)
|
||||||
const activeThread = useAtomValue(activeThreadAtom)
|
const activeThread = useAtomValue(activeThreadAtom)
|
||||||
const setModalActionThread = useSetAtom(modalActionThreadAtom)
|
const setModalActionThread = useSetAtom(modalActionThreadAtom)
|
||||||
|
const { isShowStarterScreen } = useStarterScreen()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onKeyDown = (e: KeyboardEvent) => {
|
const onKeyDown = (e: KeyboardEvent) => {
|
||||||
@ -60,7 +63,7 @@ export default function KeyListener({ children }: Props) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.code === 'KeyN' && prefixKey) {
|
if (e.code === 'KeyN' && prefixKey && !isShowStarterScreen) {
|
||||||
if (mainViewState !== MainViewState.Thread) return
|
if (mainViewState !== MainViewState.Thread) return
|
||||||
requestCreateNewThread(assistants[0])
|
requestCreateNewThread(assistants[0])
|
||||||
setMainViewState(MainViewState.Thread)
|
setMainViewState(MainViewState.Thread)
|
||||||
@ -82,6 +85,7 @@ export default function KeyListener({ children }: Props) {
|
|||||||
}, [
|
}, [
|
||||||
activeThread,
|
activeThread,
|
||||||
assistants,
|
assistants,
|
||||||
|
isShowStarterScreen,
|
||||||
mainViewState,
|
mainViewState,
|
||||||
requestCreateNewThread,
|
requestCreateNewThread,
|
||||||
setMainViewState,
|
setMainViewState,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user