diff --git a/package.json b/package.json index be7f5d8..646d1ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p2pix-front-end", - "version": "0.1.0", + "version": "1.1.0", "scripts": { "start": "vite --host=0.0.0.0 --port 3000", "build": "run-p type-check build-only", diff --git a/src/App.vue b/src/App.vue index 5aed1b2..3912542 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,9 +12,6 @@ const route = useRoute(); const injected = injectedModule(); const targetNetwork = ref(DEFAULT_NETWORK); -const currentYear = new Date().getFullYear(); -const appVersion = __APP_VERSION__; - const web3Onboard = init({ wallets: [injected], chains: Object.values(Networks).map((network) => ({ @@ -57,9 +54,4 @@ if (!connectedWallet) { - diff --git a/src/blockchain/wallet.ts b/src/blockchain/wallet.ts index de8b318..24773f5 100644 --- a/src/blockchain/wallet.ts +++ b/src/blockchain/wallet.ts @@ -126,6 +126,7 @@ export const listAllTransactionByWalletAddress = async ( transactions.push({ token: deposit.token, blockNumber: parseInt(deposit.blockNumber), + blockTimestamp: parseInt(deposit.blockTimestamp), amount: parseFloat(formatEther(BigInt(deposit.amount))), seller: deposit.seller, buyer: "", @@ -145,6 +146,7 @@ export const listAllTransactionByWalletAddress = async ( transactions.push({ token: lock.token, blockNumber: parseInt(lock.blockNumber), + blockTimestamp: parseInt(lock.blockTimestamp), amount: parseFloat(formatEther(BigInt(lock.amount))), seller: lock.seller, buyer: lock.buyer, @@ -162,6 +164,7 @@ export const listAllTransactionByWalletAddress = async ( transactions.push({ token: undefined, // Subgraph doesn't provide token in this event, we could enhance this later blockNumber: parseInt(release.blockNumber), + blockTimestamp: parseInt(release.blockTimestamp), amount: -1, // Amount not available in this event seller: "", buyer: release.buyer, @@ -179,6 +182,7 @@ export const listAllTransactionByWalletAddress = async ( transactions.push({ token: withdrawal.token, blockNumber: parseInt(withdrawal.blockNumber), + blockTimestamp: parseInt(withdrawal.blockTimestamp), amount: parseFloat(formatEther(BigInt(withdrawal.amount))), seller: withdrawal.seller, buyer: "", @@ -310,7 +314,7 @@ const listLockTransactionByWalletAddress = async (walletAddress: Address) => { buyer: lock.buyer, lockID: BigInt(lock.lockID), seller: lock.seller, - token: lock.token, + token: undefined, // Token not available in LockAdded subgraph event amount: BigInt(lock.amount), }, // Add other necessary fields to match the original format @@ -340,7 +344,6 @@ const listLockTransactionBySellerAddress = async (sellerAddress: Address) => { buyer lockID seller - token amount blockTimestamp blockNumber @@ -380,7 +383,7 @@ const listLockTransactionBySellerAddress = async (sellerAddress: Address) => { buyer: lock.buyer, lockID: BigInt(lock.lockID), seller: lock.seller, - token: lock.token, + token: undefined, // Token not available in LockAdded subgraph event amount: BigInt(lock.amount), }, // Add other necessary fields to match the original format diff --git a/src/components/BuyerSteps/BuyerSearchComponent.vue b/src/components/BuyerSteps/BuyerSearchComponent.vue index 10cba93..12cad5f 100644 --- a/src/components/BuyerSteps/BuyerSearchComponent.vue +++ b/src/components/BuyerSteps/BuyerSearchComponent.vue @@ -1,5 +1,5 @@ - + { /> { > - - - Explorar Transações - - - - - - - + {{ option.label }} + + + - Documentação - - - - - - - + {{ option.label }} + + + - Perguntas frequentes - - + + + @@ -233,13 +326,6 @@ onClickOutside(infoMenuRef, () => { - - FAQ - { {{ sellerView ? "Quero comprar" : "Quero vender" }} - - - {{ sellerView ? "Quero comprar" : "Quero vender" }} - - - + { Conectar carteira @@ -338,7 +415,7 @@ onClickOutside(infoMenuRef, () => { Conectar @@ -384,23 +461,40 @@ onClickOutside(infoMenuRef, () => { - - Gerenciar Ofertas - - - - - - Desconectar - + + {{ option.label }} + + + {{ option.label }} + + + + + @@ -412,35 +506,49 @@ onClickOutside(infoMenuRef, () => { v-show="menuOpenToggle" class="mobile-menu fixed w-4/5 text-gray-900 inline-block md:hidden" > - + - - + + + {{ option.dynamicLabel ? option.dynamicLabel() : option.label }} + + + {{ option.label }} + + + {{ option.label }} + + + - {{ sellerView ? "Quero comprar" : "Quero vender" }} - - - - - - - - - - - Gerenciar Ofertas - - - - - - - - Desconectar - - + + + @@ -474,7 +582,7 @@ onClickOutside(infoMenuRef, () => { v-show="currencyMenuOpenToggle" class="mobile-menu fixed w-4/5 text-gray-900 inline-block md:hidden" > - + diff --git a/src/model/AppVersion.ts b/src/model/AppVersion.ts new file mode 100644 index 0000000..0272dd5 --- /dev/null +++ b/src/model/AppVersion.ts @@ -0,0 +1,8 @@ +export interface AppVersion { + tag: string; + ipfsHash: string; + releaseDate: string; + description?: string; +} + + diff --git a/src/model/WalletTransaction.ts b/src/model/WalletTransaction.ts index ab0f3c7..7df2229 100644 --- a/src/model/WalletTransaction.ts +++ b/src/model/WalletTransaction.ts @@ -4,6 +4,7 @@ import type { Address } from "viem" export type WalletTransaction = { token?: Address; blockNumber: number; + blockTimestamp?: number; amount: number; seller: string; buyer: string; diff --git a/src/router/index.ts b/src/router/index.ts index a1ccc85..66bed9f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -4,6 +4,7 @@ import FaqView from "@/views/FaqView.vue"; import ManageBidsView from "@/views/ManageBidsView.vue"; import SellerView from "@/views/SellerView.vue"; import ExploreView from "@/views/ExploreView.vue"; +import VersionsView from "@/views/VersionsView.vue"; const router = createRouter({ history: import.meta.env.MODE === 'production' && import.meta.env.BASE_URL === './' @@ -41,6 +42,11 @@ const router = createRouter({ name: "explore", component: ExploreView, }, + { + path: "/versions", + name: "versions", + component: VersionsView, + }, ], }); diff --git a/src/utils/versions.ts b/src/utils/versions.ts new file mode 100644 index 0000000..8ce31d7 --- /dev/null +++ b/src/utils/versions.ts @@ -0,0 +1,24 @@ +import type { AppVersion } from "@/model/AppVersion"; + +export const appVersions: AppVersion[] = [ + { + tag: "1.0.0", + ipfsHash: "bafybeiagfqnxnb5zdrks6dicfm7kxjdtzzzzm2ouluxgdseg2hrrotayzi", + releaseDate: "2023-01-28", + description: "Initial release" + }, +]; + +export function getLatestVersion(): AppVersion | null { + return appVersions.length > 0 ? appVersions[0] : null; +} + +export function getVersionByTag(tag: string): AppVersion | null { + return appVersions.find((v) => v.tag === tag) || null; +} + +export function getIpfsUrl(ipfsHash: string): string { + return `https://${ipfsHash}.ipfs.dweb.link`; +} + + diff --git a/src/views/FaqView.vue b/src/views/FaqView.vue index 2a9a840..d759da6 100644 --- a/src/views/FaqView.vue +++ b/src/views/FaqView.vue @@ -30,18 +30,18 @@ const openItem = (index: number) => { - Perguntas Frequentes - Não conseguiu uma resposta para sua dúvida? Acesse a comunidade do Discord para falar diretamente conosco. - - - Sumário + + + Sumário { - + { - {{ item.title }} + {{ item.title }} @@ -81,23 +81,52 @@ const openItem = (index: number) => { diff --git a/src/views/VersionsView.vue b/src/views/VersionsView.vue new file mode 100644 index 0000000..43a8e89 --- /dev/null +++ b/src/views/VersionsView.vue @@ -0,0 +1,156 @@ + + + + + + + Versões do P2Pix + + + Visualize todas as versões do P2Pix. Cada versão está + disponível no IPFS para acesso permanente e descentralizado. + + + + Versão atual: {{ currentVersion }} + + + + + + + + {{ version.tag }} + + Atual + + + + + Data de lançamento: + {{ formatDate(version.releaseDate) }} + + + {{ version.description }} + + + + Abrir no IPFS + + + + + + + Nenhuma versão cadastrada ainda. + + + + + + + + diff --git a/vite.config.ts b/vite.config.ts index 34dc68c..4501aec 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,11 +6,17 @@ import vue from "@vitejs/plugin-vue"; import vueJsx from "@vitejs/plugin-vue-jsx"; import svgLoader from "vite-svg-loader"; -function getGitCommitHash(): string { +function getGitTag(): string { try { - return execSync("git rev-parse --short HEAD").toString().trim(); + const tag = execSync("git describe --tags --abbrev=0").toString().trim(); + return tag || ""; } catch (error) { - return "unknown"; + try { + const tags = execSync("git tag --sort=-version:refname").toString().trim().split("\n"); + return tags.length > 0 ? tags[0] : "unknown"; + } catch (fallbackError) { + return ""; + } } } @@ -21,7 +27,7 @@ export default defineConfig({ target: "esnext", }, define: { - __APP_VERSION__: JSON.stringify(getGitCommitHash()), + __APP_VERSION__: JSON.stringify(getGitTag()), }, optimizeDeps: { esbuildOptions: {
+ Data de lançamento: + {{ formatDate(version.releaseDate) }} +
+ {{ version.description }} +
Nenhuma versão cadastrada ainda.