mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex-taker-v2.git
synced 2026-09-21 16:52:01 -07:00
Merge pull request #9 from Permissionless-Software-Foundation/ct-unstable
Making BCH page the default at startup
This commit is contained in:
@@ -45,7 +45,7 @@ function GetBalance (props) {
|
||||
<Col className='text-break' style={{ textAlign: 'center' }}>
|
||||
<Form>
|
||||
<Form.Group className='mb-3' controlId='formBasicEmail'>
|
||||
<Form.Label>Enter a BCH address to check the balance.</Form.Label>
|
||||
<Form.Label>Enter any BCH address to query its balance on the blockchain.</Form.Label>
|
||||
<Form.Control type='text' placeholder='bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d' onChange={e => setTextInput(e.target.value)} />
|
||||
</Form.Group>
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ function AppBody (props) {
|
||||
return (
|
||||
<>
|
||||
<Routes>
|
||||
<Route path='/' element={<GetBalance wallet={appData.wallet} />} />
|
||||
<Route path='/' element={<BchSend appData={appData} />} />
|
||||
<Route path='/balance' element={<GetBalance wallet={appData.wallet} />} />
|
||||
<Route path='/bch' element={<BchSend appData={appData} />} />
|
||||
<Route path='/wallet' element={<Wallet appData={appData} />} />
|
||||
|
||||
@@ -3,25 +3,25 @@
|
||||
*/
|
||||
|
||||
// Global npm libraries
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import React, { useEffect } from 'react'
|
||||
import { Container, Row, Col } from 'react-bootstrap'
|
||||
|
||||
// Local libraries
|
||||
import config from '../../config'
|
||||
import Memo from './get-cid'
|
||||
// import Memo from './get-cid'
|
||||
|
||||
function Footer (props) {
|
||||
const [ipfsCid, setIpfsCid] = useState(config.ipfsCid)
|
||||
// const [ipfsCid, setIpfsCid] = useState(config.ipfsCid)
|
||||
const wallet = props.appData.wallet
|
||||
|
||||
// Retrieve the most up-to-date CID for the app on Filecoin from the BCH blockchain.
|
||||
useEffect(() => {
|
||||
async function fetchData () {
|
||||
try {
|
||||
const hash = await getUpdatedUrl(wallet)
|
||||
if (hash) {
|
||||
setIpfsCid(hash)
|
||||
}
|
||||
// const hash = await getUpdatedUrl(wallet)
|
||||
// if (hash) {
|
||||
// setIpfsCid(hash)
|
||||
// }
|
||||
} catch (err) {
|
||||
console.error('Error trying to retrieve Filecoin CID for the app from the BCH blockchain.')
|
||||
}
|
||||
@@ -32,56 +32,44 @@ function Footer (props) {
|
||||
return (
|
||||
<Container style={{ backgroundColor: '#ddd' }}>
|
||||
<Row style={{ padding: '25px' }}>
|
||||
<Col>
|
||||
<h6>Site Mirrors</h6>
|
||||
<ul>
|
||||
<li>
|
||||
<a href={config.ghPagesUrl} target='_blank' rel='noreferrer'>GitHub Pages</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={`https://${ipfsCid}.ipfs.dweb.link/`} target='_blank' rel='noreferrer'>Filecoin</a>
|
||||
</li>
|
||||
</ul>
|
||||
</Col>
|
||||
|
||||
<Col>
|
||||
<h6>Source Code</h6>
|
||||
<ul>
|
||||
<li>
|
||||
<a href={config.ghRepo} target='_blank' rel='noreferrer'>GitHub</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={config.radicleUrl} target='_blank' rel='noreferrer'>Radicle</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</Col>
|
||||
|
||||
<Col />
|
||||
</Row>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
async function getUpdatedUrl (wallet) {
|
||||
try {
|
||||
// Exit if the wallet is not initialized.
|
||||
if (!wallet) return
|
||||
// async function getUpdatedUrl (wallet) {
|
||||
// try {
|
||||
// // Exit if the wallet is not initialized.
|
||||
// if (!wallet) return
|
||||
|
||||
// Initialize the memo library for retrieving data from the BCH blockchain.
|
||||
const memo = new Memo({ bchAddr: config.appBchAddr })
|
||||
await memo.initialize(wallet)
|
||||
const hash = await memo.findHash()
|
||||
// // Initialize the memo library for retrieving data from the BCH blockchain.
|
||||
// const memo = new Memo({ bchAddr: config.appBchAddr })
|
||||
// await memo.initialize(wallet)
|
||||
// const hash = await memo.findHash()
|
||||
|
||||
if (!hash) {
|
||||
console.error(
|
||||
`Could not find IPFS hash in transactions for address ${config.appBchAddr}`
|
||||
)
|
||||
return false
|
||||
}
|
||||
// console.log(`latest IPFS hash: ${hash}`)
|
||||
// if (!hash) {
|
||||
// console.error(
|
||||
// `Could not find IPFS hash in transactions for address ${config.appBchAddr}`
|
||||
// )
|
||||
// return false
|
||||
// }
|
||||
// // console.log(`latest IPFS hash: ${hash}`)
|
||||
|
||||
return hash
|
||||
} catch (err) {
|
||||
console.log('Error in getUpdatedUrl(): ', err)
|
||||
}
|
||||
}
|
||||
// return hash
|
||||
// } catch (err) {
|
||||
// console.log('Error in getUpdatedUrl(): ', err)
|
||||
// }
|
||||
// }
|
||||
|
||||
export default Footer
|
||||
|
||||
@@ -37,20 +37,15 @@ function NavMenu (props) {
|
||||
<Navbar.Toggle aria-controls='responsive-navbar-nav' />
|
||||
<Navbar.Collapse id='responsive-navbar-nav'>
|
||||
<Nav className='mr-auto'>
|
||||
|
||||
<NavLink
|
||||
className={(currentPath === '/balance' || currentPath === '/') ? 'nav-link-active' : 'nav-link-inactive'}
|
||||
to='/balance'
|
||||
onClick={handleClickEvent}
|
||||
>
|
||||
Check Balance
|
||||
</NavLink>
|
||||
<NavLink
|
||||
className={(currentPath === '/bch') ? 'nav-link-active' : 'nav-link-inactive'}
|
||||
className={(currentPath === '/bch' || currentPath === '/') ? 'nav-link-active' : 'nav-link-inactive'}
|
||||
to='/bch'
|
||||
onClick={handleClickEvent}
|
||||
>
|
||||
BCH
|
||||
</NavLink>
|
||||
|
||||
<NavLink
|
||||
className={currentPath === '/wallet' ? 'nav-link-active' : 'nav-link-inactive'}
|
||||
to='/wallet'
|
||||
@@ -59,6 +54,7 @@ function NavMenu (props) {
|
||||
>
|
||||
Wallet
|
||||
</NavLink>
|
||||
|
||||
<NavLink
|
||||
className={currentPath === '/slp-tokens' ? 'nav-link-active' : 'nav-link-inactive'}
|
||||
to='/slp-tokens'
|
||||
@@ -66,19 +62,13 @@ function NavMenu (props) {
|
||||
>
|
||||
Tokens
|
||||
</NavLink>
|
||||
|
||||
<NavLink
|
||||
className={currentPath === '/Placeholder2' ? 'nav-link-active' : 'nav-link-inactive'}
|
||||
to='/Placeholder2'
|
||||
className={(currentPath === '/balance') ? 'nav-link-active' : 'nav-link-inactive'}
|
||||
to='/balance'
|
||||
onClick={handleClickEvent}
|
||||
>
|
||||
Placeholder2
|
||||
</NavLink>
|
||||
<NavLink
|
||||
className={currentPath === '/placeholder3' ? 'nav-link-active' : 'nav-link-inactive'}
|
||||
to='/placeholder3'
|
||||
onClick={handleClickEvent}
|
||||
>
|
||||
Placeholder 3
|
||||
Check Balance
|
||||
</NavLink>
|
||||
</Nav>
|
||||
</Navbar.Collapse>
|
||||
|
||||
Reference in New Issue
Block a user