Use named constants for settings URL query params (#3333)
This commit is contained in:
@ -4,7 +4,7 @@ import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import { createAndOpenNewProject } from 'lib/tauriFS'
|
||||
import { paths } from 'lib/paths'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
|
||||
import { useLspContext } from './LspProvider'
|
||||
|
||||
@ -16,7 +16,7 @@ export function HelpMenu(props: React.PropsWithChildren) {
|
||||
const location = useLocation()
|
||||
const { onProjectOpen } = useLspContext()
|
||||
const filePath = useAbsoluteFilePath()
|
||||
const isInProject = location.pathname.includes(paths.FILE)
|
||||
const isInProject = location.pathname.includes(PATHS.FILE)
|
||||
const navigate = useNavigate()
|
||||
const { settings } = useSettingsAuthContext()
|
||||
|
||||
@ -89,10 +89,10 @@ export function HelpMenu(props: React.PropsWithChildren) {
|
||||
<HelpMenuItem
|
||||
as="button"
|
||||
onClick={() => {
|
||||
const targetPath = location.pathname.includes(paths.FILE)
|
||||
? filePath + paths.SETTINGS
|
||||
: paths.HOME + paths.SETTINGS
|
||||
navigate(targetPath + '?tab=keybindings')
|
||||
const targetPath = location.pathname.includes(PATHS.FILE)
|
||||
? filePath + PATHS.SETTINGS_KEYBINDINGS
|
||||
: PATHS.HOME + PATHS.SETTINGS_KEYBINDINGS
|
||||
navigate(targetPath)
|
||||
}}
|
||||
>
|
||||
Keyboard shortcuts
|
||||
@ -108,7 +108,7 @@ export function HelpMenu(props: React.PropsWithChildren) {
|
||||
},
|
||||
})
|
||||
if (isInProject) {
|
||||
navigate(filePath + paths.ONBOARDING.INDEX)
|
||||
navigate(filePath + PATHS.ONBOARDING.INDEX)
|
||||
} else {
|
||||
createAndOpenNewProject({ onProjectOpen, navigate })
|
||||
}
|
||||
|
Reference in New Issue
Block a user