Make avatar persists when revisiting homepage

This commit is contained in:
Reckless_Satoshi 2022-02-21 02:05:19 -08:00
parent 9025b2e07d
commit 1feebacbc1
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 29 additions and 11 deletions

View File

@ -234,7 +234,8 @@ class Logics:
if maker_is_seller: if maker_is_seller:
cls.settle_bond(order.maker_bond) cls.settle_bond(order.maker_bond)
cls.return_bond(order.taker_bond) cls.return_bond(order.taker_bond)
try: # If seller is offline the escrow LNpayment does not even exist # If seller is offline the escrow LNpayment does not exist
try:
cls.cancel_escrow(order) cls.cancel_escrow(order)
except: except:
pass pass
@ -245,7 +246,8 @@ class Logics:
# If maker is buyer, settle the taker's bond order goes back to public # If maker is buyer, settle the taker's bond order goes back to public
else: else:
cls.settle_bond(order.taker_bond) cls.settle_bond(order.taker_bond)
try: # If seller is offline the escrow LNpayment does not even exist # If seller is offline the escrow LNpayment does not even exist
try:
cls.cancel_escrow(order) cls.cancel_escrow(order)
except: except:
pass pass
@ -569,7 +571,7 @@ class Logics:
When the second user asks for cancel. Order is totally cancelled. When the second user asks for cancel. Order is totally cancelled.
Must have a small cost for both parties to prevent node DDOS.""" Must have a small cost for both parties to prevent node DDOS."""
elif order.status in [ elif order.status in [
Order.Status.WFI, Order.Status.CHA, Order.Status.FSE Order.Status.WFI, Order.Status.CHA
]: ]:
# if the maker had asked, and now the taker does: cancel order, return everything # if the maker had asked, and now the taker does: cancel order, return everything

View File

@ -180,21 +180,21 @@ export default class BottomBar extends Component {
<List> <List>
<Divider/> <Divider/>
<ListItemButton component="a" href="https://t.me/robosats"> <ListItemButton component="a" target="_blank" href="https://t.me/robosats">
<ListItemIcon><SendIcon/></ListItemIcon> <ListItemIcon><SendIcon/></ListItemIcon>
<ListItemText primary="Join the RoboSats group" <ListItemText primary="Join the RoboSats group"
secondary="Telegram (English / Main)"/> secondary="Telegram (English / Main)"/>
</ListItemButton> </ListItemButton>
<Divider/> <Divider/>
<ListItemButton component="a" href="https://t.me/robosats_es"> <ListItemButton component="a" target="_blank" href="https://t.me/robosats_es">
<ListItemIcon><SendIcon/></ListItemIcon> <ListItemIcon><SendIcon/></ListItemIcon>
<ListItemText primary="Unase al grupo RoboSats" <ListItemText primary="Unase al grupo RoboSats"
secondary="Telegram (Español)"/> secondary="Telegram (Español)"/>
</ListItemButton> </ListItemButton>
<Divider/> <Divider/>
<ListItemButton component="a" href="https://github.com/Reckless-Satoshi/robosats/issues"> <ListItemButton component="a" target="_blank" href="https://github.com/Reckless-Satoshi/robosats/issues">
<ListItemIcon><GitHubIcon/></ListItemIcon> <ListItemIcon><GitHubIcon/></ListItemIcon>
<ListItemText primary="Tell us about a new feature or a bug" <ListItemText primary="Tell us about a new feature or a bug"
secondary="Github Issues - The Robotic Satoshis Open Source Project"/> secondary="Github Issues - The Robotic Satoshis Open Source Project"/>

View File

@ -28,13 +28,29 @@ export default class UserGenPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
token: this.genBase62Token(36),
openInfo: false, openInfo: false,
loadingRobot: true,
tokenHasChanged: false, tokenHasChanged: false,
}; };
this.props.setAppState({avatarLoaded: false, nickname: null, token: null});
this.getGeneratedUser(this.state.token); //this.props.setAppState({avatarLoaded: false, nickname: null, token: null});
// Checks in parent HomePage if there is already a nick and token
// Displays the existing one
if (this.props.nickname != null){
this.state = {
nickname: this.props.nickname,
token: this.props.token? this.props.token : null,
avatar_url: 'static/assets/avatars/' + this.props.nickname + '.png',
loadingRobot: false
}
}
else{
var newToken = this.genBase62Token(36)
this.state = {
token: newToken
}
this.getGeneratedUser(newToken);
}
} }
// sort of cryptographically strong function to generate Base62 token client-side // sort of cryptographically strong function to generate Base62 token client-side

File diff suppressed because one or more lines are too long