Skip to content

Commit e7746a3

Browse files
Merge pull request #27 from Permissionless-Software-Foundation/dh-fix-issues
fix(issues): Fixed some visual issues
2 parents 06ccf6a + e51fda5 commit e7746a3

File tree

5 files changed

+52
-38
lines changed

5 files changed

+52
-38
lines changed

src/components/admin-lte/index.js

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
33
import Configure from './configure'
44
import Tokens from './tokens'
55
import Wallet from './wallet'
6+
67
// import Audit from "./audit"
78

89
import AdminLTE, { Sidebar, Navbar } from 'adminlte-2-react'
@@ -72,7 +73,6 @@ class AdminLTEPage extends React.Component {
7273
</Navbar.Core>
7374
<Layout path='/'>
7475
<div className='components-container'>
75-
7676
{_this.state.section === 'Send/Receive' && (
7777
<SendReceive
7878
setWalletInfo={_this.props.setWalletInfo}
@@ -100,15 +100,6 @@ class AdminLTEPage extends React.Component {
100100
/>
101101
)}
102102

103-
{_this.state.section === 'Wallet' && (
104-
<Wallet
105-
setWalletInfo={_this.props.setWalletInfo}
106-
walletInfo={_this.props.walletInfo}
107-
updateBalance={_this.props.updateBalance}
108-
setBchWallet={_this.props.setBchWallet}
109-
/>
110-
)}
111-
112103
{_this.state.section === 'Configure' && (
113104
<Configure
114105
walletInfo={_this.props.walletInfo}
@@ -118,14 +109,13 @@ class AdminLTEPage extends React.Component {
118109
)}
119110

120111
{_this.renderNewViewItems()}
121-
122112
</div>
123113
</Layout>
124114
</AdminLTE>
125115
<Router>
126116
<ScannerModal
127117
show={_this.state.showScannerModal}
128-
onHide={_this.handleToggleScannerModal}
118+
handleOnHide={_this.onHandleToggleScannerModal}
129119
path='/'
130120
/>
131121
</Router>
@@ -199,7 +189,9 @@ class AdminLTEPage extends React.Component {
199189
childrens[i].id = textValue
200190
const ignore = ignoreItems.find(val => textValue === val)
201191
// Ignore menu items without link to components
202-
if (!ignore) { childrens[i].onclick = () => this.changeSection(textValue) }
192+
if (!ignore) {
193+
childrens[i].onclick = () => this.changeSection(textValue)
194+
}
203195
}
204196
}
205197
} catch (error) {
@@ -257,20 +249,23 @@ class AdminLTEPage extends React.Component {
257249
addOnClickEventToScanner () {
258250
try {
259251
const qrScannerEle = document.getElementById('Qr Scanner')
260-
qrScannerEle.onclick = () => _this.handleToggleScannerModal()
252+
qrScannerEle.onclick = () => _this.onHandleToggleScannerModal()
261253
} catch (error) {
262254
console.error(error)
263255
}
264256
}
265257

266258
// Controller to show the QR scanner
267-
handleToggleScannerModal () {
259+
onHandleToggleScannerModal () {
268260
if (!_this.state.showScannerModal) {
269261
_this.hideMenu()
270262
}
271263
_this.setState({
272264
showScannerModal: !_this.state.showScannerModal
273265
})
266+
setTimeout(() => {
267+
console.log(_this.state.showScannerModal)
268+
}, 500)
274269
}
275270

276271
// Render non-default menu items. The catch ensures that the render function
@@ -280,22 +275,35 @@ class AdminLTEPage extends React.Component {
280275
return menuComponents && menuComponents.map(m => m.menuItem)
281276
} catch (err) {
282277
// TODO: Figure out how to return an invisible Item.
283-
return <Item style={{ display: 'none' }} />
278+
return _this.getInvisibleMenuItem() // <Item style={{ display: 'none' }} />
284279
}
285280
}
286281

287282
// Displays the View corresponding to the dynamically loaded menu item.
288283
renderNewViewItems () {
289284
try {
290-
return (menuComponents && menuComponents.map(m => {
291-
if (_this.state.section === m.key) {
292-
return m.component
293-
}
294-
return ''
295-
}))
296-
} catch (err) {
285+
return (
286+
menuComponents &&
287+
menuComponents.map(m => {
288+
if (_this.state.section === m.key) {
289+
return m.component
290+
}
291+
return ''
292+
})
293+
)
294+
} catch (err) {}
295+
}
297296

298-
}
297+
getInvisibleMenuItem () {
298+
return (
299+
<li style={{ display: 'none' }}>
300+
{/* Adding this childrens prevents console errors */}
301+
<a href='#'>
302+
<span />
303+
<span />
304+
</a>
305+
</li>
306+
)
299307
}
300308
}
301309
// Props prvided by redux

src/components/admin-lte/send-receive/send.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Send extends React.Component {
5353
buttonRight={
5454
<Button
5555
icon='fa-qrcode'
56-
onClick={_this.handleToggleScanner}
56+
onClick={_this.handleModal}
5757
/>
5858
}
5959
/>
@@ -89,8 +89,8 @@ class Send extends React.Component {
8989
</Row>
9090
<ScannerModal
9191
show={_this.state.showScan}
92-
onHide={_this.handleToggleScanner}
93-
onScan={_this.handleOnScan}
92+
handleOnHide={_this.onHandleToggleScanner}
93+
handleOnScan={_this.onHandleScan}
9494
/>
9595
</Content>
9696
</>
@@ -199,7 +199,13 @@ class Send extends React.Component {
199199
}
200200
}
201201

202-
handleToggleScanner () {
202+
onHandleToggleScanner () {
203+
_this.setState({
204+
showScan: !_this.state.showScan
205+
})
206+
}
207+
208+
handleModal () {
203209
_this.setState({
204210
showScan: !_this.state.showScan
205211
})
@@ -214,7 +220,7 @@ class Send extends React.Component {
214220
addressEle.value = ''
215221
}
216222

217-
handleOnScan (data) {
223+
onHandleScan (data) {
218224
const validateAdrrs = ['bitcoincash', 'simpleledger']
219225
try {
220226
_this.resetAddressValue()
@@ -240,9 +246,9 @@ class Send extends React.Component {
240246
if (!isValid) {
241247
throw new Error('It should scan a bch address or slp address')
242248
}
243-
_this.handleToggleScanner()
249+
_this.onHandleToggleScanner()
244250
} catch (error) {
245-
_this.handleToggleScanner()
251+
_this.onHandleToggleScanner()
246252
_this.setState({
247253
errMsg: error.message
248254
})

src/components/admin-lte/tokens/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Tokens extends React.Component {
8181
)}
8282
<TokenModal
8383
token={_this.state.selectedToken ? _this.state.selectedToken : {}}
84-
onHide={_this.handleToggleModal}
84+
handleOnHide={_this.onHandleToggleModal}
8585
show={_this.state.showModal}
8686
/>
8787
</>
@@ -119,10 +119,10 @@ class Tokens extends React.Component {
119119
_this.setState({
120120
selectedToken
121121
})
122-
_this.handleToggleModal()
122+
_this.onHandleToggleModal()
123123
}
124124

125-
handleToggleModal () {
125+
onHandleToggleModal () {
126126
_this.setState({
127127
showModal: !_this.state.showModal
128128
})

src/components/admin-lte/tokens/token-modal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,6 @@ class TokenModal extends React.Component {
160160
TokenModal.propTypes = {
161161
token: PropTypes.object.isRequired,
162162
show: PropTypes.bool.isRequired,
163-
onHide: PropTypes.func.isRequired
163+
handleOnHide: PropTypes.func.isRequired
164164
}
165165
export default TokenModal

src/components/qr-scanner/modal.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class ScannerModal extends Component {
3434

3535
ScannerModal.propTypes = {
3636
show: PropTypes.bool.isRequired,
37-
OnHide: PropTypes.func.isRequired,
38-
onError: PropTypes.func,
39-
onScan: PropTypes.func
37+
handleOnHide: PropTypes.func.isRequired,
38+
handleOnError: PropTypes.func,
39+
handleOnScan: PropTypes.func
4040
}
4141

4242
export default ScannerModal

0 commit comments

Comments
 (0)