refactor: clean up code formatting and improve readability across multiple components
- Standardized the use of quotes and spacing in various files. - Removed unnecessary line breaks and trailing spaces in components. - Improved the structure of computed properties and methods for better clarity. - Enhanced the consistency of prop definitions and emit events in Vue components. - Updated the GraphQL composable to streamline error handling and data processing. - Refactored network configuration files for better organization and readability. - Cleaned up model files by removing redundant lines and ensuring consistent formatting. - Adjusted router configuration for improved readability. - Enhanced utility functions for better maintainability and clarity.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, watch } from 'vue';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import { useGraphQL } from '@/composables/useGraphQL';
|
||||
import FormCard from '@/components/ui/FormCard.vue';
|
||||
import LoadingComponent from '@/components/ui/LoadingComponent.vue';
|
||||
import AnalyticsCard from '@/components/Explorer/AnalyticsCard.vue';
|
||||
import TransactionTable from '@/components/Explorer/TransactionTable.vue';
|
||||
import { onMounted, watch } from "vue";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { useGraphQL } from "@/composables/useGraphQL";
|
||||
import FormCard from "@/components/ui/FormCard.vue";
|
||||
import LoadingComponent from "@/components/ui/LoadingComponent.vue";
|
||||
import AnalyticsCard from "@/components/Explorer/AnalyticsCard.vue";
|
||||
import TransactionTable from "@/components/Explorer/TransactionTable.vue";
|
||||
|
||||
const user = useUser();
|
||||
const { network } = user;
|
||||
@@ -21,15 +21,15 @@ const {
|
||||
fetchAllActivity,
|
||||
fetchUserActivity,
|
||||
fetchAnalytics,
|
||||
clearData
|
||||
clearData,
|
||||
} = useGraphQL(network);
|
||||
|
||||
const transactionTypes = [
|
||||
{ key: 'all', label: 'Todas' },
|
||||
{ key: 'deposit', label: 'Depósitos' },
|
||||
{ key: 'lock', label: 'Bloqueios' },
|
||||
{ key: 'release', label: 'Liberações' },
|
||||
{ key: 'return', label: 'Retornos' }
|
||||
{ key: "all", label: "Todas" },
|
||||
{ key: "deposit", label: "Depósitos" },
|
||||
{ key: "lock", label: "Bloqueios" },
|
||||
{ key: "release", label: "Liberações" },
|
||||
{ key: "return", label: "Retornos" },
|
||||
];
|
||||
|
||||
const handleTypeFilter = (type: string) => {
|
||||
@@ -44,51 +44,48 @@ watch(searchAddress, async (newAddress) => {
|
||||
}
|
||||
});
|
||||
|
||||
watch(network, async () => {
|
||||
clearData();
|
||||
await Promise.all([
|
||||
fetchAllActivity(),
|
||||
fetchAnalytics()
|
||||
]);
|
||||
}, { deep: true });
|
||||
watch(
|
||||
network,
|
||||
async () => {
|
||||
clearData();
|
||||
await Promise.all([fetchAllActivity(), fetchAnalytics()]);
|
||||
},
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([
|
||||
fetchAllActivity(),
|
||||
fetchAnalytics()
|
||||
]);
|
||||
await Promise.all([fetchAllActivity(), fetchAnalytics()]);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-screen">
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4 mb-8">
|
||||
<AnalyticsCard
|
||||
title="Volume Total"
|
||||
:value="analytics.totalVolume"
|
||||
:loading="analyticsLoading"
|
||||
/>
|
||||
|
||||
|
||||
<AnalyticsCard
|
||||
title="Total de Transações"
|
||||
:value="analytics.totalTransactions"
|
||||
:loading="analyticsLoading"
|
||||
/>
|
||||
|
||||
|
||||
<AnalyticsCard
|
||||
title="Total de Bloqueios"
|
||||
:value="analytics.totalLocks"
|
||||
:loading="analyticsLoading"
|
||||
/>
|
||||
|
||||
|
||||
<AnalyticsCard
|
||||
title="Total de Depósitos"
|
||||
:value="analytics.totalDeposits"
|
||||
:loading="analyticsLoading"
|
||||
/>
|
||||
|
||||
|
||||
<AnalyticsCard
|
||||
title="Total de Liberações"
|
||||
:value="analytics.totalReleases"
|
||||
@@ -119,7 +116,7 @@ onMounted(async () => {
|
||||
'px-4 py-2 rounded-lg text-sm font-medium transition-colors',
|
||||
selectedType === type.key
|
||||
? 'bg-amber-400 text-gray-900'
|
||||
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
|
||||
: 'bg-gray-100 text-gray-700 hover:bg-gray-200',
|
||||
]"
|
||||
>
|
||||
{{ type.label }}
|
||||
@@ -143,11 +140,15 @@ onMounted(async () => {
|
||||
<!-- Transactions Table -->
|
||||
<FormCard v-else padding="lg">
|
||||
<div class="mb-6">
|
||||
<h2 class="text-xl font-semibold text-gray-900 mb-2">Transações Recentes</h2>
|
||||
<p class="text-gray-600">{{ transactions.length }} transações encontradas</p>
|
||||
<h2 class="text-xl font-semibold text-gray-900 mb-2">
|
||||
Transações Recentes
|
||||
</h2>
|
||||
<p class="text-gray-600">
|
||||
{{ transactions.length }} transações encontradas
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<TransactionTable
|
||||
<TransactionTable
|
||||
:transactions="transactions"
|
||||
:network-explorer-url="network.blockExplorers?.default.url || ''"
|
||||
/>
|
||||
@@ -160,4 +161,4 @@ onMounted(async () => {
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -22,7 +22,7 @@ const openItem = (index: number) => {
|
||||
});
|
||||
|
||||
faq.value[selectedSection.value].items[index].content = marked(
|
||||
faq.value[selectedSection.value].items[index].content
|
||||
faq.value[selectedSection.value].items[index].content,
|
||||
);
|
||||
};
|
||||
</script>
|
||||
@@ -30,10 +30,12 @@ const openItem = (index: number) => {
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="text-container">
|
||||
<span class="text font-extrabold sm:text-5xl text-3xl sm:max-w-[50rem] max-w-[90%]"
|
||||
<span
|
||||
class="text font-extrabold sm:text-5xl text-3xl sm:max-w-[50rem] max-w-[90%]"
|
||||
>Perguntas Frequentes
|
||||
</span>
|
||||
<span class="text font-medium sm:text-base text-sm sm:max-w-[40rem] max-w-[90%]"
|
||||
<span
|
||||
class="text font-medium sm:text-base text-sm sm:max-w-[40rem] max-w-[90%]"
|
||||
>Não conseguiu uma resposta para sua dúvida? Acesse a comunidade do
|
||||
Discord para falar diretamente conosco.</span
|
||||
>
|
||||
|
||||
@@ -37,7 +37,7 @@ const paramLockID = window.history.state?.lockID;
|
||||
|
||||
const confirmBuyClick = async (
|
||||
selectedDeposit: ValidDeposit,
|
||||
tokenValue: number
|
||||
tokenValue: number,
|
||||
) => {
|
||||
participantID.value = selectedDeposit.participantID;
|
||||
tokenAmount.value = tokenValue;
|
||||
@@ -60,22 +60,25 @@ const confirmBuyClick = async (
|
||||
};
|
||||
|
||||
const releaseTransaction = async (params: {
|
||||
pixTimestamp: `0x${string}`&{lenght:34},
|
||||
signature: `0x${string}`,
|
||||
pixTimestamp: `0x${string}` & { lenght: 34 };
|
||||
signature: `0x${string}`;
|
||||
}) => {
|
||||
flowStep.value = Step.List;
|
||||
showBuyAlert.value = true;
|
||||
loadingRelease.value = true;
|
||||
|
||||
const release = await releaseLock(BigInt(lockID.value), params.pixTimestamp, params.signature);
|
||||
const release = await releaseLock(
|
||||
BigInt(lockID.value),
|
||||
params.pixTimestamp,
|
||||
params.signature,
|
||||
);
|
||||
|
||||
await updateWalletStatus();
|
||||
loadingRelease.value = false;
|
||||
};
|
||||
|
||||
const checkForUnreleasedLocks = async (): Promise<void> => {
|
||||
if (!walletAddress.value)
|
||||
throw new Error("Wallet not connected");
|
||||
if (!walletAddress.value) throw new Error("Wallet not connected");
|
||||
const lock = await checkUnreleasedLock(walletAddress.value);
|
||||
if (lock) {
|
||||
lockID.value = String(lock.lockID);
|
||||
|
||||
@@ -30,8 +30,9 @@ const callWithdraw = async (amount: string) => {
|
||||
let withdraw;
|
||||
try {
|
||||
withdraw = await withdrawDeposit(
|
||||
amount,
|
||||
network.value.tokens[selectedToken.value].address);
|
||||
amount,
|
||||
network.value.tokens[selectedToken.value].address,
|
||||
);
|
||||
} catch {
|
||||
loadingWithdraw.value = false;
|
||||
}
|
||||
@@ -51,11 +52,11 @@ const getWalletTransactions = async () => {
|
||||
user.setLoadingWalletTransactions(true);
|
||||
if (walletAddress.value) {
|
||||
const walletDeposits = await listValidDepositTransactionsByWalletAddress(
|
||||
walletAddress.value
|
||||
walletAddress.value,
|
||||
);
|
||||
|
||||
const allUserTransactions = await listAllTransactionByWalletAddress(
|
||||
walletAddress.value
|
||||
walletAddress.value,
|
||||
);
|
||||
|
||||
activeLockAmount.value = await getActiveLockAmount(walletAddress.value);
|
||||
|
||||
@@ -8,8 +8,9 @@ const latestVersion = ref<AppVersion | null>(null);
|
||||
const currentVersion = __APP_VERSION__;
|
||||
|
||||
onMounted(() => {
|
||||
versions.value = [...appVersions].sort((a, b) =>
|
||||
new Date(b.releaseDate).getTime() - new Date(a.releaseDate).getTime()
|
||||
versions.value = [...appVersions].sort(
|
||||
(a, b) =>
|
||||
new Date(b.releaseDate).getTime() - new Date(a.releaseDate).getTime(),
|
||||
);
|
||||
latestVersion.value = getLatestVersion();
|
||||
});
|
||||
@@ -36,28 +37,22 @@ const formatDate = (dateString: string): string => {
|
||||
Versões do P2Pix
|
||||
</span>
|
||||
<span class="text font-medium text-base max-w-[40rem]">
|
||||
Visualize todas as versões do P2Pix. Cada versão está
|
||||
disponível no IPFS para acesso permanente e descentralizado.
|
||||
Visualize todas as versões do P2Pix. Cada versão está disponível no IPFS
|
||||
para acesso permanente e descentralizado.
|
||||
</span>
|
||||
<div v-if="currentVersion" class="mt-4">
|
||||
<span class="text-gray-400 text-sm">
|
||||
Versão atual: <span class="font-semibold text-white">{{ currentVersion }}</span>
|
||||
Versão atual:
|
||||
<span class="font-semibold text-white">{{ currentVersion }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="versions-container">
|
||||
<div
|
||||
v-for="version in versions"
|
||||
:key="version.tag"
|
||||
class="version-card"
|
||||
>
|
||||
<div v-for="version in versions" :key="version.tag" class="version-card">
|
||||
<div class="version-header">
|
||||
<h3 class="version-tag">{{ version.tag }}</h3>
|
||||
<span
|
||||
v-if="version.tag === currentVersion"
|
||||
class="current-badge"
|
||||
>
|
||||
<span v-if="version.tag === currentVersion" class="current-badge">
|
||||
Atual
|
||||
</span>
|
||||
</div>
|
||||
@@ -153,5 +148,3 @@ const formatDate = (dateString: string): string => {
|
||||
@apply text-center py-12;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user