Skip to content

Commit 774df74

Browse files
author
Claudio La Barbera
committed
fix: buttons
1 parent 9196341 commit 774df74

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

src/components/views/Home.vue

+36-10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const modalDescription = ref('');
2222
const min_bet = ref(1)
2323
const max_bet = ref(10);
2424
25+
const loading = ref(false);
26+
2527
let lastTransactionId = null;
2628
2729
const openModal = () => {
@@ -54,14 +56,15 @@ const viewTransaction = () => {
5456
}
5557
5658
const incrementAmount = () => {
57-
if(amount.value + 0.1 <= max_bet) {
58-
amount.value += 0.1;
59+
console.log('increment');
60+
if (amount.value + 0.1 <= (max_bet.value)) {
61+
amount.value = (amount.value + 0.1)
5962
}
6063
}
6164
6265
const decrementAmount = () => {
63-
if(amount.value - 0.1 >= min_bet) {
64-
amount.value -= 0.1;
66+
if (amount.value - 0.1 >= (min_bet.value)) {
67+
amount.value = (amount.value - 0.1)
6568
}
6669
}
6770
@@ -73,9 +76,15 @@ onMounted(async () => {
7376
min_bet.value = config.min_bet;
7477
max_bet.value = config.max_bet;
7578
76-
amount.value = config.min_bet;
79+
amount.value = parseFloat(config.min_bet);
7780
7881
currentBalance.value = await store.telegram.getWalletBalance();
82+
83+
setInterval(async () => {
84+
loading.value = true;
85+
currentBalance.value = await store.telegram.getWalletBalance();
86+
loading.value = false;
87+
}, 3000);
7988
});
8089
</script>
8190
@@ -96,25 +105,27 @@ onMounted(async () => {
96105
<div class="flex justify-center">
97106
<div class="relative flex items-center max-w-[8rem]">
98107
99-
<button type="button" @click="incrementAmount()" class="bg-blue-800 0 border-blue-900 rounded-s-lg p-3 h-11 mr-1">
108+
<a @click="decrementAmount()"
109+
class="bg-blue-800 0 border-blue-900 rounded-s-lg p-3 h-11 mr-1">
100110
<svg class="w-3 h-3 text-white dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
101111
fill="none" viewBox="0 0 18 2">
102112
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
103113
d="M1 1h16" />
104114
</svg>
105-
</button>
115+
</a>
106116
107117
<input type="number" v-model="amount" data-input-counter aria-describedby="helper-text-explanation"
108118
class="bg-blue-50 border-x-0 h-11 focus:border-none text-center text-gray-900 font-bold text-sm block w-full py-2.5"
109119
placeholder="1" required />
110120
111-
<button type="button" @click="decrementAmount()" class="bg-blue-800 0 border-blue-900 rounded-e-lg p-3 h-11 ml-1">
121+
<a @click="incrementAmount()"
122+
class="bg-blue-800 0 border-blue-900 rounded-e-lg p-3 h-11 ml-1">
112123
<svg class="w-3 h-3 text-white dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
113124
fill="none" viewBox="0 0 18 18">
114125
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
115126
d="M9 1v16M1 9h16" />
116127
</svg>
117-
</button>
128+
</a>
118129
119130
</div>
120131
</div>
@@ -132,7 +143,22 @@ onMounted(async () => {
132143
133144
<div v-if="store.telegram.walletAccount" class="mt-8 text-xs">
134145
<div class="font-black uppercase text-[10px]">Your balance</div>
135-
<div class="font-black text-lg">{{ currentBalance }} TON</div>
146+
<div class="font-black text-lg">
147+
<div class="flex justify-center">
148+
<div>
149+
{{ currentBalance }} TON
150+
</div>
151+
<div class="w-5">
152+
<svg v-if="loading" class="animate-spin ml-3 h-7 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none"
153+
viewBox="0 0 24 24">
154+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
155+
<path class="opacity-75" fill="currentColor"
156+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
157+
</path>
158+
</svg>
159+
</div>
160+
</div>
161+
</div>
136162
</div>
137163
138164
<div v-if="!store.telegram.walletAccount" class="mt-4 text-xs text-orange-500">

0 commit comments

Comments
 (0)