Fixing tags at listing component

This commit is contained in:
brunoedcf
2023-02-16 15:37:23 -03:00
committed by RcleydsonR
parent f76a2b7736
commit c129e4a905
7 changed files with 138 additions and 58 deletions

View File

@@ -1,11 +1,8 @@
<script setup lang="ts">
import CustomButton from "@/components/CustomButton/CustomButton.vue";
import ListingComponent from "@/components/ListingComponent/ListingComponent.vue";
import type { Event } from "ethers";
// props
const props = defineProps<{
lastWalletReleaseTransactions: Event[];
tokenAmount: number | undefined;
}>();
@@ -49,25 +46,6 @@ const emit = defineEmits(["makeAnotherTransaction"]);
Fazer nova transação
</button>
</div>
<div class="text-container mt-16 lg-view">
<span class="text font-extrabold text-3xl max-w-[50rem]"
>Gerenciar transações
</span>
</div>
<div class="w-full max-w-4xl lg-view">
<ListingComponent
:valid-deposits="[]"
:walletTransactions="lastWalletReleaseTransactions"
:isManageMode="false"
>
</ListingComponent>
</div>
<RouterLink
to="/transaction_history"
class="mt-8 text-white text-2xl font-bold"
>
Gerenciar Transações
</RouterLink>
</div>
</template>

View File

@@ -2,22 +2,21 @@
import { withdrawDeposit } from "@/blockchain/buyerMethods";
import { NetworkEnum } from "@/model/NetworkEnum";
import type { ValidDeposit } from "@/model/ValidDeposit";
import type { WalletTransaction } from "@/model/WalletTransaction";
import { useEtherStore } from "@/store/ether";
import { formatEther } from "@ethersproject/units";
import type { BigNumber, Event } from "ethers";
import { ref, watch } from "vue";
// props
const props = defineProps<{
validDeposits: ValidDeposit[];
walletTransactions: Event[];
walletTransactions: WalletTransaction[];
}>();
const emit = defineEmits(["depositWithdrawn"]);
const etherStore = useEtherStore();
const itemsToShow = ref<Event[]>([]);
const itemsToShow = ref<WalletTransaction[]>([]);
const withdrawAmount = ref<string>("");
const withdrawButtonOpacity = ref<number>(0.6);
const withdrawButtonCursor = ref<string>("not-allowed");
@@ -93,11 +92,6 @@ const getEventName = (event: string | undefined): string => {
return possibleEventName[event];
};
const getAmountFormatted = (amount?: BigNumber): string => {
if (!amount) return "";
return formatEther(amount);
};
// watch props changes
watch(props, async (): Promise<void> => {
const itemsToShowQty = itemsToShow.value.length;
@@ -180,18 +174,36 @@ showInitialItems();
{{ getEventName(item.event) }}
</p>
<p class="text-xl leading-7 font-semibold text-gray-900">
{{ getAmountFormatted(item.args?.amount) }}
{{ item.amount }}
BRZ
</p>
<p class="text-xs leading-4 font-medium text-gray-600"></p>
</div>
<div>
<div class="bg-emerald-300 rounded-lg text-center mb-2 p-1">
<div
class="bg-amber-300 rounded-lg text-center mb-2 p-1"
v-if="getEventName(item.event) == 'Reserva' && item.lockStatus == 1"
>
Ativo
</div>
<div
class="bg-[#94A3B8] rounded-lg text-center mb-2 p-1"
v-if="getEventName(item.event) == 'Reserva' && item.lockStatus == 2"
>
Expirado
</div>
<div
class="bg-emerald-300 rounded-lg text-center mb-2 p-1"
v-if="
(getEventName(item.event) == 'Reserva' && item.lockStatus == 3) ||
getEventName(item.event) != 'Reserva'
"
>
Finalizado
</div>
<div
class="flex gap-2 cursor-pointer items-center justify-self-center"
@click="openEtherscanUrl(item?.transactionHash)"
@click="openEtherscanUrl(item.transactionHash)"
>
<span class="last-release-info">{{ getExplorer() }}</span>
<img alt="Redirect image" src="@/assets/redirect.svg" />