Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix balance spinner when wallet is not connected #219

Open
wants to merge 1 commit into
base: bsc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const SearchInput = observer((params: { value: string; onChange: (value:
style={{
background: 'white',
flex: 1,
padding: '0 0 0 16px',
padding: '10px 16px',
height: 48,
}}
onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ export class Table extends React.Component<IProps> {
tableParams,
scroll = {},
} = this.props;
console.log(dataLayerConfig)
const { paginationData } = dataLayerConfig;

return (
<div style={{ position: 'relative' }}>
<div style={{ position: 'relative', width: '100%' }}>
{isPending && (
<LoaderWrap>
<Spinner style={{ width: 24, height: 24 }} />
Expand Down
12 changes: 8 additions & 4 deletions src/pages/Exchange/steps/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ const getBalance = async (
scrt.maxAmount = unlockToken;
}



return { eth, scrt };
};

Expand All @@ -138,8 +140,8 @@ export const Base = observer(() => {
const [metamaskNetwork, setMetamaskNetork] = useState<NETWORKS>(NETWORKS.ETH);

const defaultBalance: BalanceInterface = {
eth: { minAmount: '', maxAmount: '' },
scrt: { minAmount: '', maxAmount: '' },
eth: { minAmount: '0', maxAmount: '0' },
scrt: { minAmount: '0', maxAmount: '0' },
};
const [balance, setBalance] = useState<BalanceInterface>(defaultBalance);
const [onSwap, setSwap] = useState<boolean>(false);
Expand Down Expand Up @@ -273,8 +275,8 @@ export const Base = observer(() => {
setProgress(0);
const newerrors = errors;
setBalance({
eth: { minAmount: 'loading', maxAmount: 'loading' },
scrt: { minAmount: 'loading', maxAmount: 'loading' },
eth: { minAmount: userMetamask.isAuthorized ? 'loading' : '0', maxAmount: userMetamask.isAuthorized ? 'loading' : '0' },
scrt: { minAmount: user.isAuthorized ? 'loading' : '0', maxAmount: user.isAuthorized ? 'loading' : '0' },
});

if (isNativeToken(token)) {
Expand Down Expand Up @@ -306,6 +308,8 @@ export const Base = observer(() => {
const amount = user.balanceToken[token.src_coin];
const isLocked = amount === unlockToken;



while (userMetamask.balancesLoading) {
await sleep(50);
}
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Explorer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ export const Explorer = observer((props: any) => {
className={styles.search}
justify="end"
style={{ width: '85vw' }}
pad={{ horizontal: '9px' }}
margin={{ top: 'medium', bottom: 'medium' }}
>
<SearchInput value={search} onChange={setSearch} />
Expand All @@ -206,7 +205,7 @@ export const Explorer = observer((props: any) => {
isPending={operations.isPending}
dataLayerConfig={operations.dataFlow}
onChangeDataFlow={onChangeDataFlow}
onRowClicked={() => {}}
onRowClicked={() => { }}
tableParams={{
rowKey: (data: any) => data.id,
}}
Expand Down