From 02d8b7e5eab4f1340f135d78f911da96c52c769b Mon Sep 17 00:00:00 2001 From: "Brendon J. Brewer" Date: Fri, 15 Mar 2019 11:28:52 +1300 Subject: [PATCH 1/2] Fixed error message to include numbers --- src/ui/component/wunderbar/view.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/component/wunderbar/view.jsx b/src/ui/component/wunderbar/view.jsx index 85e38c243..92b0c012a 100644 --- a/src/ui/component/wunderbar/view.jsx +++ b/src/ui/component/wunderbar/view.jsx @@ -104,7 +104,7 @@ class WunderBar extends React.PureComponent { onSubmit(uri, params); } else { this.props.doShowSnackBar({ - message: __('Invalid LBRY URL entered. Only A-Z, a-z, and - allowed.'), + message: __('Invalid LBRY URL entered. Only A-Z, a-z, 0-9, and - allowed.'), }); } @@ -120,7 +120,7 @@ class WunderBar extends React.PureComponent { onSubmit(uri, params); } else { this.props.doShowSnackBar({ - message: __('Invalid LBRY URL entered. Only A-Z, a-z, and - allowed.'), + message: __('Invalid LBRY URL entered. Only A-Z, a-z, 0-9, and - allowed.'), }); } } catch (e) { -- 2.45.3 From b0ba23e49ab0f28e5ba2c5e45ce8ce2b9c36d351 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 14 Mar 2019 19:42:49 -0400 Subject: [PATCH 2/2] create showSnackError function --- src/ui/component/wunderbar/view.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ui/component/wunderbar/view.jsx b/src/ui/component/wunderbar/view.jsx index 92b0c012a..a9babfdf4 100644 --- a/src/ui/component/wunderbar/view.jsx +++ b/src/ui/component/wunderbar/view.jsx @@ -81,7 +81,7 @@ class WunderBar extends React.PureComponent { } handleSubmit(value: string, suggestion?: { value: string, type: string }) { - const { onSubmit, onSearch } = this.props; + const { onSubmit, onSearch, doShowSnackBar } = this.props; const query = value.trim(); const getParams = () => { const parts = query.split('?'); @@ -94,6 +94,12 @@ class WunderBar extends React.PureComponent { return extraParams; }; + const showSnackError = () => { + doShowSnackBar({ + message: __('Invalid LBRY URL entered. Only A-Z, a-z, 0-9, and "-" allowed.'), + }); + }; + // User selected a suggestion if (suggestion) { if (suggestion.type === 'search') { @@ -103,9 +109,7 @@ class WunderBar extends React.PureComponent { const uri = normalizeURI(query); onSubmit(uri, params); } else { - this.props.doShowSnackBar({ - message: __('Invalid LBRY URL entered. Only A-Z, a-z, 0-9, and - allowed.'), - }); + showSnackError(); } return; @@ -119,9 +123,7 @@ class WunderBar extends React.PureComponent { const params = getParams(); onSubmit(uri, params); } else { - this.props.doShowSnackBar({ - message: __('Invalid LBRY URL entered. Only A-Z, a-z, 0-9, and - allowed.'), - }); + showSnackError(); } } catch (e) { onSearch(query); -- 2.45.3