Skip to content

Commit

Permalink
Fix phone and styles for card (#951)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Popov <17688105+stefashkaa@users.noreply.github.com>
  • Loading branch information
stefashkaa and stefashkaa authored Feb 9, 2023
1 parent 0461863 commit e02c0d1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
13 changes: 11 additions & 2 deletions src/components/SoraCard/steps/Phone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@
<script lang="ts">
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator';
import TranslationMixin from '@/components/mixins/TranslationMixin';
import { mixins } from '@soramitsu/soraneo-wallet-web';
import { mixins, WALLET_CONSTS } from '@soramitsu/soraneo-wallet-web';
import { action, getter, state } from '@/store/decorators';
import { VerificationStatus } from '@/types/card';
import { XOR } from '@sora-substrate/util/build/assets/consts';
@Component
export default class Phone extends Mixins(TranslationMixin, mixins.LoadingMixin) {
@state.soraCard.authLogin authLogin!: any;
@state.wallet.settings.soraNetwork soraNetwork!: WALLET_CONSTS.SoraNetwork;
@getter.soraCard.currentStatus private currentStatus!: VerificationStatus;
@getter.soraCard.isEuroBalanceEnough isEuroBalanceEnough!: boolean;
Expand Down Expand Up @@ -134,6 +135,10 @@ export default class Phone extends Mixins(TranslationMixin, mixins.LoadingMixin)
return 'SEND SMS CODE';
}
get isMainnet(): boolean {
return this.soraNetwork === WALLET_CONSTS.SoraNetwork.Prod;
}
get sendSmsDisabled(): boolean {
return !this.phoneNumber || this.smsSent;
}
Expand All @@ -143,7 +148,11 @@ export default class Phone extends Mixins(TranslationMixin, mixins.LoadingMixin)
}
get phoneInputDescription(): string {
if (this.smsSent) return 'We’ve sent you an SMS code. Check your messages!';
if (this.smsSent) {
return this.isMainnet
? 'We’ve sent you an SMS code. Check your messages!'
: 'Your code for testing purposes: 123456';
}
return 'We’ll send you an SMS code.';
}
Expand Down
15 changes: 9 additions & 6 deletions src/components/X1/X1Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ export default class X1Dialog extends Mixins(mixins.DialogMixin, mixins.LoadingM
</script>

<style lang="scss">
.x1-dialog .el-dialog {
.wrapper {
min-height: 320px;
}
.x1-dialog .el-dialog .wrapper {
min-height: 320px;
padding: $basic-spacing-medium;
margin: -10px -20px -20px;
}
</style>

Expand All @@ -110,9 +110,9 @@ export default class X1Dialog extends Mixins(mixins.DialogMixin, mixins.LoadingM
border-radius: 28px;
background-color: var(--s-color-status-error-background);
padding: $basic-spacing;
margin-bottom: $basic-spacing / 2;
margin-bottom: $inner-spacing-small;
.disclaimer-warning-icon {
& &-warning-icon {
margin-right: $basic-spacing;
.s-icon-notifications-alert-triangle-24 {
Expand All @@ -125,4 +125,7 @@ export default class X1Dialog extends Mixins(mixins.DialogMixin, mixins.LoadingM
margin-top: $basic-spacing / 2;
}
}
[design-system-theme='dark'] .disclaimer-warning-icon .s-icon-notifications-alert-triangle-24 {
color: var(--s-color-base-content-primary);
}
</style>
4 changes: 2 additions & 2 deletions src/store/soraCard/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { Status } from '@/types/card';
import { loadScript } from 'vue-plugin-load-script';

const actions = defineActions({
calculateXorRestPrice(context, xorPerEuro): void {
calculateXorRestPrice(context, xorPerEuro: FPNumber): void {
const { state, commit } = soraCardActionContext(context);
const { totalXorBalance } = state;
const euroToPay = FPNumber.HUNDRED.add(FPNumber.ONE).sub(totalXorBalance.mul(xorPerEuro));
const euroToPayInXor = euroToPay.div(xorPerEuro);

commit.setXorPriceToDeposit(euroToPayInXor);
commit.setXorPriceToDeposit(euroToPayInXor.dp(3));
},

async calculateXorBalanceInEuros(context, { xorPerEuro, xorTotalBalance }): Promise<void> {
Expand Down

0 comments on commit e02c0d1

Please sign in to comment.