port notifications component to ts

This commit is contained in:
Labhansh Agrawal 2020-03-18 00:35:05 +05:30 committed by Benjamin Staneck
parent b26a6e5443
commit 4a3132b8e7

View file

@ -3,10 +3,11 @@ import React from 'react';
import {decorate} from '../utils/plugins'; import {decorate} from '../utils/plugins';
import Notification_ from './notification'; import Notification_ from './notification';
import {NotificationsProps} from '../hyper';
const Notification = decorate(Notification_, 'Notification'); const Notification = decorate(Notification_, 'Notification');
export default class Notifications extends React.PureComponent { export default class Notifications extends React.PureComponent<NotificationsProps> {
render() { render() {
return ( return (
<div className="notifications_view"> <div className="notifications_view">
@ -50,7 +51,7 @@ export default class Notifications extends React.PureComponent {
key="link" key="link"
style={{color: '#fff'}} style={{color: '#fff'}}
onClick={ev => { onClick={ev => {
window.require('electron').shell.openExternal(ev.target.href); window.require('electron').shell.openExternal(ev.currentTarget.href);
ev.preventDefault(); ev.preventDefault();
}} }}
href={this.props.messageURL} href={this.props.messageURL}
@ -77,7 +78,7 @@ export default class Notifications extends React.PureComponent {
<a <a
style={{color: '#000'}} style={{color: '#000'}}
onClick={ev => { onClick={ev => {
window.require('electron').shell.openExternal(ev.target.href); window.require('electron').shell.openExternal(ev.currentTarget.href);
ev.preventDefault(); ev.preventDefault();
}} }}
href={`https://github.com/zeit/hyper/releases/tag/${this.props.updateVersion}`} href={`https://github.com/zeit/hyper/releases/tag/${this.props.updateVersion}`}
@ -105,10 +106,10 @@ export default class Notifications extends React.PureComponent {
fontWeight: 'bold' fontWeight: 'bold'
}} }}
onClick={ev => { onClick={ev => {
window.require('electron').shell.openExternal(ev.target.href); window.require('electron').shell.openExternal(ev.currentTarget.href);
ev.preventDefault(); ev.preventDefault();
}} }}
href={this.props.updateReleaseUrl} href={this.props.updateReleaseUrl!}
> >
Download Download
</a> </a>