Ignore click actions when a screen search string exists

This commit is contained in:
Andrew Kingston 2021-03-10 10:35:16 +00:00
parent ff5aba19f7
commit c8466bc1cf
1 changed files with 9 additions and 1 deletions

View File

@ -9,6 +9,7 @@
import ComponentTree from "./ComponentTree.svelte" import ComponentTree from "./ComponentTree.svelte"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
import ScreenDropdownMenu from "./ScreenDropdownMenu.svelte" import ScreenDropdownMenu from "./ScreenDropdownMenu.svelte"
import { get } from "svelte/store"
const ROUTE_NAME_MAP = { const ROUTE_NAME_MAP = {
"/": { "/": {
@ -56,13 +57,20 @@
screen => !searchString || screen.route.includes(searchString) screen => !searchString || screen.route.includes(searchString)
) )
} }
const toggleManuallyOpened = () => {
if (get(screenSearchString)) {
return
}
routeManuallyOpened = !routeManuallyOpened
}
</script> </script>
{#if !noSearchMatch} {#if !noSearchMatch}
<NavItem <NavItem
icon="ri-folder-line" icon="ri-folder-line"
text={path} text={path}
on:click={() => (routeManuallyOpened = !routeManuallyOpened)} on:click={toggleManuallyOpened}
opened={routeOpened} opened={routeOpened}
{border} {border}
withArrow={route.subpaths} /> withArrow={route.subpaths} />