diff options
author | 2017-11-18 21:46:45 +0100 | |
---|---|---|
committer | 2017-11-18 21:47:39 +0100 | |
commit | 42ed24d5fd3586537f94f52bfc0b287a5fdbe6ea (patch) | |
tree | ffc271d47b07d12081d9591af7030443a6d9c805 /src/lib | |
parent | Fix typos (diff) | |
download | ferdium-app-42ed24d5fd3586537f94f52bfc0b287a5fdbe6ea.tar.gz ferdium-app-42ed24d5fd3586537f94f52bfc0b287a5fdbe6ea.tar.zst ferdium-app-42ed24d5fd3586537f94f52bfc0b287a5fdbe6ea.zip |
fix(Menu): Add fallback to service menu when service name is empty
Closes #250
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 8f0a92c3d..753d5970e 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -277,7 +277,7 @@ export default class FranzMenu { | |||
277 | 277 | ||
278 | if (this.stores.user.isLoggedIn) { | 278 | if (this.stores.user.isLoggedIn) { |
279 | return services.map((service, i) => ({ | 279 | return services.map((service, i) => ({ |
280 | label: service.name, | 280 | label: this._getServiceName(service), |
281 | accelerator: i <= 9 ? `CmdOrCtrl+${i + 1}` : null, | 281 | accelerator: i <= 9 ? `CmdOrCtrl+${i + 1}` : null, |
282 | type: 'radio', | 282 | type: 'radio', |
283 | checked: service.isActive, | 283 | checked: service.isActive, |
@@ -289,4 +289,20 @@ export default class FranzMenu { | |||
289 | 289 | ||
290 | return []; | 290 | return []; |
291 | } | 291 | } |
292 | |||
293 | _getServiceName(service) { | ||
294 | if (service.name) { | ||
295 | return service.name; | ||
296 | } | ||
297 | |||
298 | let name = service.recipe.name; | ||
299 | |||
300 | if (service.team) { | ||
301 | name = `${name} (${service.team})`; | ||
302 | } else if (service.customUrl) { | ||
303 | name = `${name} (${service.customUrl})`; | ||
304 | } | ||
305 | |||
306 | return name; | ||
307 | } | ||
292 | } | 308 | } |