diff options
author | 2017-11-23 16:17:34 +0100 | |
---|---|---|
committer | 2017-11-23 16:17:34 +0100 | |
commit | abca425e4a7b63be93132067bc335e8b6b39c2b2 (patch) | |
tree | e386f3e5d4c1c1caff19e3555e7ed1ce93e625f6 /src/components/services/tabs/Tabbar.js | |
parent | replace typeform (diff) | |
parent | Add windows notification fix to changelog (diff) | |
download | ferdium-app-abca425e4a7b63be93132067bc335e8b6b39c2b2.tar.gz ferdium-app-abca425e4a7b63be93132067bc335e8b6b39c2b2.tar.zst ferdium-app-abca425e4a7b63be93132067bc335e8b6b39c2b2.zip |
Merge pull request #330 from meetfranz/developv5.0.0-beta.14
Beta 14
Diffstat (limited to 'src/components/services/tabs/Tabbar.js')
-rw-r--r-- | src/components/services/tabs/Tabbar.js | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/components/services/tabs/Tabbar.js b/src/components/services/tabs/Tabbar.js index fdb2c0a59..9da1090b7 100644 --- a/src/components/services/tabs/Tabbar.js +++ b/src/components/services/tabs/Tabbar.js | |||
@@ -15,6 +15,7 @@ export default class TabBar extends Component { | |||
15 | reorder: PropTypes.func.isRequired, | 15 | reorder: PropTypes.func.isRequired, |
16 | reload: PropTypes.func.isRequired, | 16 | reload: PropTypes.func.isRequired, |
17 | toggleNotifications: PropTypes.func.isRequired, | 17 | toggleNotifications: PropTypes.func.isRequired, |
18 | toggleAudio: PropTypes.func.isRequired, | ||
18 | deleteService: PropTypes.func.isRequired, | 19 | deleteService: PropTypes.func.isRequired, |
19 | updateService: PropTypes.func.isRequired, | 20 | updateService: PropTypes.func.isRequired, |
20 | } | 21 | } |
@@ -29,20 +30,30 @@ export default class TabBar extends Component { | |||
29 | reorder({ oldIndex, newIndex }); | 30 | reorder({ oldIndex, newIndex }); |
30 | }; | 31 | }; |
31 | 32 | ||
32 | disableService = ({ serviceId }) => { | 33 | shouldPreventSorting = event => event.target.tagName !== 'LI'; |
34 | |||
35 | toggleService = ({ serviceId, isEnabled }) => { | ||
33 | const { updateService } = this.props; | 36 | const { updateService } = this.props; |
34 | 37 | ||
35 | if (serviceId) { | 38 | if (serviceId) { |
36 | updateService({ | 39 | updateService({ |
37 | serviceId, | 40 | serviceId, |
38 | serviceData: { | 41 | serviceData: { |
39 | isEnabled: false, | 42 | isEnabled, |
40 | }, | 43 | }, |
41 | redirect: false, | 44 | redirect: false, |
42 | }); | 45 | }); |
43 | } | 46 | } |
44 | } | 47 | } |
45 | 48 | ||
49 | disableService({ serviceId }) { | ||
50 | this.toggleService({ serviceId, isEnabled: false }); | ||
51 | } | ||
52 | |||
53 | enableService({ serviceId }) { | ||
54 | this.toggleService({ serviceId, isEnabled: true }); | ||
55 | } | ||
56 | |||
46 | render() { | 57 | render() { |
47 | const { | 58 | const { |
48 | services, | 59 | services, |
@@ -51,6 +62,7 @@ export default class TabBar extends Component { | |||
51 | disableToolTip, | 62 | disableToolTip, |
52 | reload, | 63 | reload, |
53 | toggleNotifications, | 64 | toggleNotifications, |
65 | toggleAudio, | ||
54 | deleteService, | 66 | deleteService, |
55 | } = this.props; | 67 | } = this.props; |
56 | 68 | ||
@@ -61,10 +73,13 @@ export default class TabBar extends Component { | |||
61 | setActive={setActive} | 73 | setActive={setActive} |
62 | onSortEnd={this.onSortEnd} | 74 | onSortEnd={this.onSortEnd} |
63 | onSortStart={disableToolTip} | 75 | onSortStart={disableToolTip} |
76 | shouldCancelStart={this.shouldPreventSorting} | ||
64 | reload={reload} | 77 | reload={reload} |
65 | toggleNotifications={toggleNotifications} | 78 | toggleNotifications={toggleNotifications} |
79 | toggleAudio={toggleAudio} | ||
66 | deleteService={deleteService} | 80 | deleteService={deleteService} |
67 | disableService={this.disableService} | 81 | disableService={args => this.disableService(args)} |
82 | enableService={args => this.enableService(args)} | ||
68 | openSettings={openSettings} | 83 | openSettings={openSettings} |
69 | distance={20} | 84 | distance={20} |
70 | axis="y" | 85 | axis="y" |