feat: feature/mvp-sprint-1 Modified suggestions logic and added a suggestions setting to hide suggestions or show when commander not active
This commit is contained in:
parent
ac927f6f19
commit
914501a1b4
@ -24,8 +24,9 @@ try {
|
|||||||
const force = {
|
const force = {
|
||||||
settings: {
|
settings: {
|
||||||
// commanderActive: false,
|
// commanderActive: false,
|
||||||
|
// hideSuggestionsOnToggle: true,
|
||||||
},
|
},
|
||||||
version: 22,
|
version: 23,
|
||||||
}
|
}
|
||||||
|
|
||||||
const newVersionData = {
|
const newVersionData = {
|
||||||
@ -43,6 +44,7 @@ const initialValues = {
|
|||||||
commanderActive: false,
|
commanderActive: false,
|
||||||
clearCommanderOnToggle: true,
|
clearCommanderOnToggle: true,
|
||||||
clearCommanderContextOnToggle: true,
|
clearCommanderContextOnToggle: true,
|
||||||
|
hideSuggestionsOnToggle: true,
|
||||||
},
|
},
|
||||||
Content: {
|
Content: {
|
||||||
hidden1: "Edit this to your heart's desire.",
|
hidden1: "Edit this to your heart's desire.",
|
||||||
|
@ -148,10 +148,6 @@ export const Commander = (props) => {
|
|||||||
return commandPath && commandValue
|
return commandPath && commandValue
|
||||||
}, [commandPath, commandValue])
|
}, [commandPath, commandValue])
|
||||||
|
|
||||||
const showSuggestions = React.useMemo(() => {
|
|
||||||
return inputValue?.length
|
|
||||||
}, [inputValue])
|
|
||||||
|
|
||||||
const suggestions = React.useMemo(() => {
|
const suggestions = React.useMemo(() => {
|
||||||
try {
|
try {
|
||||||
const fuse = new Fuse(paths)
|
const fuse = new Fuse(paths)
|
||||||
@ -168,6 +164,20 @@ export const Commander = (props) => {
|
|||||||
}
|
}
|
||||||
}, [inputValue, paths])
|
}, [inputValue, paths])
|
||||||
|
|
||||||
|
const showSuggestions = React.useMemo(() => {
|
||||||
|
return (
|
||||||
|
inputValue?.length &&
|
||||||
|
suggestions?.length &&
|
||||||
|
commanderActive &&
|
||||||
|
thingtime?.settings?.hideSuggestionsOnToggle
|
||||||
|
)
|
||||||
|
}, [
|
||||||
|
inputValue,
|
||||||
|
suggestions,
|
||||||
|
commanderActive,
|
||||||
|
thingtime?.settings?.hideSuggestionsOnToggle,
|
||||||
|
])
|
||||||
|
|
||||||
const selectSuggestion = React.useCallback(
|
const selectSuggestion = React.useCallback(
|
||||||
(suggestionIdx) => {
|
(suggestionIdx) => {
|
||||||
const suggestion = suggestions?.[suggestionIdx]
|
const suggestion = suggestions?.[suggestionIdx]
|
||||||
@ -445,7 +455,11 @@ export const Commander = (props) => {
|
|||||||
pointerEvents="all"
|
pointerEvents="all"
|
||||||
paddingY={3}
|
paddingY={3}
|
||||||
>
|
>
|
||||||
<Thingtime path={contextPath} thing={contextValue}></Thingtime>
|
<Thingtime
|
||||||
|
width="600px"
|
||||||
|
path={contextPath}
|
||||||
|
thing={contextValue}
|
||||||
|
></Thingtime>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -293,7 +293,9 @@ export const Thingtime = (props) => {
|
|||||||
paddingLeft={props?.pl || props?.paddingLeft}
|
paddingLeft={props?.pl || props?.paddingLeft}
|
||||||
fontSize="20px"
|
fontSize="20px"
|
||||||
border="none"
|
border="none"
|
||||||
whiteSpace="pre-line"
|
// whiteSpace="pre-line"
|
||||||
|
whiteSpace="pre-wrap"
|
||||||
|
wordBreak={props?.wordBreak || "break-word"}
|
||||||
outline="none"
|
outline="none"
|
||||||
paddingY={2}
|
paddingY={2}
|
||||||
// dangerouslySetInnerHTML={{ __html: renderableValue }}
|
// dangerouslySetInnerHTML={{ __html: renderableValue }}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
|
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
|
"strictNullChecks": false,
|
||||||
"lib": ["DOM", "DOM.Iterable", "ES2019"],
|
"lib": ["DOM", "DOM.Iterable", "ES2019"],
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user