Skip to content

Commit

Permalink
Merge pull request #3 from OmniFlix/code_updates
Browse files Browse the repository at this point in the history
account switch while disconnected, copy button issues resolved.
  • Loading branch information
SrikanthSoparla authored Oct 1, 2021
2 parents 166441d + ce24c90 commit afcca85
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/CopyButton/TextButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const CopyButton = (props) => {
};

const handleCopy = (e) => {
navigator.clipboard.writeText(props.data);
navigator && navigator.clipboard && navigator.clipboard.writeText(props.data);

e.stopPropagation();
setOpen(true);
Expand Down
2 changes: 1 addition & 1 deletion src/components/CopyButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const CopyButton = (props) => {
};

const handleCopy = (e) => {
navigator.clipboard.writeText(props.data);
navigator && navigator.clipboard && navigator.clipboard.writeText(props.data);

e.stopPropagation();
setOpen(true);
Expand Down
6 changes: 5 additions & 1 deletion src/containers/NavBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ class NavBar extends Component {
}
});
}
window.addEventListener('keplr_keystorechange', this.handleChain);
window.addEventListener('keplr_keystorechange', () => {
if (localStorage.getItem('of_co_address') || this.props.address) {
this.handleChain();
}
});
}

componentDidUpdate (pp, ps, ss) {
Expand Down
15 changes: 10 additions & 5 deletions src/containers/Stake/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { commaSeparator } from '../../utils/numberFormats';
import ValidatorName from './ValidatorName';
import { config } from '../../config';
import ConnectButton from '../NavBar/ConnectButton';
import classNames from 'classnames';

class Table extends Component {
render () {
Expand Down Expand Up @@ -56,8 +57,14 @@ class Table extends Component {
options: {
sort: false,
customBodyRender: (value) => (
<div className="status" title={value}>
{value}
<div
className={classNames('status', value.jailed ? 'red_status' : '')}
title={value.status === 1 ? 'unbonding'
: value.status === 2 ? 'unbonded'
: value.status === 3 ? 'active' : ''}>
{value.status === 1 ? 'unbonding'
: value.status === 2 ? 'unbonded'
: value.status === 3 ? 'active' : ''}
</div>
),
},
Expand Down Expand Up @@ -128,9 +135,7 @@ class Table extends Component {
? dataToMap.map((item) =>
[
item,
item.status === 1 ? 'unbonding'
: item.status === 2 ? 'unbonded'
: item.status === 3 ? 'active' : '',
item,
(Number(item.tokens) / 1000000).toFixed(1),
item.commission && item.commission.commission_rates &&
item.commission.commission_rates.rate
Expand Down
5 changes: 5 additions & 0 deletions src/containers/Stake/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@
padding: 6px 12px;
}

.table td .status.red_status {
border: 1px solid #ff0000;
color: #ff0000;
}

.table tfoot td {
border-bottom: unset;
}
Expand Down

0 comments on commit afcca85

Please sign in to comment.