Syncing with upstream, fixing merge conflicts

This commit is contained in:
Chris Troutner
2025-02-17 08:00:02 -07:00
5 changed files with 11750 additions and 392 deletions
+11727 -378
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -37,7 +37,7 @@ function AppBody (props) {
<Route path='/servers' element={<ServerSelectView appData={appData} />} /> <Route path='/servers' element={<ServerSelectView appData={appData} />} />
</Routes> </Routes>
{/** Show in all paths except the servers view */} {/** Show in all paths except the servers view */}
{appData.currentPath !== '/servers' && <SelectServerButton linkTo='/servers' />} {appData.currentPath !== '/servers' && <SelectServerButton linkTo='/servers' appData={appData} />}
</> </>
) )
} }
@@ -9,7 +9,7 @@ import { Container, Row, Col, Button } from 'react-bootstrap'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
const ServerSelect = (props) => { const ServerSelect = (props) => {
const { linkTo } = props const { linkTo, appData } = props
// Use the navigate function to navigate to the servers view // Use the navigate function to navigate to the servers view
const navigate = useNavigate() const navigate = useNavigate()
@@ -31,6 +31,7 @@ const ServerSelect = (props) => {
<h5> <h5>
Having trouble loading? Try selecting a different back-end server. Having trouble loading? Try selecting a different back-end server.
</h5> </h5>
<p style={{ fontStyle: 'italic' }}>Current Server : {appData.serverUrl}</p>
<Button variant='warning' onClick={handleServerSelect}> <Button variant='warning' onClick={handleServerSelect}>
Select a different back end server Select a different back end server
</Button> </Button>
@@ -16,8 +16,9 @@ function ServerSelectView (props) {
const handleReloadServer = (event) => { const handleReloadServer = (event) => {
const target = event.target.id const target = event.target.id
console.log('server target: ', target) console.log('server target: ', target)
appData.updateLocalStorage({ serverUrl: target })
window.location.href = `/?restURL=${target}` // Reload the page
window.location.href = '/'
} }
return ( return (
+17 -10
View File
@@ -1,5 +1,5 @@
import { useState } from 'react' import { useState } from 'react'
import { useQueryParam, StringParam } from 'use-query-params' // import { useQueryParam, StringParam } from 'use-query-params'
import useLocalStorageState from 'use-local-storage-state' import useLocalStorageState from 'use-local-storage-state'
import AppUtil from '../util' import AppUtil from '../util'
@@ -8,11 +8,18 @@ import { useLocation } from 'react-router-dom'
function useAppState () { function useAppState () {
const location = useLocation() const location = useLocation()
// Get the CashStack URL from query parameter or use default // Load Local storage Data
let [restURL] = useQueryParam('restURL', StringParam) const [lsState, setLSState, { removeItem }] = useLocalStorageState('bchWalletState-template', {
if (!restURL) restURL = 'https://free-bch.fullstack.cash' ssr: true,
defaultValue: {
serverUrl: 'https://free-bch.fullstack.cash' // Default server
}
})
const [serverUrl, setServerUrl] = useState(restURL) console.log('lsState: ', lsState)
// Initialize data states
const [serverUrl, setServerUrl] = useState(lsState.serverUrl) // Default server url
const [menuState, setMenuState] = useState(0) const [menuState, setMenuState] = useState(0)
const [wallet, setWallet] = useState(false) const [wallet, setWallet] = useState(false)
const [servers, setServers] = useState([]) const [servers, setServers] = useState([])
@@ -33,11 +40,11 @@ function useAppState () {
// properties are enumerated here for the purpose of documentation. // properties are enumerated here for the purpose of documentation.
// Local storage // Local storage
const [lsState, setLSState, { removeItem }] = useLocalStorageState('bchWalletState', { // const [lsState, setLSState, { removeItem }] = useLocalStorageState('bchWalletState', {
ssr: true, // ssr: true,
defaultValue: {} // defaultValue: {}
}) // })
console.log('lsState: ', lsState) // console.log('lsState: ', lsState)
const removeLocalStorageItem = removeItem const removeLocalStorageItem = removeItem
const updateLocalStorage = (lsObj) => { const updateLocalStorage = (lsObj) => {
// console.log(`updateLocalStorage() input: ${JSON.stringify(lsObj, null, 2)}`) // console.log(`updateLocalStorage() input: ${JSON.stringify(lsObj, null, 2)}`)