mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-18 16:53:16 +00:00
Fix stateless tradebox
This commit is contained in:
@ -36,39 +36,6 @@ function pn(x) {
|
|||||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
function TabPanel(props) {
|
|
||||||
const { children, value, index, ...other } = props;
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
role="tabpanel"
|
|
||||||
hidden={value !== index}
|
|
||||||
id={`simple-tabpanel-${index}`}
|
|
||||||
aria-labelledby={`simple-tab-${index}`}
|
|
||||||
{...other}
|
|
||||||
>
|
|
||||||
{value === index && (
|
|
||||||
<Box sx={{ p: 3 }}>
|
|
||||||
<Typography>{children}</Typography>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TabPanel.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
index: PropTypes.number.isRequired,
|
|
||||||
value: PropTypes.number.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
function a11yProps(index) {
|
|
||||||
return {
|
|
||||||
id: `simple-tab-${index}`,
|
|
||||||
'aria-controls': `simple-tabpanel-${index}`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default class OrderPage extends Component {
|
export default class OrderPage extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -80,6 +47,7 @@ export default class OrderPage extends Component {
|
|||||||
loading: true,
|
loading: true,
|
||||||
openCancel: false,
|
openCancel: false,
|
||||||
openCollaborativeCancel: false,
|
openCollaborativeCancel: false,
|
||||||
|
showContractBox: 1,
|
||||||
};
|
};
|
||||||
this.orderId = this.props.match.params.orderId;
|
this.orderId = this.props.match.params.orderId;
|
||||||
this.getCurrencyDict();
|
this.getCurrencyDict();
|
||||||
@ -334,7 +302,7 @@ export default class OrderPage extends Component {
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={this.handleClickCloseCollaborativeCancelDialog} autoFocus>Go back</Button>
|
<Button onClick={this.handleClickCloseCollaborativeCancelDialog} autoFocus>Go back</Button>
|
||||||
<Button onClick={this.handleClickConfirmCollaborativeCancelButton}> Proceed and Ask for Cancel </Button>
|
<Button onClick={this.handleClickConfirmCollaborativeCancelButton}> Ask for Cancel </Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
)
|
)
|
||||||
@ -542,36 +510,46 @@ export default class OrderPage extends Component {
|
|||||||
{this.orderBox()}
|
{this.orderBox()}
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={6} align="left">
|
<Grid item xs={6} align="left">
|
||||||
<TradeBox data={this.state} completeSetState={this.completeSetState} />
|
<TradeBox width={330} data={this.state} completeSetState={this.completeSetState} />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a11yProps(index) {
|
||||||
|
return {
|
||||||
|
id: `simple-tab-${index}`,
|
||||||
|
'aria-controls': `simple-tabpanel-${index}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
doubleOrderPagePhone=()=>{
|
doubleOrderPagePhone=()=>{
|
||||||
|
|
||||||
const [value, setValue] = React.useState(1);
|
const [value, setValue] = React.useState(this.state.showContractBox);
|
||||||
|
|
||||||
const handleChange = (event, newValue) => {
|
const handleChange = (event, newValue) => {
|
||||||
|
this.setState({showContractBox:newValue})
|
||||||
setValue(newValue);
|
setValue(newValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<Box sx={{ width: '100%' }}>
|
<Box sx={{ width: '100%' }}>
|
||||||
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
||||||
<Tabs value={value} onChange={handleChange} aria-label="basic tabs" variant="fullWidth">
|
<Tabs value={value} onChange={handleChange} variant="fullWidth" >
|
||||||
<Tab label="Order Details" {...a11yProps(0)} />
|
<Tab label="Order Details" {...this.a11yProps(0)} />
|
||||||
<Tab label="Contract Box" {...a11yProps(1)} />
|
<Tab label="Contract Box" {...this.a11yProps(1)} />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
<TabPanel value={value} index={0}>
|
<Grid container spacing={2}>
|
||||||
<Grid container style={{ width:330}}>
|
<Grid item >
|
||||||
|
<div style={{ width:330, display: this.state.showContractBox == 0 ? '':'none'}}>
|
||||||
{this.orderBox()}
|
{this.orderBox()}
|
||||||
|
</div>
|
||||||
|
<div style={{display: this.state.showContractBox == 1 ? '':'none'}}>
|
||||||
|
<TradeBox width={330} data={this.state} completeSetState={this.completeSetState} />
|
||||||
|
</div>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabPanel>
|
|
||||||
<TabPanel value={value} index={1}>
|
|
||||||
<TradeBox data={this.state} completeSetState={this.completeSetState} />
|
|
||||||
</TabPanel>
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -360,8 +360,6 @@ export default class TradeBox extends Component {
|
|||||||
return (
|
return (
|
||||||
|
|
||||||
<Grid container spacing={1}>
|
<Grid container spacing={1}>
|
||||||
{/* In case the taker was very fast to scan the bond, make the taker found alarm sound again */}
|
|
||||||
<this.Sound soundFileName="taker-found"/>
|
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
<Typography color="primary" component="subtitle1" variant="subtitle1">
|
<Typography color="primary" component="subtitle1" variant="subtitle1">
|
||||||
<b> Submit a LN invoice for {pn(this.props.data.invoice_amount)} Sats </b>
|
<b> Submit a LN invoice for {pn(this.props.data.invoice_amount)} Sats </b>
|
||||||
@ -769,7 +767,7 @@ handleRatingChange=(e)=>{
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={1} style={{ width:330}}>
|
<Grid container spacing={1} style={{ width:this.props.width}}>
|
||||||
<this.ConfirmDisputeDialog/>
|
<this.ConfirmDisputeDialog/>
|
||||||
<this.ConfirmFiatReceivedDialog/>
|
<this.ConfirmFiatReceivedDialog/>
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
|
Reference in New Issue
Block a user