mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 20:21:35 +00:00
Add reward invoice submit to UI
This commit is contained in:
parent
ec7aac2e00
commit
794d1e8f1b
@ -524,10 +524,11 @@ class UserView(APIView):
|
|||||||
user.profile.referral_code = context['referral_code']
|
user.profile.referral_code = context['referral_code']
|
||||||
user.profile.avatar = "static/assets/avatars/" + nickname + ".png"
|
user.profile.avatar = "static/assets/avatars/" + nickname + ".png"
|
||||||
|
|
||||||
# If the ref_code is not none this is a new referred robot
|
# If the ref_code was created by another robot, this robot was referred.
|
||||||
if ref_code != None and ref_code !='undefined':
|
queryset = Profile.objects.filter(referral_code=ref_code)
|
||||||
|
if len(queryset) == 1:
|
||||||
user.profile.is_referred = True
|
user.profile.is_referred = True
|
||||||
user.profile.referred_by = Profile.objects.get(referral_code=ref_code)
|
user.profile.referred_by = queryset[0]
|
||||||
|
|
||||||
user.profile.save()
|
user.profile.save()
|
||||||
return Response(context, status=status.HTTP_201_CREATED)
|
return Response(context, status=status.HTTP_201_CREATED)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import {Badge, Tooltip, TextField, ListItemAvatar, Button, Avatar,Paper, Grid, IconButton, Typography, Select, MenuItem, List, ListItemText, ListItem, ListItemIcon, ListItemButton, Divider, Dialog, DialogContent} from "@mui/material";
|
import {Chip, Badge, Tooltip, TextField, ListItemAvatar, Button, Avatar,Paper, Grid, IconButton, Typography, Select, MenuItem, List, ListItemText, ListItem, ListItemIcon, ListItemButton, Divider, Dialog, DialogContent} from "@mui/material";
|
||||||
import MediaQuery from 'react-responsive'
|
import MediaQuery from 'react-responsive'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
@ -43,6 +43,7 @@ export default class BottomBar extends Component {
|
|||||||
openStatsForNerds: false,
|
openStatsForNerds: false,
|
||||||
openCommuniy: false,
|
openCommuniy: false,
|
||||||
openExchangeSummary:false,
|
openExchangeSummary:false,
|
||||||
|
openClaimRewards: false,
|
||||||
num_public_buy_orders: 0,
|
num_public_buy_orders: 0,
|
||||||
num_public_sell_orders: 0,
|
num_public_sell_orders: 0,
|
||||||
book_liquidity: 0,
|
book_liquidity: 0,
|
||||||
@ -59,6 +60,7 @@ export default class BottomBar extends Component {
|
|||||||
node_id: '00000000',
|
node_id: '00000000',
|
||||||
referral_link: 'No referral link',
|
referral_link: 'No referral link',
|
||||||
earned_rewards: 0,
|
earned_rewards: 0,
|
||||||
|
rewardInvoice: null,
|
||||||
};
|
};
|
||||||
this.getInfo();
|
this.getInfo();
|
||||||
}
|
}
|
||||||
@ -225,6 +227,10 @@ export default class BottomBar extends Component {
|
|||||||
this.setState({openProfile: false});
|
this.setState({openProfile: false});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleClickClaimRewards = () => {
|
||||||
|
this.setState({openClaimRewards:true});
|
||||||
|
}
|
||||||
|
|
||||||
dialogProfile =() =>{
|
dialogProfile =() =>{
|
||||||
return(
|
return(
|
||||||
<Dialog
|
<Dialog
|
||||||
@ -296,14 +302,14 @@ export default class BottomBar extends Component {
|
|||||||
</ListItemText>
|
</ListItemText>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
<Divider/>
|
<Divider><Chip label='Earn Sats'/></Divider>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<PersonAddAltIcon/>
|
<PersonAddAltIcon/>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText secondary="Your referral link">
|
<ListItemText secondary="Share to earn 100 Sats per trade">
|
||||||
<TextField
|
<TextField
|
||||||
label='Share to Earn Satoshis'
|
label='Your Referral Link'
|
||||||
value={this.state.referral_link}
|
value={this.state.referral_link}
|
||||||
// variant='filled'
|
// variant='filled'
|
||||||
size='small'
|
size='small'
|
||||||
@ -318,23 +324,42 @@ export default class BottomBar extends Component {
|
|||||||
/>
|
/>
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<EmojiEventsIcon/>
|
<EmojiEventsIcon/>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
{!this.state.openClaimRewards ?
|
||||||
<ListItemText secondary="Your earned rewards">
|
<ListItemText secondary="Your earned rewards">
|
||||||
<Grid container xs={12}>
|
<Grid container xs={12}>
|
||||||
<Grid item xs={9}>
|
<Grid item xs={9}>
|
||||||
<Typography>{this.state.earned_rewards+" Sats"}</Typography>
|
<Typography>{this.state.earned_rewards+" Sats"}</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={3}>
|
<Grid item xs={3}>
|
||||||
{/* WIP: BUTTON ALWAYS DISABLED <Button disabled={this.state.earned_rewards==0? true : false} variant="contained" size="small">Claim</Button> */}
|
<Button disabled={this.state.earned_rewards==0? true : false} onCLick={this.handleClickClaimRewards} variant="contained" size="small">Claim</Button>
|
||||||
<Button disabled={this.state.earned_rewards==0? true : true} variant="contained" size="small">Claim</Button>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
|
:
|
||||||
|
<form onSubmit={this.submitRewardInvoice}>
|
||||||
|
<Grid containter alignItems="stretch" style={{ display: "flex" }} align="center">
|
||||||
|
<Grid item alignItems="stretch" style={{ display: "flex" }} align="center">
|
||||||
|
<TextField
|
||||||
|
label={"Invoice for " + this.state.earned_rewards + " Sats"}
|
||||||
|
//variant="standard"
|
||||||
|
size="small"
|
||||||
|
value={this.state.rewardInvoice}
|
||||||
|
onChange={e => {
|
||||||
|
this.setState({ rewardInvoice: e.target.value });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item alignItems="stretch" style={{ display: "flex" }}>
|
||||||
|
<Button type="submit" variant="contained" color="primary" size="small" > Send </Button>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
</List>
|
</List>
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user