Add Alert to seller flow
This commit is contained in:
parent
5b8c89ea38
commit
ba8f2218f6
@ -52,7 +52,7 @@ const showAlert = ref<boolean>(true);
|
|||||||
</div>
|
</div>
|
||||||
<CustomAlert
|
<CustomAlert
|
||||||
v-if="showAlert"
|
v-if="showAlert"
|
||||||
:type="'sell'"
|
:type="'buy'"
|
||||||
@close-alert="showAlert = false"
|
@close-alert="showAlert = false"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,6 +5,13 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const alertText = ref<string>("");
|
const alertText = ref<string>("");
|
||||||
|
const alertPaddingLeft = ref<string>("18rem");
|
||||||
|
|
||||||
|
if (props.type === "sell") {
|
||||||
|
alertPaddingLeft.value = "20rem";
|
||||||
|
} else {
|
||||||
|
alertPaddingLeft.value = "18rem";
|
||||||
|
}
|
||||||
|
|
||||||
switch (props.type) {
|
switch (props.type) {
|
||||||
case "buy":
|
case "buy":
|
||||||
@ -43,11 +50,12 @@ switch (props.type) {
|
|||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
background-color: rgba(251, 191, 36, 1);
|
background-color: rgba(251, 191, 36, 1);
|
||||||
height: 8%;
|
height: 6%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
padding-left: v-bind(alertPaddingLeft);
|
||||||
}
|
}
|
||||||
.close {
|
.close {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import CustomButton from "../CustomButton/CustomButton.vue";
|
import CustomButton from "../CustomButton/CustomButton.vue";
|
||||||
|
import CustomAlert from "../CustomAlert/CustomAlert.vue";
|
||||||
import { debounce } from "@/utils/debounce";
|
import { debounce } from "@/utils/debounce";
|
||||||
import { decimalCount } from "@/utils/decimalCount";
|
import { decimalCount } from "@/utils/decimalCount";
|
||||||
import { pixFormatValidation, postProcessKey } from "@/utils/pixKeyFormat";
|
import { pixFormatValidation, postProcessKey } from "@/utils/pixKeyFormat";
|
||||||
@ -8,6 +9,10 @@ import { useEtherStore } from "@/store/ether";
|
|||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { connectProvider } from "@/blockchain/provider";
|
import { connectProvider } from "@/blockchain/provider";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
showAlert: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
// Reactive state
|
// Reactive state
|
||||||
const etherStore = useEtherStore();
|
const etherStore = useEtherStore();
|
||||||
const { walletAddress } = storeToRefs(etherStore);
|
const { walletAddress } = storeToRefs(etherStore);
|
||||||
@ -19,6 +24,7 @@ const enableSelectButton = ref<boolean>(false);
|
|||||||
const hasLiquidity = ref<boolean>(true);
|
const hasLiquidity = ref<boolean>(true);
|
||||||
const validDecimals = ref<boolean>(true);
|
const validDecimals = ref<boolean>(true);
|
||||||
const validPixFormat = ref<boolean>(true);
|
const validPixFormat = ref<boolean>(true);
|
||||||
|
const showAlert = ref<boolean>(true);
|
||||||
|
|
||||||
// Emits
|
// Emits
|
||||||
const emit = defineEmits(["approveTokens"]);
|
const emit = defineEmits(["approveTokens"]);
|
||||||
@ -141,6 +147,11 @@ const handleButtonClick = async (
|
|||||||
@buttonClicked="handleButtonClick(offer, pixKey)"
|
@buttonClicked="handleButtonClick(offer, pixKey)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<CustomAlert
|
||||||
|
v-if="props.showAlert"
|
||||||
|
:type="'sell'"
|
||||||
|
@close-alert="showAlert = false"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ const loading = ref<boolean>(false);
|
|||||||
|
|
||||||
const offerValue = ref<string>("");
|
const offerValue = ref<string>("");
|
||||||
const pixKeyBuyer = ref<string>("");
|
const pixKeyBuyer = ref<string>("");
|
||||||
|
const showAlert = ref<boolean>(false);
|
||||||
|
|
||||||
// Verificar tipagem
|
// Verificar tipagem
|
||||||
const approveOffer = async (args: {
|
const approveOffer = async (args: {
|
||||||
@ -48,6 +49,7 @@ const sendNetwork = async () => {
|
|||||||
await addDeposit(String(offerValue.value), pixKeyBuyer.value);
|
await addDeposit(String(offerValue.value), pixKeyBuyer.value);
|
||||||
flowStep.value = Step.Sell;
|
flowStep.value = Step.Sell;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
showAlert.value = true;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
@ -59,7 +61,11 @@ const sendNetwork = async () => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="flowStep == Step.Sell">
|
<div v-if="flowStep == Step.Sell">
|
||||||
<WantSellComponent v-if="!loading" @approve-tokens="approveOffer" />
|
<WantSellComponent
|
||||||
|
v-if="!loading"
|
||||||
|
@approve-tokens="approveOffer"
|
||||||
|
:showAlert="showAlert"
|
||||||
|
/>
|
||||||
<LoadingComponent
|
<LoadingComponent
|
||||||
v-if="loading"
|
v-if="loading"
|
||||||
:message="'A transação está sendo enviada para a rede.'"
|
:message="'A transação está sendo enviada para a rede.'"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user