diff options
author | 2021-05-03 17:17:46 +0530 | |
---|---|---|
committer | 2021-05-03 11:47:46 +0000 | |
commit | b3d3b0c55f02faed5a5942291e2658e5948a6c99 (patch) | |
tree | bd8af49798755e36a6e0f8ab7ddb512b96e1687f | |
parent | docs: add vraravam as a contributor (#1337) (diff) | |
download | ferdium-app-b3d3b0c55f02faed5a5942291e2658e5948a6c99.tar.gz ferdium-app-b3d3b0c55f02faed5a5942291e2658e5948a6c99.tar.zst ferdium-app-b3d3b0c55f02faed5a5942291e2658e5948a6c99.zip |
Quick switch enhancements (#1326)
-rw-r--r-- | src/features/quickSwitch/Component.js | 13 | ||||
-rw-r--r-- | src/i18n/messages/src/features/quickSwitch/Component.json | 12 |
2 files changed, 16 insertions, 9 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); |
diff --git a/src/i18n/messages/src/features/quickSwitch/Component.json b/src/i18n/messages/src/features/quickSwitch/Component.json index d0debee0e..e112bedc1 100644 --- a/src/i18n/messages/src/features/quickSwitch/Component.json +++ b/src/i18n/messages/src/features/quickSwitch/Component.json | |||
@@ -4,11 +4,11 @@ | |||
4 | "defaultMessage": "!!!QuickSwitch", | 4 | "defaultMessage": "!!!QuickSwitch", |
5 | "file": "src/features/quickSwitch/Component.js", | 5 | "file": "src/features/quickSwitch/Component.js", |
6 | "start": { | 6 | "start": { |
7 | "line": 16, | 7 | "line": 17, |
8 | "column": 9 | 8 | "column": 9 |
9 | }, | 9 | }, |
10 | "end": { | 10 | "end": { |
11 | "line": 19, | 11 | "line": 20, |
12 | "column": 3 | 12 | "column": 3 |
13 | } | 13 | } |
14 | }, | 14 | }, |
@@ -17,11 +17,11 @@ | |||
17 | "defaultMessage": "!!!Search...", | 17 | "defaultMessage": "!!!Search...", |
18 | "file": "src/features/quickSwitch/Component.js", | 18 | "file": "src/features/quickSwitch/Component.js", |
19 | "start": { | 19 | "start": { |
20 | "line": 20, | 20 | "line": 21, |
21 | "column": 10 | 21 | "column": 10 |
22 | }, | 22 | }, |
23 | "end": { | 23 | "end": { |
24 | "line": 23, | 24 | "line": 24, |
25 | "column": 3 | 25 | "column": 3 |
26 | } | 26 | } |
27 | }, | 27 | }, |
@@ -30,11 +30,11 @@ | |||
30 | "defaultMessage": "!!!Select a service with TAB, ↑ and ↓. Open a service with ENTER.", | 30 | "defaultMessage": "!!!Select a service with TAB, ↑ and ↓. Open a service with ENTER.", |
31 | "file": "src/features/quickSwitch/Component.js", | 31 | "file": "src/features/quickSwitch/Component.js", |
32 | "start": { | 32 | "start": { |
33 | "line": 24, | 33 | "line": 25, |
34 | "column": 8 | 34 | "column": 8 |
35 | }, | 35 | }, |
36 | "end": { | 36 | "end": { |
37 | "line": 27, | 37 | "line": 28, |
38 | "column": 3 | 38 | "column": 3 |
39 | } | 39 | } |
40 | } | 40 | } |