Skip to content

Commit 4aacc8e

Browse files
committed
fix(height overrun): fixed height overrun and error import problems
1 parent 6f85079 commit 4aacc8e

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

example/basic-dapp/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ async function walletInitialized() {
690690
}
691691

692692
importAddressButton.onclick = async () => {
693+
if (importAddressInput.value.replace(/\s+/g, '') === '') {
694+
getElement('import_address_result').innerHTML = 'valid Params'
695+
return
696+
}
693697
try {
694698
const tx = {
695699
address: importAddressInput.value.replace(/\s+/g, '').split(','),
@@ -706,6 +710,10 @@ async function walletInitialized() {
706710
}
707711

708712
importPrivateKeyButton.onclick = async () => {
713+
if (importPrivateKeyInput.value.replace(/\s+/g, '') === '') {
714+
getElement('import_private_key_result').innerHTML = 'valid Params'
715+
return
716+
}
709717
try {
710718
const tx = {
711719
privateKey: importPrivateKeyInput.value.replace(/\s+/g, '').split(','),

src/utils/common.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ import { API_BASE_URL, BASE_URL } from '../config'
88
import { IAuthResult, IIframeOptions } from '../interface/provider'
99
import { Provider } from '../provider'
1010

11+
export const getFrameWidth = () => {
12+
if (window.innerHeight < 736) {
13+
return ((window.innerHeight - 18) * 9.0) / 16.0
14+
} else {
15+
return 414
16+
}
17+
}
18+
19+
export const getFrameHeight = () => {
20+
if (window.innerHeight < 736) {
21+
return window.innerHeight - 18
22+
} else {
23+
return 736
24+
}
25+
}
26+
1127
/**
1228
* Check the window width to decide whether to show in full screen
1329
*/
@@ -97,8 +113,8 @@ export const getIframe = async (
97113
z-index: 999999999;
98114
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
99115
border-radius: ${isFullScreen() ? '0' : '15px'};
100-
width: ${isFullScreen() ? '100%' : '414px'};
101-
height: ${isFullScreen() ? '100%' : '736px'};
116+
width: ${isFullScreen() ? '100%' : `${getFrameWidth()}px`};
117+
height: ${isFullScreen() ? '100%' : `${getFrameHeight()}px`};
102118
transform: translate(-50%, -50%);
103119
top: 50%;
104120
left: 50%;

0 commit comments

Comments
 (0)