Fix avatar loading issues

This commit is contained in:
Reckless_Satoshi 2022-10-26 02:47:50 -07:00
parent cafc63bc05
commit b4205761fe
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 11 additions and 7 deletions

View File

@ -112,7 +112,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
coordinatorVersion: versionInfo.coordinatorVersion, coordinatorVersion: versionInfo.coordinatorVersion,
clientVersion: versionInfo.clientVersion, clientVersion: versionInfo.clientVersion,
}); });
if (!robot.nickname && data.nickname) { if (!robot.nickname && data.nickname && !robot.loading) {
setRobot({ setRobot({
...robot, ...robot,
nickname: data.nickname, nickname: data.nickname,

View File

@ -44,7 +44,9 @@ class UserGenPage extends Component {
componentDidMount() { componentDidMount() {
// Checks in parent HomePage if there is already a nick and token // Checks in parent HomePage if there is already a nick and token
// Displays the existing one // Displays the existing one
if (this.props.robot.token) { if (this.props.robot.nickname != null) {
this.setState({ inputToken: this.props.robot.token });
} else if (this.props.robot.token) {
this.setState({ inputToken: this.props.robot.token }); this.setState({ inputToken: this.props.robot.token });
this.getGeneratedUser(this.props.robot.token); this.getGeneratedUser(this.props.robot.token);
} else { } else {
@ -80,6 +82,7 @@ class UserGenPage extends Component {
? this.props.setRobot({ ? this.props.setRobot({
...this.props.robot, ...this.props.robot,
avatarLoaded: true, avatarLoaded: true,
loading: false,
nickname: data.nickname ?? this.props.robot.nickname, nickname: data.nickname ?? this.props.robot.nickname,
activeOrderId: data.active_order_id ?? null, activeOrderId: data.active_order_id ?? null,
referralCode: data.referral_code ?? this.props.referralCode, referralCode: data.referral_code ?? this.props.referralCode,
@ -91,6 +94,7 @@ class UserGenPage extends Component {
...this.props.robot, ...this.props.robot,
nickname: data.nickname, nickname: data.nickname,
token: token, token: token,
loading: false,
activeOrderId: data.active_order_id ? data.active_order_id : null, activeOrderId: data.active_order_id ? data.active_order_id : null,
lastOrderId: data.last_order_id ? data.last_order_id : null, lastOrderId: data.last_order_id ? data.last_order_id : null,
referralCode: data.referral_code, referralCode: data.referral_code,

View File

@ -110,18 +110,18 @@ class UnsafeAlert extends Component {
<Alert severity='warning' sx={{ maxHeight: '120px' }}> <Alert severity='warning' sx={{ maxHeight: '120px' }}>
<AlertTitle>{t('You are not using RoboSats privately')}</AlertTitle> <AlertTitle>{t('You are not using RoboSats privately')}</AlertTitle>
<Trans i18nKey='phone_unsafe_alert'> <Trans i18nKey='phone_unsafe_alert'>
You will not be able to complete a trade. Use{' '} <a>You will not be able to complete a trade. Use </a>
<Link href='https://www.torproject.org/download/' target='_blank'> <Link href='https://www.torproject.org/download/' target='_blank'>
Tor Browser Tor Browser
</Link>{' '} </Link>
and visit the{' '} <a> and visit the </a>
<Link <Link
href='http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion' href='http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion'
target='_blank' target='_blank'
> >
Onion Onion
</Link>{' '} </Link>{' '}
site. <a> site.</a>
</Trans> </Trans>
<div style={{ width: '100%' }}></div> <div style={{ width: '100%' }}></div>
<div align='center'> <div align='center'>

View File

@ -41,7 +41,7 @@ export const defaultRobot: Robot = {
tgEnabled: false, tgEnabled: false,
tgBotName: 'unknown', tgBotName: 'unknown',
tgToken: 'unknown', tgToken: 'unknown',
loading: true, loading: false,
avatarLoaded: false, avatarLoaded: false,
copiedToken: false, copiedToken: false,
}; };