2016-07-13 12:44:24 -08:00
|
|
|
import React from 'react';
|
2016-09-21 06:27:11 -08:00
|
|
|
|
2016-07-13 12:44:24 -08:00
|
|
|
import Component from '../component';
|
2016-09-21 06:27:11 -08:00
|
|
|
import {decorate} from '../utils/plugins';
|
|
|
|
|
|
2016-07-13 12:44:24 -08:00
|
|
|
import Notification_ from './notification';
|
|
|
|
|
|
|
|
|
|
const Notification = decorate(Notification_);
|
|
|
|
|
|
|
|
|
|
export default class Notifications extends Component {
|
|
|
|
|
|
2016-09-21 06:27:11 -08:00
|
|
|
template(css) {
|
|
|
|
|
return (<div className={css('view')}>
|
2016-07-13 12:44:24 -08:00
|
|
|
{ this.props.customChildrenBefore }
|
|
|
|
|
{
|
|
|
|
|
this.props.fontShowing &&
|
|
|
|
|
<Notification
|
2016-09-21 06:27:11 -08:00
|
|
|
key="font"
|
|
|
|
|
backgroundColor="rgba(255, 255, 255, .2)"
|
2016-07-13 12:44:24 -08:00
|
|
|
text={`${this.props.fontSize}px`}
|
2016-09-21 06:27:11 -08:00
|
|
|
userDismissable={false}
|
|
|
|
|
onDismiss={this.props.onDismissFont}
|
|
|
|
|
dismissAfter={1000}
|
|
|
|
|
/>
|
2016-07-13 12:44:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
this.props.resizeShowing &&
|
|
|
|
|
<Notification
|
2016-09-21 06:27:11 -08:00
|
|
|
key="resize"
|
|
|
|
|
backgroundColor="rgba(255, 255, 255, .2)"
|
2016-07-13 12:44:24 -08:00
|
|
|
text={`${this.props.cols}x${this.props.rows}`}
|
2016-09-21 06:27:11 -08:00
|
|
|
userDismissable={false}
|
|
|
|
|
onDismiss={this.props.onDismissResize}
|
|
|
|
|
dismissAfter={1000}
|
|
|
|
|
/>
|
2016-07-13 12:44:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
this.props.updateShowing &&
|
|
|
|
|
<Notification
|
2016-09-21 06:27:11 -08:00
|
|
|
key="update"
|
|
|
|
|
backgroundColor="#7ED321"
|
2016-07-17 12:02:34 -08:00
|
|
|
text={`Version ${this.props.updateVersion} ready`}
|
2016-09-21 06:27:11 -08:00
|
|
|
onDismiss={this.props.onDismissUpdate}
|
|
|
|
|
userDismissable
|
|
|
|
|
>
|
2016-07-17 12:02:34 -08:00
|
|
|
Version <b>{ this.props.updateVersion}</b> ready.
|
|
|
|
|
{ this.props.updateNote && ` ${this.props.updateNote.trim().replace(/\.$/, '')}` }
|
|
|
|
|
{ ' ' }
|
|
|
|
|
(<a
|
2016-09-21 06:27:11 -08:00
|
|
|
style={{color: '#fff'}}
|
|
|
|
|
onClick={ev => {
|
|
|
|
|
window.require('electron').shell.openExternal(ev.target.href);
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
}}
|
|
|
|
|
href={`https://github.com/zeit/hyperterm/releases/tag/${this.props.updateVersion}`}
|
|
|
|
|
>notes</a>).
|
2016-07-13 12:44:24 -08:00
|
|
|
{ ' ' }
|
2016-09-21 06:27:11 -08:00
|
|
|
<a
|
|
|
|
|
style={{
|
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
textDecoration: 'underline',
|
|
|
|
|
fontWeight: 'bold'
|
|
|
|
|
}}
|
|
|
|
|
onClick={this.props.onUpdateInstall}
|
|
|
|
|
>
|
2016-07-13 12:44:24 -08:00
|
|
|
Restart
|
2016-07-17 12:02:34 -08:00
|
|
|
</a>.
|
2016-07-13 12:44:24 -08:00
|
|
|
{ ' ' }
|
|
|
|
|
</Notification>
|
|
|
|
|
}
|
|
|
|
|
{ this.props.customChildren }
|
2016-09-21 06:27:11 -08:00
|
|
|
</div>);
|
2016-07-13 12:44:24 -08:00
|
|
|
}
|
|
|
|
|
|
2016-09-21 06:27:11 -08:00
|
|
|
styles() {
|
2016-07-13 12:44:24 -08:00
|
|
|
return {
|
|
|
|
|
view: {
|
|
|
|
|
position: 'fixed',
|
|
|
|
|
bottom: '20px',
|
|
|
|
|
right: '20px'
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|