From 9b1797c1ab974184c05eaa0d8e136ea47452ff6b Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan <thomas.zarebczan@gmail.com> Date: Thu, 11 Oct 2018 02:38:27 -0400 Subject: [PATCH] take 2 Fixing up per Sean's recommendations --- src/renderer/component/wunderbar/index.js | 2 ++ src/renderer/component/wunderbar/view.jsx | 10 +++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/renderer/component/wunderbar/index.js b/src/renderer/component/wunderbar/index.js index 1bbcd3b26..13dcc37d7 100644 --- a/src/renderer/component/wunderbar/index.js +++ b/src/renderer/component/wunderbar/index.js @@ -7,6 +7,7 @@ import { doFocusSearchInput, doBlurSearchInput, doSearch, + doNotify, } from 'lbry-redux'; import { makeSelectClientSetting } from 'redux/selectors/settings'; import * as settings from 'constants/settings'; @@ -38,6 +39,7 @@ const perform = dispatch => ({ updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)), doFocus: () => dispatch(doFocusSearchInput()), doBlur: () => dispatch(doBlurSearchInput()), + doShowSnackBar: (modal, props) => dispatch(doNotify(modal, props)), }); export default connect( diff --git a/src/renderer/component/wunderbar/view.jsx b/src/renderer/component/wunderbar/view.jsx index 9ffb32fc8..e18c9bc65 100644 --- a/src/renderer/component/wunderbar/view.jsx +++ b/src/renderer/component/wunderbar/view.jsx @@ -1,7 +1,7 @@ // @flow import React from 'react'; import classnames from 'classnames'; -import { normalizeURI, SEARCH_TYPES, doNotify, isURIValid } from 'lbry-redux'; +import { normalizeURI, SEARCH_TYPES, isURIValid } from 'lbry-redux'; import Icon from 'component/common/icon'; import { parseQueryParams } from 'util/query_params'; import * as icons from 'constants/icons'; @@ -106,12 +106,10 @@ class WunderBar extends React.PureComponent<Props> { const uri = normalizeURI(query); onSubmit(uri, params); } else { - window.app.store.dispatch( - doNotify({ + this.props.doShowSnackBar({ message: __('Invalid LBRY URL requested. Only A-Z, a-z, and - allowed.'), displayType: ['snackbar'], }) - ); } } @@ -126,12 +124,10 @@ class WunderBar extends React.PureComponent<Props> { const params = getParams(); onSubmit(uri, params); } else { - window.app.store.dispatch( - doNotify({ + this.props.doShowSnackBar({ message: __('Invalid LBRY URL entered. Only A-Z, a-z, and - allowed.'), displayType: ['snackbar'], }) - ); } } catch (e) { onSearch(query, resultCount);