diff options
Diffstat (limited to 'src/features/quickSwitch')
-rw-r--r-- | src/features/quickSwitch/Component.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/features/quickSwitch/Component.js b/src/features/quickSwitch/Component.js index 0f44385e1..02a349dee 100644 --- a/src/features/quickSwitch/Component.js +++ b/src/features/quickSwitch/Component.js | |||
@@ -8,6 +8,7 @@ import { defineMessages, intlShape } from 'react-intl'; | |||
8 | import { Input } from '@meetfranz/forms'; | 8 | import { Input } from '@meetfranz/forms'; |
9 | import { H1 } from '@meetfranz/ui'; | 9 | import { H1 } from '@meetfranz/ui'; |
10 | 10 | ||
11 | import { compact, invoke } from 'lodash'; | ||
11 | import Modal from '../../components/ui/Modal'; | 12 | import Modal from '../../components/ui/Modal'; |
12 | import { state as ModalState } from '.'; | 13 | import { state as ModalState } from '.'; |
13 | import ServicesStore from '../../stores/ServicesStore'; | 14 | import ServicesStore from '../../stores/ServicesStore'; |
@@ -97,6 +98,8 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
97 | 98 | ||
98 | ARROW_UP = 38; | 99 | ARROW_UP = 38; |
99 | 100 | ||
101 | SHIFT = 16; | ||
102 | |||
100 | ENTER = 13; | 103 | ENTER = 13; |
101 | 104 | ||
102 | TAB = 9; | 105 | TAB = 9; |
@@ -132,10 +135,10 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
132 | // Get currently shown services | 135 | // Get currently shown services |
133 | services() { | 136 | services() { |
134 | let services = []; | 137 | let services = []; |
135 | if (this.state.search) { | 138 | if (this.state.search && compact(invoke(this.state.search, 'match', /^[a-z0-9]/i)).length > 0) { |
136 | // Apply simple search algorythm to list of all services | 139 | // Apply simple search algorythm to list of all services |
137 | services = this.props.stores.services.allDisplayed; | 140 | services = this.props.stores.services.allDisplayed; |
138 | services = services.filter(service => service.name.toLowerCase().includes(this.state.search.toLowerCase())); | 141 | services = services.filter(service => service.name.toLowerCase().search(this.state.search.toLowerCase()) !== -1); |
139 | } else { | 142 | } else { |
140 | // Add last used services to services array | 143 | // Add last used services to services array |
141 | for (const service of this.props.stores.services.lastUsedServices) { | 144 | for (const service of this.props.stores.services.lastUsedServices) { |
@@ -204,7 +207,11 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
204 | this.changeSelected(1); | 207 | this.changeSelected(1); |
205 | break; | 208 | break; |
206 | case this.TAB: | 209 | case this.TAB: |
207 | this.changeSelected(1); | 210 | if (event.shiftKey) { |
211 | this.changeSelected(-1); | ||
212 | } else { | ||
213 | this.changeSelected(1); | ||
214 | } | ||
208 | break; | 215 | break; |
209 | case this.ARROW_UP: | 216 | case this.ARROW_UP: |
210 | this.changeSelected(-1); | 217 | this.changeSelected(-1); |