Skip to content

Commit 3a72d12

Browse files
kilochytsky-ppldoomdabidon
authored andcommitted
[BRG-546] show error when extension not installed (#23)
1 parent af068ec commit 3a72d12

5 files changed

Lines changed: 29 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bridge-landing",
33
"description": "Echo Bridge Landing",
4-
"version": "1.16.0",
4+
"version": "1.16.1",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/echoprotocol/bridge-website.git"

src/actions/WidgetActions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ class WidgetActions extends BaseActionsClass {
9191
dispatch(this.setValue('error', 'Amount should be more than 0', false));
9292
return;
9393
}
94+
if (!window.echojslib) {
95+
dispatch(this.setValue('error', 'Install Bridge Extension to proceed', false));
96+
dispatch(this.setValue('downloadLink', 'https://chrome.google.com/webstore/detail/echo-bridge/ginklfodpcgldnicehmlpehfmgjhbdcl', false));
97+
return;
98+
}
9499
const access = await window.echojslib.extension.getAccess();
95100

96101
if (!access) {
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.toast {
1+
.toast {
22
@include futura-medium();
33
align-items: center;
44
justify-content: center;
@@ -7,6 +7,7 @@
77
bottom: 0;
88
left: 0;
99
display: flex;
10+
flex-direction: column;
1011
height: 77px;
1112
font-size: 16px;
1213

@@ -16,7 +17,8 @@
1617
color: #bb3e51;
1718
}
1819

19-
&-content {
20-
padding-top: 20px;
21-
}
2220
}
21+
22+
.toast-content {
23+
padding-top: 20px;
24+
}

src/components/QRCodeWidget/index.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class QRCodeWidget extends React.Component {
2323
account, error,
2424
currency,
2525
isConnected,
26+
downloadLink,
2627
} = this.props;
2728
return (
2829
<div className="widget-page">
@@ -83,6 +84,10 @@ class QRCodeWidget extends React.Component {
8384
<div className="toast-content">
8485
{error}
8586
</div>
87+
{
88+
downloadLink &&
89+
<a className="toast-link" href={downloadLink}>Download</a>
90+
}
8691
</div>
8792
}
8893

@@ -95,12 +100,17 @@ class QRCodeWidget extends React.Component {
95100

96101
}
97102

103+
QRCodeWidget.defaultProps = {
104+
downloadLink: null,
105+
};
106+
98107
QRCodeWidget.propTypes = {
99108
pay: PropTypes.func.isRequired,
100109
isConnected: PropTypes.bool.isRequired,
101110
account: PropTypes.string.isRequired,
102111
currency: PropTypes.object.isRequired,
103112
error: PropTypes.string.isRequired,
113+
downloadLink: PropTypes.string,
104114
};
105115

106116
export default QRCodeWidget;

src/containers/QRCodeWidget/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class QRCodeWidget extends React.Component {
4747
error,
4848
isConnected,
4949
pay,
50+
downloadLink,
5051
} = this.props;
5152
return (
5253
<QRCodeWidgetComponent
@@ -55,12 +56,16 @@ class QRCodeWidget extends React.Component {
5556
currency={currency}
5657
error={error}
5758
isConnected={isConnected}
59+
downloadLink={downloadLink}
5860
/>
5961
);
6062
}
6163

6264
}
6365

66+
QRCodeWidget.defaultProps = {
67+
downloadLink: null,
68+
};
6469
QRCodeWidget.propTypes = {
6570
match: PropTypes.object.isRequired,
6671
pay: PropTypes.func.isRequired,
@@ -69,13 +74,15 @@ QRCodeWidget.propTypes = {
6974
currency: PropTypes.object.isRequired,
7075
error: PropTypes.string.isRequired,
7176
isConnected: PropTypes.bool.isRequired,
77+
downloadLink: PropTypes.string,
7278
};
7379

7480
export default withRouter(connect(
7581
(state) => ({
7682
currency: state.widget.get('currency'),
7783
error: state.widget.get('error'),
7884
isConnected: state.global.get('isConnected'),
85+
downloadLink: state.widget.get('downloadLink'),
7986
}),
8087
(dispatch) => ({
8188
pay: (account) => dispatch(WidgetActions.payWithBridge(account)),

0 commit comments

Comments
 (0)