feat: feature/mvp-sprint-1
This commit is contained in:
parent
89c1e67467
commit
1183ce88f9
@ -62,7 +62,7 @@ export const Commander = (props) => {
|
|||||||
if (thingtimeRef?.current?.settings?.clearCommanderContextOnToggle) {
|
if (thingtimeRef?.current?.settings?.clearCommanderContextOnToggle) {
|
||||||
setShowContext(false, "commanderActive useEffect")
|
setShowContext(false, "commanderActive useEffect")
|
||||||
}
|
}
|
||||||
if (contextPath !== undefined) {
|
if (contextPath !== undefined && !inputValue) {
|
||||||
setContextPath(undefined)
|
setContextPath(undefined)
|
||||||
}
|
}
|
||||||
if (showContext !== false) {
|
if (showContext !== false) {
|
||||||
@ -84,7 +84,7 @@ export const Commander = (props) => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const validSetters = React.useMemo(() => {
|
const validSetters = React.useMemo(() => {
|
||||||
return ["=", " is "]
|
return ["=", " is ", " IS ", " Is ", " iS "]
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const command = React.useMemo(() => {
|
const command = React.useMemo(() => {
|
||||||
@ -92,19 +92,20 @@ export const Commander = (props) => {
|
|||||||
// const sanitizedCommand = inputValue
|
// const sanitizedCommand = inputValue
|
||||||
const sanitizedCommand = virtualValue
|
const sanitizedCommand = virtualValue
|
||||||
|
|
||||||
if (sanitizedCommand?.includes(validSetters[0])) {
|
const validSetter = validSetters?.find((setter) => {
|
||||||
const indexOfSplitter = sanitizedCommand?.indexOf(validSetters[0])
|
if (sanitizedCommand?.includes(setter)) {
|
||||||
|
return setter
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
|
if (typeof validSetter === "string") {
|
||||||
|
const indexOfSplitter = sanitizedCommand?.indexOf(validSetter)
|
||||||
const [pathRaw, valRaw] = [
|
const [pathRaw, valRaw] = [
|
||||||
sanitizedCommand?.slice(0, indexOfSplitter),
|
sanitizedCommand?.slice(0, indexOfSplitter),
|
||||||
sanitizedCommand?.slice(indexOfSplitter + validSetters[0]?.length),
|
sanitizedCommand?.slice(indexOfSplitter + validSetter?.length),
|
||||||
]
|
|
||||||
return [pathRaw?.trim(), valRaw?.trim()]
|
|
||||||
} else if (sanitizedCommand?.includes(validSetters[1])) {
|
|
||||||
const indexOfSplitter = sanitizedCommand?.indexOf(validSetters[1])
|
|
||||||
const [pathRaw, valRaw] = [
|
|
||||||
sanitizedCommand?.slice(0, indexOfSplitter),
|
|
||||||
sanitizedCommand?.slice(indexOfSplitter + validSetters[1]?.length),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
return [pathRaw?.trim(), valRaw?.trim()]
|
return [pathRaw?.trim(), valRaw?.trim()]
|
||||||
}
|
}
|
||||||
return [sanitizedCommand]
|
return [sanitizedCommand]
|
||||||
@ -261,10 +262,10 @@ export const Commander = (props) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!prevVal) {
|
// if (!prevVal) {
|
||||||
setContextPath(commandPath)
|
setContextPath(commandPath)
|
||||||
setShowContext(true, "commandIsAction check")
|
setShowContext(true, "commandIsAction check")
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
// if (commandContainsPath)
|
// if (commandContainsPath)
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user