2016-07-13 12:44:24 -08:00
|
|
|
import React from 'react';
|
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';
|
|
|
|
|
|
2017-11-13 06:02:49 -09:00
|
|
|
const Notification = decorate(Notification_, 'Notification');
|
2016-07-13 12:44:24 -08:00
|
|
|
|
2018-03-17 04:51:36 -08:00
|
|
|
export default class Notifications extends React.PureComponent {
|
|
|
|
|
render() {
|
2017-09-10 05:35:10 -08:00
|
|
|
return (
|
2018-03-17 04:51:36 -08:00
|
|
|
<div className="notifications_view">
|
2017-09-10 05:35:10 -08:00
|
|
|
{this.props.customChildrenBefore}
|
|
|
|
|
{this.props.fontShowing && (
|
2016-07-13 12:44:24 -08:00
|
|
|
<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}
|
2017-09-10 05:35:10 -08:00
|
|
|
/>
|
|
|
|
|
)}
|
2016-07-13 12:44:24 -08:00
|
|
|
|
2017-09-10 05:35:10 -08:00
|
|
|
{this.props.resizeShowing && (
|
2016-07-13 12:44:24 -08:00
|
|
|
<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}
|
2017-09-10 05:35:10 -08:00
|
|
|
/>
|
|
|
|
|
)}
|
2016-07-13 12:44:24 -08:00
|
|
|
|
2017-09-10 05:35:10 -08:00
|
|
|
{this.props.messageShowing && (
|
2016-10-04 11:41:54 -08:00
|
|
|
<Notification
|
|
|
|
|
key="message"
|
|
|
|
|
backgroundColor="#FE354E"
|
|
|
|
|
text={this.props.messageText}
|
|
|
|
|
onDismiss={this.props.onDismissMessage}
|
|
|
|
|
userDismissable={this.props.messageDismissable}
|
|
|
|
|
userDismissColor="#AA2D3C"
|
2017-09-10 05:35:10 -08:00
|
|
|
>
|
2017-11-01 05:44:43 -08:00
|
|
|
{this.props.messageURL
|
|
|
|
|
? [
|
|
|
|
|
this.props.messageText,
|
|
|
|
|
' (',
|
|
|
|
|
<a
|
|
|
|
|
key="link"
|
|
|
|
|
style={{color: '#fff'}}
|
|
|
|
|
onClick={ev => {
|
|
|
|
|
window.require('electron').shell.openExternal(ev.target.href);
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
}}
|
|
|
|
|
href={this.props.messageURL}
|
|
|
|
|
>
|
|
|
|
|
more
|
|
|
|
|
</a>,
|
|
|
|
|
')'
|
|
|
|
|
]
|
|
|
|
|
: null}
|
2016-10-04 11:41:54 -08:00
|
|
|
</Notification>
|
2017-09-10 05:35:10 -08:00
|
|
|
)}
|
2016-10-04 11:41:54 -08:00
|
|
|
|
2017-09-10 05:35:10 -08:00
|
|
|
{this.props.updateShowing && (
|
2016-07-13 12:44:24 -08:00
|
|
|
<Notification
|
2016-09-21 06:27:11 -08:00
|
|
|
key="update"
|
2018-04-20 07:03:34 -08:00
|
|
|
backgroundColor="#18E179"
|
|
|
|
|
color="#000"
|
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
|
2017-09-10 05:35:10 -08:00
|
|
|
>
|
2016-10-04 11:44:10 -08:00
|
|
|
Version <b>{this.props.updateVersion}</b> ready.
|
2017-09-10 05:35:10 -08:00
|
|
|
{this.props.updateNote && ` ${this.props.updateNote.trim().replace(/\.$/, '')}`} (<a
|
2018-04-20 07:03:34 -08:00
|
|
|
style={{color: '#000'}}
|
2016-09-21 06:27:11 -08:00
|
|
|
onClick={ev => {
|
|
|
|
|
window.require('electron').shell.openExternal(ev.target.href);
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
}}
|
2018-01-24 09:23:06 -09:00
|
|
|
href={`https://github.com/zeit/hyper/releases/tag/${this.props.updateVersion}`}
|
2017-09-10 05:35:10 -08:00
|
|
|
>
|
|
|
|
|
notes
|
|
|
|
|
</a>).{' '}
|
2017-11-29 04:26:24 -09:00
|
|
|
{this.props.updateCanInstall ? (
|
|
|
|
|
<a
|
|
|
|
|
style={{
|
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
textDecoration: 'underline',
|
|
|
|
|
fontWeight: 'bold'
|
|
|
|
|
}}
|
|
|
|
|
onClick={this.props.onUpdateInstall}
|
|
|
|
|
>
|
|
|
|
|
Restart
|
|
|
|
|
</a>
|
|
|
|
|
) : (
|
|
|
|
|
<a
|
|
|
|
|
style={{
|
2018-04-20 07:03:34 -08:00
|
|
|
color: '#000',
|
2017-11-29 04:26:24 -09:00
|
|
|
cursor: 'pointer',
|
|
|
|
|
textDecoration: 'underline',
|
|
|
|
|
fontWeight: 'bold'
|
|
|
|
|
}}
|
|
|
|
|
onClick={ev => {
|
|
|
|
|
window.require('electron').shell.openExternal(ev.target.href);
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
}}
|
|
|
|
|
href={this.props.updateReleaseUrl}
|
|
|
|
|
>
|
|
|
|
|
Download
|
|
|
|
|
</a>
|
|
|
|
|
)}.{' '}
|
2016-07-13 12:44:24 -08:00
|
|
|
</Notification>
|
2017-09-10 05:35:10 -08:00
|
|
|
)}
|
|
|
|
|
{this.props.customChildren}
|
2018-03-17 04:51:36 -08:00
|
|
|
|
|
|
|
|
<style jsx>{`
|
|
|
|
|
.notifications_view {
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 20px;
|
|
|
|
|
right: 20px;
|
|
|
|
|
}
|
|
|
|
|
`}</style>
|
2017-09-10 05:35:10 -08:00
|
|
|
</div>
|
|
|
|
|
);
|
2016-07-13 12:44:24 -08:00
|
|
|
}
|
|
|
|
|
}
|