Commit 34d4e9b4 authored by zeroleak's avatar zeroleak
Browse files

cleanup

parent 984e2195
...@@ -29,9 +29,9 @@ export default class DepositModal extends AbstractModal { ...@@ -29,9 +29,9 @@ export default class DepositModal extends AbstractModal {
}) })
} }
if (distinct) { if (distinct) {
this.loading("Fetching another deposit address...", walletService.fetchDepositAddressDistinct(this.state.depositAddress).then(setState)) this.loading("Loading...", walletService.fetchDepositAddressDistinct(this.state.depositAddress).then(setState))
} else { } else {
this.loading("Fetching deposit address...", walletService.fetchDepositAddress().then(setState)) this.loading("Loading...", walletService.fetchDepositAddress().then(setState))
} }
} }
......
...@@ -41,9 +41,9 @@ export default function Tx0Modal(props) { ...@@ -41,9 +41,9 @@ export default function Tx0Modal(props) {
// compute available pools // compute available pools
useEffect(() => { useEffect(() => {
// fetch pools for tx0 feeTarget // fetch pools for tx0 feeTarget
modalUtils.load("Fetching pools for tx0...", poolsService.fetchPoolsForTx0(spendValue, tx0FeeTarget, mixFeeTarget).then(newPools => { modalUtils.load("Loading...", poolsService.fetchPoolsForTx0(spendValue, tx0FeeTarget, mixFeeTarget).then(newPools => {
if (newPools.length == 0) { if (newPools.length == 0) {
modalUtils.setError("No pool for this utxo and miner fee.") modalUtils.setError("No pool for such utxo and miner fee.")
} }
setPools(newPools) setPools(newPools)
})) }))
...@@ -66,7 +66,7 @@ export default function Tx0Modal(props) { ...@@ -66,7 +66,7 @@ export default function Tx0Modal(props) {
setTx0Preview(undefined) setTx0Preview(undefined)
} else { } else {
// preview // preview
modalUtils.load("Fetching tx0 data...", backendService.tx0.tx0Preview(utxos, tx0FeeTarget, mixFeeTarget, poolId).then(newTx0Preview => { modalUtils.load("Loading...", backendService.tx0.tx0Preview(utxos, tx0FeeTarget, mixFeeTarget, poolId).then(newTx0Preview => {
setTx0Preview(newTx0Preview) setTx0Preview(newTx0Preview)
})) }))
} }
......
...@@ -89,11 +89,10 @@ const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey }) => { ...@@ -89,11 +89,10 @@ const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey }) => {
{ {
Header: 'Confs', Header: 'Confs',
accessor: o => o.confirmations, accessor: o => o.confirmations,
className: 'text-muted',
Cell: o => o.cell.value > 0 ? ( Cell: o => o.cell.value > 0 ? (
<small title="confirmations">{o.cell.value}</small> <small title="confirmations">{o.cell.value}</small>
) : ( ) : (
<FontAwesomeIcon icon={Icons.faClock} size='xs' title='Unconfirmed'/> <FontAwesomeIcon icon={Icons.faClock} size='xs' title='Unconfirmed' className='text-muted'/>
) )
}, },
{ {
......
...@@ -147,7 +147,7 @@ class App extends React.Component<Props> { ...@@ -147,7 +147,7 @@ class App extends React.Component<Props> {
</div>} </div>}
</div> </div>
<div className='col-md-10'> <div className='col-md-10'>
{cliService.isLoggedIn() && (mixService.isReady() && poolsService.isReady() ? <MixStatus mixState={this.props.mix} poolsState={this.props.pools} mixActions={this.props.mixActions}/> : <small>Fetching mix state...</small>)} {cliService.isLoggedIn() && (mixService.isReady() && poolsService.isReady() ? <MixStatus mixState={this.props.mix} poolsState={this.props.pools} mixActions={this.props.mixActions}/> : utils.spinner())}
{cliService.isCliStatusReady() && !cliService.isLoggedIn() && <div className='text-center'> {cliService.isCliStatusReady() && !cliService.isLoggedIn() && <div className='text-center'>
<Link to={routes.HOME}> <Link to={routes.HOME}>
<FontAwesomeIcon icon={Icons.faLock} size='3x' color='#CCC'/> <FontAwesomeIcon icon={Icons.faLock} size='3x' color='#CCC'/>
...@@ -239,7 +239,7 @@ class App extends React.Component<Props> { ...@@ -239,7 +239,7 @@ class App extends React.Component<Props> {
</ul> </ul>
{cliService.isLoggedIn() && !walletService.isReady() && <div> {cliService.isLoggedIn() && !walletService.isReady() && <div>
<small>Fetching wallet...</small> {utils.spinner()}
</div>} </div>}
<div className="footerNav"> <div className="footerNav">
<div> <div>
......
...@@ -20,7 +20,6 @@ export default class ConfigPage extends Component<Props> { ...@@ -20,7 +20,6 @@ export default class ConfigPage extends Component<Props> {
error: undefined, error: undefined,
cliConfig: undefined, cliConfig: undefined,
showDevelopersConfig: false, showDevelopersConfig: false,
showAdvancedConfig: false
} }
this.cliConfigService = new CliConfigService(cliConfig => this.setState({ this.cliConfigService = new CliConfigService(cliConfig => this.setState({
...@@ -31,7 +30,6 @@ export default class ConfigPage extends Component<Props> { ...@@ -31,7 +30,6 @@ export default class ConfigPage extends Component<Props> {
this.onChangeCliConfig = this.onChangeCliConfig.bind(this) this.onChangeCliConfig = this.onChangeCliConfig.bind(this)
this.onSubmit = this.onSubmit.bind(this) this.onSubmit = this.onSubmit.bind(this)
this.toogleDevelopersConfig = this.toogleDevelopersConfig.bind(this) this.toogleDevelopersConfig = this.toogleDevelopersConfig.bind(this)
this.toogleAdvancedConfig = this.toogleAdvancedConfig.bind(this)
} }
onResetConfig() { onResetConfig() {
...@@ -71,15 +69,9 @@ export default class ConfigPage extends Component<Props> { ...@@ -71,15 +69,9 @@ export default class ConfigPage extends Component<Props> {
}) })
} }
toogleAdvancedConfig() {
this.setState({
showAdvancedConfig: !this.state.showAdvancedConfig
})
}
render() { render() {
if (!this.state.cliConfig) { if (!this.state.cliConfig) {
return <small>Fetching CLI configuration...</small> return <small>Loading configuration...</small>
} }
const cliConfig = this.state.cliConfig const cliConfig = this.state.cliConfig
if (!cliConfig.mix) { if (!cliConfig.mix) {
...@@ -151,8 +143,8 @@ export default class ConfigPage extends Component<Props> { ...@@ -151,8 +143,8 @@ export default class ConfigPage extends Component<Props> {
<br/> <br/>
<Card> <Card>
<Card.Header><a onClick={this.toogleAdvancedConfig} style={{cursor:'pointer'}}>Advanced settings</a></Card.Header> <Card.Header>Advanced settings</Card.Header>
{this.state.showAdvancedConfig && <Card.Body> <Card.Body>
<div className="form-group row"> <div className="form-group row">
<label htmlFor="tx0MaxOutputs" className="col-sm-2 col-form-label">TX0 max outputs</label> <label htmlFor="tx0MaxOutputs" className="col-sm-2 col-form-label">TX0 max outputs</label>
<input type="number" className='form-control col-sm-3' onChange={e => { <input type="number" className='form-control col-sm-3' onChange={e => {
...@@ -171,15 +163,6 @@ export default class ConfigPage extends Component<Props> { ...@@ -171,15 +163,6 @@ export default class ConfigPage extends Component<Props> {
<label className='col-form-label col-sm-5 text-muted'>Random factor for generating a second change output to simulate a multi-user TX0 (0 = never, 1 = always, 2 = 1/2 probability, 3 = 1/3 probability...)</label> <label className='col-form-label col-sm-5 text-muted'>Random factor for generating a second change output to simulate a multi-user TX0 (0 = never, 1 = always, 2 = 1/2 probability, 3 = 1/3 probability...)</label>
</div> </div>
<div className="form-group row">
<label htmlFor="tx0FakeOutputMinValue" className="col-sm-2 col-form-label">TX0 min change</label>
<input type="number" className='form-control col-sm-3' onChange={e => {
const myValue = parseInt(e.target.value)
myThis.onChangeCliConfig(cliConfig => cliConfig.mix.tx0FakeOutputMinValue = myValue)
}} defaultValue={cliConfig.mix.tx0FakeOutputMinValue} id="tx0FakeOutputMinValue"/>
<label className='col-form-label col-sm-5 text-muted'>Minimum value per change output when using TX0 fake output</label>
</div>
<div className="form-group row"> <div className="form-group row">
<label htmlFor="proxy" className="col-sm-2 col-form-label">CLI proxy</label> <label htmlFor="proxy" className="col-sm-2 col-form-label">CLI proxy</label>
<input type="text" className='form-control col-sm-3' onChange={e => { <input type="text" className='form-control col-sm-3' onChange={e => {
...@@ -191,7 +174,7 @@ export default class ConfigPage extends Component<Props> { ...@@ -191,7 +174,7 @@ export default class ConfigPage extends Component<Props> {
<code>socks://host:port</code> or <code>http://host:port</code> <code>socks://host:port</code> or <code>http://host:port</code>
</label> </label>
</div> </div>
</Card.Body>} </Card.Body>
</Card> </Card>
<br/> <br/>
...@@ -218,6 +201,15 @@ export default class ConfigPage extends Component<Props> { ...@@ -218,6 +201,15 @@ export default class ConfigPage extends Component<Props> {
<label className='col-form-label col-sm-5 text-muted'>Max simultaneous mixing clients per pool</label> <label className='col-form-label col-sm-5 text-muted'>Max simultaneous mixing clients per pool</label>
</div>} </div>}
<div className="form-group row">
<label htmlFor="tx0FakeOutputMinValue" className="col-sm-2 col-form-label">TX0 min change</label>
<input type="number" className='form-control col-sm-3' onChange={e => {
const myValue = parseInt(e.target.value)
myThis.onChangeCliConfig(cliConfig => cliConfig.mix.tx0FakeOutputMinValue = myValue)
}} defaultValue={cliConfig.mix.tx0FakeOutputMinValue} id="tx0FakeOutputMinValue"/>
<label className='col-form-label col-sm-5 text-muted'>Minimum value per change output when using TX0 fake output</label>
</div>
</Card.Body>} </Card.Body>}
</Card> </Card>
<br/> <br/>
......
...@@ -20,14 +20,8 @@ class DepositPage extends Component { ...@@ -20,14 +20,8 @@ class DepositPage extends Component {
// tx0 // tx0
render() { render() {
if (!walletService.isReady()) { if (!walletService.isReady() || !mixService.isReady() || !poolsService.isReady()) {
return <small>Fetching wallet...</small> return utils.spinner()
}
if (!mixService.isReady()) {
return <small>Fetching mix state...</small>
}
if (!poolsService.isReady()) {
return <small>Fetching pools...</small>
} }
const utxos = walletService.getUtxosDeposit() const utxos = walletService.getUtxosDeposit()
......
...@@ -11,6 +11,7 @@ import walletService from '../services/walletService'; ...@@ -11,6 +11,7 @@ import walletService from '../services/walletService';
import mixService from '../services/mixService'; import mixService from '../services/mixService';
import poolsService from '../services/poolsService'; import poolsService from '../services/poolsService';
import UtxosTable from '../components/Utxo/UtxosTable'; import UtxosTable from '../components/Utxo/UtxosTable';
import utils from '../services/utils';
class LastActivityPage extends Component { class LastActivityPage extends Component {
...@@ -21,14 +22,8 @@ class LastActivityPage extends Component { ...@@ -21,14 +22,8 @@ class LastActivityPage extends Component {
// tx0 // tx0
render() { render() {
if (!walletService.isReady()) { if (!walletService.isReady() || !mixService.isReady() || !poolsService.isReady()) {
return <small>Fetching wallet...</small> return utils.spinner()
}
if (!mixService.isReady()) {
return <small>Fetching mix state...</small>
}
if (!poolsService.isReady()) {
return <small>Fetching pools...</small>
} }
const utxosDeposit = walletService.getUtxosDeposit().filter(a => a.lastActivityElapsed ? true : false) const utxosDeposit = walletService.getUtxosDeposit().filter(a => a.lastActivityElapsed ? true : false)
......
...@@ -16,7 +16,7 @@ class PoolsPage extends Component { ...@@ -16,7 +16,7 @@ class PoolsPage extends Component {
render() { render() {
if (!poolsService.isReady()) { if (!poolsService.isReady()) {
return <small>Fetching pools...</small> return utils.spinner()
} }
return ( return (
......
...@@ -15,14 +15,8 @@ export default class PostmixPage extends Component<Props> { ...@@ -15,14 +15,8 @@ export default class PostmixPage extends Component<Props> {
props: Props; props: Props;
render() { render() {
if (!walletService.isReady()) { if (!walletService.isReady() || !mixService.isReady() || !poolsService.isReady()) {
return <small>Fetching wallet...</small> return utils.spinner()
}
if (!mixService.isReady()) {
return <small>Fetching mix state...</small>
}
if (!poolsService.isReady()) {
return <small>Fetching pools...</small>
} }
const utxos = walletService.getUtxosPostmix() const utxos = walletService.getUtxosPostmix()
......
...@@ -15,14 +15,8 @@ export default class PremixPage extends Component<Props> { ...@@ -15,14 +15,8 @@ export default class PremixPage extends Component<Props> {
props: Props; props: Props;
render() { render() {
if (!walletService.isReady()) { if (!walletService.isReady() || !mixService.isReady() || !poolsService.isReady()) {
return <small>Fetching wallet...</small> return utils.spinner()
}
if (!mixService.isReady()) {
return <small>Fetching mix state...</small>
}
if (!poolsService.isReady()) {
return <small>Fetching pools...</small>
} }
const utxos = walletService.getUtxosPremix() const utxos = walletService.getUtxosPremix()
......
...@@ -158,8 +158,7 @@ class Utils { ...@@ -158,8 +158,7 @@ class Utils {
} }
statusLabelText(utxo) { statusLabelText(utxo) {
if ((utxo.status === UTXO_STATUS.READY && utxo.account === WHIRLPOOL_ACCOUNTS.POSTMIX) if (utxo.account === WHIRLPOOL_ACCOUNTS.POSTMIX) {
|| utxo.status === UTXO_STATUS.MIX_QUEUE || utxo.status === UTXO_STATUS.MIX_SUCCESS) {
return 'MIXED' return 'MIXED'
} }
if (utxo.mixableStatus === MIXABLE_STATUS.NO_POOL) { if (utxo.mixableStatus === MIXABLE_STATUS.NO_POOL) {
...@@ -171,6 +170,7 @@ class Utils { ...@@ -171,6 +170,7 @@ class Utils {
case UTXO_STATUS.TX0: return 'TX0' case UTXO_STATUS.TX0: return 'TX0'
case UTXO_STATUS.TX0_SUCCESS: return 'TX0:SUCCESS' case UTXO_STATUS.TX0_SUCCESS: return 'TX0:SUCCESS'
case UTXO_STATUS.TX0_FAILED: return 'TX0:ERROR' case UTXO_STATUS.TX0_FAILED: return 'TX0:ERROR'
case UTXO_STATUS.MIX_QUEUE: return 'QUEUE'
case UTXO_STATUS.MIX_STARTED: return 'MIXING' case UTXO_STATUS.MIX_STARTED: return 'MIXING'
case UTXO_STATUS.MIX_FAILED: return 'MIX:FAILED' case UTXO_STATUS.MIX_FAILED: return 'MIX:FAILED'
default: return '?' default: return '?'
...@@ -236,7 +236,7 @@ class Utils { ...@@ -236,7 +236,7 @@ class Utils {
if (len < 10) { if (len < 10) {
return str return str
} }
return str.substring(0, 5)+'...'+str.substring(len - 3) return str.substring(0, 5)+'...'+str.substring(len - 4)
} }
durationElapsed(time) { durationElapsed(time) {
...@@ -259,6 +259,10 @@ class Utils { ...@@ -259,6 +259,10 @@ class Utils {
document.body.removeChild(el); document.body.removeChild(el);
} }
spinner() {
return <FontAwesomeIcon icon={Icons.faSpinner} spin size='xs' />
}
} }
const utils = new Utils() const utils = new Utils()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment