emit selectedDeposit and token value to Home component when confirm button is clicked

This commit is contained in:
RcleydsonR 2022-11-26 14:25:19 -03:00
parent bbca2374d1
commit 8da7f6a4ff
2 changed files with 13 additions and 11 deletions

View File

@ -17,8 +17,8 @@ const selectedDeposit = ref();
const connectAccount = async () => { const connectAccount = async () => {
await blockchain.connectProvider(); await blockchain.connectProvider();
verifyLiquidity() verifyLiquidity();
} };
const handleInputEvent = (event: any) => { const handleInputEvent = (event: any) => {
const { value } = event.target; const { value } = event.target;
@ -31,7 +31,7 @@ const verifyLiquidity = () => {
enableSelectButton.value = false; enableSelectButton.value = false;
selectedDeposit.value = null; selectedDeposit.value = null;
if (!walletAddress.value) return; if (!walletAddress.value || tokenValue.value == 0) return;
depositList.value.forEach((deposit) => { depositList.value.forEach((deposit) => {
const p2pixTokenValue = blockchain.verifyDepositAmmount( const p2pixTokenValue = blockchain.verifyDepositAmmount(
@ -68,9 +68,7 @@ const emit = defineEmits(["tokenBuy"]);
tokens após realizar o Pix</span tokens após realizar o Pix</span
> >
</div> </div>
<div <div class="blur-container">
class="blur-container"
>
<div <div
class="flex flex-col w-full bg-white px-10 py-5 rounded-lg border-y-10" class="flex flex-col w-full bg-white px-10 py-5 rounded-lg border-y-10"
> >
@ -86,7 +84,9 @@ const emit = defineEmits(["tokenBuy"]);
placeholder="0 " placeholder="0 "
step=".01" step=".01"
/> />
<div class="flex flex-row p-2 px-3 bg-gray-300 rounded-3xl min-w-fit gap-1"> <div
class="flex flex-row p-2 px-3 bg-gray-300 rounded-3xl min-w-fit gap-1"
>
<img alt="Token image" class="w-fit" src="@/assets/brz.svg" /> <img alt="Token image" class="w-fit" src="@/assets/brz.svg" />
<span class="text-gray-900 text-lg w-fit" id="brz">BRZ</span> <span class="text-gray-900 text-lg w-fit" id="brz">BRZ</span>
</div> </div>
@ -127,7 +127,7 @@ const emit = defineEmits(["tokenBuy"]);
v-if="walletAddress" v-if="walletAddress"
:text="'Confirmar compra'" :text="'Confirmar compra'"
:is-disabled="!enableSelectButton" :is-disabled="!enableSelectButton"
@buttonClicked="emit('tokenBuy')" @buttonClicked="emit('tokenBuy', { selectedDeposit, tokenValue })"
/> />
</div> </div>
</div> </div>
@ -157,7 +157,7 @@ const emit = defineEmits(["tokenBuy"]);
} }
.blur-container { .blur-container {
@apply flex flex-col justify-center items-center px-8 py-6 gap-2 rounded-lg shadow-md shadow-gray-600 backdrop-blur-md mt-10 @apply flex flex-col justify-center items-center px-8 py-6 gap-2 rounded-lg shadow-md shadow-gray-600 backdrop-blur-md mt-10;
} }
input[type="number"] { input[type="number"] {

View File

@ -1,14 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import SearchComponent from "../components/SearchComponent.vue"; import SearchComponent from "../components/SearchComponent.vue";
const confirmBuyClick = () => { const confirmBuyClick = ({ selectedDeposit, tokenValue }: any) => {
// finish buy screen // finish buy screen
console.log(selectedDeposit);
console.log(tokenValue);
console.log("compra confirmada"); console.log("compra confirmada");
}; };
</script> </script>
<template> <template>
<SearchComponent @token-buy="confirmBuyClick()" /> <SearchComponent @token-buy="confirmBuyClick" />
</template> </template>
<style scoped></style> <style scoped></style>