summaryrefslogtreecommitdiffstats
path: root/src/components/layout/Sidebar.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/layout/Sidebar.js')
-rw-r--r--src/components/layout/Sidebar.js54
1 files changed, 35 insertions, 19 deletions
diff --git a/src/components/layout/Sidebar.js b/src/components/layout/Sidebar.js
index 6a5c0f365..cb2ecc8ce 100644
--- a/src/components/layout/Sidebar.js
+++ b/src/components/layout/Sidebar.js
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
2import PropTypes from 'prop-types'; 2import PropTypes from 'prop-types';
3import ReactTooltip from 'react-tooltip'; 3import ReactTooltip from 'react-tooltip';
4import { defineMessages, intlShape } from 'react-intl'; 4import { defineMessages, intlShape } from 'react-intl';
5import { observer } from 'mobx-react';
5 6
6import Tabbar from '../services/tabs/Tabbar'; 7import Tabbar from '../services/tabs/Tabbar';
7import { ctrlKey } from '../../environment'; 8import { ctrlKey } from '../../environment';
@@ -11,16 +12,26 @@ const messages = defineMessages({
11 id: 'sidebar.settings', 12 id: 'sidebar.settings',
12 defaultMessage: '!!!Settings', 13 defaultMessage: '!!!Settings',
13 }, 14 },
15 addNewService: {
16 id: 'sidebar.addNewService',
17 defaultMessage: '!!!Add new service',
18 },
19 mute: {
20 id: 'sidebar.mute',
21 defaultMessage: '!!!Disable audio',
22 },
23 unmute: {
24 id: 'sidebar.unmute',
25 defaultMessage: '!!!Enable audio',
26 },
14}); 27});
15 28
29@observer
16export default class Sidebar extends Component { 30export default class Sidebar extends Component {
17 static propTypes = { 31 static propTypes = {
18 openSettings: PropTypes.func.isRequired, 32 openSettings: PropTypes.func.isRequired,
19 isPremiumUser: PropTypes.bool, 33 toggleMuteApp: PropTypes.func.isRequired,
20 } 34 isAppMuted: PropTypes.bool.isRequired,
21
22 static defaultProps = {
23 isPremiumUser: false,
24 } 35 }
25 36
26 static contextTypes = { 37 static contextTypes = {
@@ -40,8 +51,9 @@ export default class Sidebar extends Component {
40 } 51 }
41 52
42 render() { 53 render() {
43 const { openSettings, isPremiumUser } = this.props; 54 const { openSettings, toggleMuteApp, isAppMuted } = this.props;
44 const { intl } = this.context; 55 const { intl } = this.context;
56
45 return ( 57 return (
46 <div className="sidebar"> 58 <div className="sidebar">
47 <Tabbar 59 <Tabbar
@@ -50,21 +62,25 @@ export default class Sidebar extends Component {
50 disableToolTip={() => this.disableToolTip()} 62 disableToolTip={() => this.disableToolTip()}
51 /> 63 />
52 <button 64 <button
53 onClick={openSettings} 65 onClick={toggleMuteApp}
54 className="sidebar__settings-button" 66 className={`sidebar__button sidebar__button--audio ${isAppMuted ? 'is-muted' : ''}`}
67 data-tip={`${intl.formatMessage(isAppMuted ? messages.unmute : messages.mute)} (${ctrlKey}+Shift+M)`}
68 >
69 <i className={`mdi mdi-bell${isAppMuted ? '-off' : ''}`} />
70 </button>
71 <button
72 onClick={() => openSettings({ path: 'recipes' })}
73 className="sidebar__button sidebar__button--new-service"
74 data-tip={`${intl.formatMessage(messages.addNewService)} (${ctrlKey}+N)`}
75 >
76 <i className="mdi mdi-plus-box" />
77 </button>
78 <button
79 onClick={() => openSettings({ path: 'app' })}
80 className="sidebar__button sidebar__button--settings"
55 data-tip={`${intl.formatMessage(messages.settings)} (${ctrlKey}+,)`} 81 data-tip={`${intl.formatMessage(messages.settings)} (${ctrlKey}+,)`}
56 > 82 >
57 {isPremiumUser && ( 83 <i className="mdi mdi-settings" />
58 <span className="emoji">
59 <img src="./assets/images/emoji/star.png" alt="" />
60 </span>
61 )}
62 <img
63 src="./assets/images/logo.svg"
64 className="sidebar__logo"
65 alt=""
66 />
67 {intl.formatMessage(messages.settings)}
68 </button> 84 </button>
69 {this.state.tooltipEnabled && ( 85 {this.state.tooltipEnabled && (
70 <ReactTooltip place="right" type="dark" effect="solid" /> 86 <ReactTooltip place="right" type="dark" effect="solid" />