Skip to content

Commit cdb265c

Browse files
onmaxsisou
authored andcommitted
progress
1 parent 2370b38 commit cdb265c

23 files changed

+1148
-1304
lines changed

src/components/DualCurrencyInput.vue

+5-45
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<template>
22
<div class="dual-currency-input">
3-
4-
{{ exchangeRate }}
53
<section :class="{ orange: !!invalidReason }">
64
<div class="flex-row primary-amount">
75
<AmountInput v-model="_cryptoAmount" :decimals="cryptoCurrencyDecimals">
@@ -36,29 +34,13 @@
3634
</AmountInput>
3735
</span>
3836
</section>
39-
40-
<MessageTransition class="message-section">
41-
<template v-if="invalidReason === 'insufficient-limit'">
42-
<!-- TEMP: wording TBD -->
43-
<i18n path="Max swappable amount is {amount}">
44-
<Amount slot="amount" :amount="maxCrypto"
45-
:currency="fiatCurrency" hideDecimals />
46-
</i18n><br />
47-
<a @click="$emit('set-max')">{{ $t('Sell max') }}</a>
48-
</template>
49-
<template v-else-if="invalidReason === 'insufficient-balance'">
50-
{{ $t('Insufficient balance.') }} <a @click="$emit('set-max')">{{ $t('Sell max') }}</a>
51-
</template>
52-
</MessageTransition>
5337
</div>
5438
</template>
5539

5640
<script lang="ts">
5741
import { computed, defineComponent, ref, watch } from '@vue/composition-api';
5842
import { CryptoCurrency, FiatCurrency } from '@/lib/Constants';
59-
import { Amount } from '@nimiq/vue-components';
6043
import AmountInput from './AmountInput.vue';
61-
import MessageTransition from './MessageTransition.vue';
6244
6345
export default defineComponent({
6446
props: {
@@ -84,7 +66,7 @@ export default defineComponent({
8466
},
8567
cryptoCurrencyDecimals: {
8668
type: Number,
87-
default: 2,
69+
default: 5,
8870
},
8971
maxCrypto: Number,
9072
maxFiat: Number,
@@ -111,15 +93,17 @@ export default defineComponent({
11193
watch(_fiatAmount, (newVal) => {
11294
if (syncing.value) return;
11395
syncing.value = true;
114-
const newCryptoValue = newVal * props.exchangeRate;
96+
const newCryptoValue = Number(((newVal / props.exchangeRate) * 10 ** props.cryptoCurrencyDecimals)
97+
.toFixed(props.cryptoCurrencyDecimals));
11598
context.emit('update:cryptoAmount', newCryptoValue);
11699
setTimeout(() => syncing.value = false, 100);
117100
}, { lazy: true });
118101
119102
watch(_cryptoAmount, (newVal) => {
120103
if (syncing.value) return;
121104
syncing.value = true;
122-
const newFiatValue = newVal / props.exchangeRate;
105+
const newFiatValue = Number(((newVal / 10 ** props.cryptoCurrencyDecimals) * props.exchangeRate)
106+
.toFixed(props.fiatCurrencyDecimals));
123107
context.emit('update:fiatAmount', newFiatValue);
124108
setTimeout(() => syncing.value = false, 100);
125109
}, { lazy: true });
@@ -133,8 +117,6 @@ export default defineComponent({
133117
},
134118
components: {
135119
AmountInput,
136-
MessageTransition,
137-
Amount,
138120
},
139121
});
140122
</script>
@@ -143,7 +125,6 @@ export default defineComponent({
143125
.dual-currency-input {
144126
text-align: center;
145127
margin-top: 3rem;
146-
margin-bottom: 2rem;
147128
148129
&.orange {
149130
color: var(--nimiq-orange);
@@ -284,26 +265,5 @@ export default defineComponent({
284265
}
285266
}
286267
}
287-
.message-section.message-transition {
288-
width: 100%;
289-
font-weight: 600;
290-
font-size: 14px;
291-
line-height: 21px;
292-
text-align: center;
293-
color: var(--nimiq-orange);
294-
295-
transition-delay: 0ms ;
296-
--message-transition-duration: 200ms;
297-
298-
a {
299-
text-decoration: underline;
300-
cursor: pointer;
301-
}
302-
303-
& ::v-deep .fadeY-enter,
304-
& ::v-deep .fadeY-leave-to {
305-
transform: translateY(-25%) !important;
306-
}
307-
}
308268
}
309269
</style>

src/components/SinpeUserInfo.vue

+5-7
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,18 @@
2525
</template>
2626

2727
<script lang="ts">
28+
import { useSinpeMovilStore } from '@/stores/SinpeMovil';
2829
import { defineComponent } from '@vue/composition-api';
2930
3031
export default defineComponent({
3132
props: {},
3233
setup() {
33-
// const { label, phoneNumber, initials } = useSinpeMovilStore();
34+
const { label, phoneNumber, initials } = useSinpeMovilStore();
3435
3536
return {
36-
// label,
37-
// phoneNumber,
38-
// initials,
39-
label: 'Sinpe Móvil',
40-
initials: 'SM',
41-
phoneNumber: '+506 1234 5678',
37+
label,
38+
phoneNumber,
39+
initials,
4240
};
4341
},
4442
components: {

src/components/layouts/Sidebar.vue

+7-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
}}</template>
5656
</Tooltip>
5757

58-
<Tooltip v-if="$config.moonpay.enabled"
58+
<Tooltip v-if="enabledSellProviders.length > 0"
5959
preferredPosition="top right"
6060
:container="$parent"
6161
theme="inverse"
@@ -168,6 +168,7 @@
168168
import { defineComponent, ref, computed, onMounted } from '@vue/composition-api';
169169
import { GearIcon, Tooltip, InfoCircleIcon } from '@nimiq/vue-components';
170170
import { RouteName } from '@/router';
171+
import { SwapAsset } from '@nimiq/libswap';
171172
import { assetToCurrency } from '@/lib/swap/utils/Assets';
172173
import AnnouncementBox from '../AnnouncementBox.vue';
173174
import AccountMenu from '../AccountMenu.vue';
@@ -306,7 +307,7 @@ export default defineComponent({
306307
307308
const sellModals = {
308309
[SellProvider.Moonpay]: RouteName.MoonpaySellInfo,
309-
[SellProvider.SinpeMovil]: RouteName.SinpeMovilSellInfo,
310+
[SellProvider.SinpeMovil]: RouteName.SinpeMovilInfo,
310311
[SellProvider.Simplex]: RouteName.SellCrypto, // This is a fallback, should never be reached
311312
};
312313
@@ -315,7 +316,10 @@ export default defineComponent({
315316
const modalName: RouteName = enabledSellProviders.value.length === 1
316317
? sellModals[enabledSellProviders.value[0]]
317318
: RouteName.SellCrypto; // TODO: SellCrypto is for SEPA operations. We need to add a new Sell Selector.
318-
openModal(modalName);
319+
const params = enabledSellProviders.value.includes(SellProvider.SinpeMovil)
320+
? { pair: JSON.stringify([SwapAsset.NIM, SwapAsset.CRC]) }
321+
: undefined;
322+
openModal(modalName, params);
319323
}
320324
321325
const nimSellOptions = computed(() => {

0 commit comments

Comments
 (0)