diff options
author | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-05-03 17:19:01 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 11:49:01 +0000 |
commit | a5c0daf31ad65772e83886eb854f6ea93a683cea (patch) | |
tree | 888dcd396b2f2fc47f6e670453ef0fa5cd5c30d4 /src/features/quickSwitch | |
parent | Quick switch enhancements (#1326) (diff) | |
download | ferdium-app-a5c0daf31ad65772e83886eb854f6ea93a683cea.tar.gz ferdium-app-a5c0daf31ad65772e83886eb854f6ea93a683cea.tar.zst ferdium-app-a5c0daf31ad65772e83886eb854f6ea93a683cea.zip |
Highlight selected service correctly in Quick Switcher (#1324)
Diffstat (limited to 'src/features/quickSwitch')
-rw-r--r-- | src/features/quickSwitch/Component.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/features/quickSwitch/Component.js b/src/features/quickSwitch/Component.js index 02a349dee..cc2775178 100644 --- a/src/features/quickSwitch/Component.js +++ b/src/features/quickSwitch/Component.js | |||
@@ -140,12 +140,17 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
140 | services = this.props.stores.services.allDisplayed; | 140 | services = this.props.stores.services.allDisplayed; |
141 | services = services.filter(service => service.name.toLowerCase().search(this.state.search.toLowerCase()) !== -1); | 141 | services = services.filter(service => service.name.toLowerCase().search(this.state.search.toLowerCase()) !== -1); |
142 | } else { | 142 | } else { |
143 | // Add the currently active service first | ||
144 | const currentService = this.props.stores.services.active; | ||
145 | if (currentService) { | ||
146 | services.push(currentService); | ||
147 | } | ||
148 | |||
143 | // Add last used services to services array | 149 | // Add last used services to services array |
144 | for (const service of this.props.stores.services.lastUsedServices) { | 150 | for (const service of this.props.stores.services.lastUsedServices) { |
145 | if (this.props.stores.services.one(service)) { | 151 | const tempService = this.props.stores.services.one(service); |
146 | services.push( | 152 | if (tempService && !services.includes(tempService)) { |
147 | this.props.stores.services.one(service), | 153 | services.push(tempService); |
148 | ); | ||
149 | } | 154 | } |
150 | } | 155 | } |
151 | 156 | ||
@@ -167,6 +172,7 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
167 | 172 | ||
168 | // Reset and close modal | 173 | // Reset and close modal |
169 | this.setState({ | 174 | this.setState({ |
175 | selected: 0, | ||
170 | search: '', | 176 | search: '', |
171 | }); | 177 | }); |
172 | this.close(); | 178 | this.close(); |
@@ -192,7 +198,6 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
192 | serviceElement.scrollIntoViewIfNeeded(false); | 198 | serviceElement.scrollIntoViewIfNeeded(false); |
193 | } | 199 | } |
194 | 200 | ||
195 | |||
196 | return { | 201 | return { |
197 | selected: newSelected, | 202 | selected: newSelected, |
198 | }; | 203 | }; |