summaryrefslogtreecommitdiffhomepage
path: root/app/components
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@codeispoetry.ru>2017-02-06 19:20:02 +0000
committerAndrej Mihajlov <and@codeispoetry.ru>2017-02-06 19:20:02 +0000
commit9ac8cfb03f478fa3ef3c51ff2e1e0a8274d0e26b (patch)
treec798ad0feb5211663bb40a909f336c417f1e1e3e /app/components
parent409b633f23c3a96db4c5c363a15b3dc2bc815441 (diff)
downloadmullvadvpn-9ac8cfb03f478fa3ef3c51ff2e1e0a8274d0e26b.tar.xz
mullvadvpn-9ac8cfb03f478fa3ef3c51ff2e1e0a8274d0e26b.zip
Add declarative Tray implementation
Diffstat (limited to 'app/components')
-rw-r--r--app/components/Tray.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/components/Tray.js b/app/components/Tray.js
new file mode 100644
index 0000000000..69f14cb7ca
--- /dev/null
+++ b/app/components/Tray.js
@@ -0,0 +1,28 @@
+import React, { Component, PropTypes } from 'react';
+import { TrayMenu, TrayItem } from '../lib/components/TrayMenu';
+
+export default class Tray extends Component {
+
+ static propTypes = {
+ handle: PropTypes.object.isRequired,
+ }
+
+ logout() {
+ this.props.login({ username: '', loggedIn: false });
+ this.props.history.push('/');
+ }
+
+ render() {
+ const loggedIn = this.props.user && this.props.user.loggedIn;
+
+ return (
+ <TrayMenu tray={this.props.handle}>
+ {<TrayItem label="Log out" click={::this.logout} visible={loggedIn} />}
+ {<TrayItem type="separator" visible={loggedIn} />}
+ <TrayItem label="Privacy Policy" />
+ <TrayItem label="Visit homepage" />
+ </TrayMenu>
+ );
+ }
+
+} \ No newline at end of file