diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ac57b923..7a6542b3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). * Add referral FAQ to Invites screen([#1314](https://github.com/lbryio/lbry-app/pull/1314)) * Show exact wallet balance on mouse hover over ([#1305](https://github.com/lbryio/lbry-app/pull/1305)) +### Changed + +* Add flair to snackbar ([#1313](https://github.com/lbryio/lbry-app/pull/1313)) + ### Fixed * Black screen on macOS after maximizing LBRY and then closing ([#1235](https://github.com/lbryio/lbry-app/pull/1235)) diff --git a/src/renderer/component/snackBar/index.js b/src/renderer/component/snackBar/index.js index 9600fdd68..fc5cbf57e 100644 --- a/src/renderer/component/snackBar/index.js +++ b/src/renderer/component/snackBar/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import { doRemoveSnackBarSnack } from 'redux/actions/app'; import { selectSnackBarSnacks } from 'redux/selectors/app'; diff --git a/src/renderer/component/snackBar/view.jsx b/src/renderer/component/snackBar/view.jsx index 38867c811..0fdfeef3f 100644 --- a/src/renderer/component/snackBar/view.jsx +++ b/src/renderer/component/snackBar/view.jsx @@ -1,35 +1,48 @@ +// @flow import React from 'react'; import Button from 'component/button'; -class SnackBar extends React.PureComponent { - constructor(props) { +type Props = { + removeSnack: any => void, + snacks: { + linkTarget: ?string, + linkText: ?string, + message: string, + }, +}; + +class SnackBar extends React.PureComponent { + constructor(props: Props) { super(props); - this._displayTime = 5; // in seconds - this._hideTimeout = null; + this.displayTime = 5; // in seconds + this.hideTimeout = null; } render() { const { snacks, removeSnack } = this.props; if (!snacks.length) { - this._hideTimeout = null; // should be unmounting anyway, but be safe? + this.hideTimeout = null; // should be unmounting anyway, but be safe? return null; } const snack = snacks[0]; const { message, linkText, linkTarget } = snack; - if (this._hideTimeout === null) { - this._hideTimeout = setTimeout(() => { - this._hideTimeout = null; + if (this.hideTimeout === null) { + this.hideTimeout = setTimeout(() => { + this.hideTimeout = null; removeSnack(); - }, this._displayTime * 1000); + }, this.displayTime * 1000); } return (
- {message} +
+
+
{message}
+
{linkText && linkTarget && (