Skip to content

Commit

Permalink
feat: AE coin markets (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
janmichek authored Jul 15, 2024
1 parent bd6cbeb commit 31da7e4
Show file tree
Hide file tree
Showing 13 changed files with 665 additions and 25 deletions.
3 changes: 3 additions & 0 deletions cypress/e2e/app/aeCoin.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ describe('ae coin', () => {

cy.get('.ae-coin-panel table').should('be.visible')
cy.get('.ae-coin-transactions-panel .paginated-content').should('be.visible')

cy.contains('.tabs__item', 'Markets').click()
cy.get('.ae-coin-transactions-panel table').should('be.visible')
})
})
7 changes: 7 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ export default defineNuxtConfig({
devServer: {
port: 8080,
},
nitro: {
routeRules: {
'/proxy/gate': { proxy: 'https://api.gateio.ws/api/v4/spot/tickers?currency_pair=AE_USDT', cors: true },
'/proxy/mexc': { proxy: 'https://api.mexc.com/api/v3/ticker/24hr?symbol=AEUSDT', cors: true },
'/proxy/coinw': { proxy: 'https://api.coinw.com/api/v1/public?command=returnTicker', cors: true },
},
},
modules: [
'@pinia/nuxt',
'@nuxtjs/plausible',
Expand Down
43 changes: 43 additions & 0 deletions src/components/AeCoinMarketsPanel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template>
<app-panel class="ae-coin-transactions-panel">
<loader-indicator v-if="isLoading"/>
<template v-else>
<ae-coin-markets-table
class="u-hidden-mobile"
:gate="gate"
:mexc="mexc"
:hot-coin="hotCoin"
:coin-store="coinStore"
:coin-w="coinW"/>
<ae-coin-markets-table-condensed
class="u-hidden-desktop"
:gate="gate"
:mexc="mexc"
:hot-coin="hotCoin"
:coin-store="coinStore"
:coin-w="coinW"/>
</template>
</app-panel>
</template>

<script setup>
import { storeToRefs } from 'pinia'
import { useAeCoinStore } from '@/stores/aeCoin'
const aeCoinStore = useAeCoinStore()
const { fetchMarketStats } = aeCoinStore
const {
gate,
mexc,
hotCoin,
coinStore,
coinW,
isLoading,
} = storeToRefs(aeCoinStore)
await useAsyncData(async() => {
await fetchMarketStats()
return true
})
</script>
87 changes: 87 additions & 0 deletions src/components/AeCoinMarketsTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<template>
<table>
<tr>
<th>
Name
<hint-tooltip>
{{ aeCoinHints.marketName }}
</hint-tooltip>
</th>
<th>
Token Pair
<hint-tooltip>
{{ aeCoinHints.pair }}
</hint-tooltip>
</th>
<th>
Price
<hint-tooltip>
{{ aeCoinHints.marketPrice }}
</hint-tooltip>
</th>
<th>
Volume (24h)
<hint-tooltip>
{{ aeCoinHints.volume }}
</hint-tooltip>
</th>
</tr>
<tr>
<td>Gate.io</td>
<td>AE / USDT</td>
<td>$ {{ formatNullable(formatNumber(gate?.price)) }}</td>
<td>$ {{ formatNullable(formatNumber(gate?.volume)) }}</td>
</tr>
<tr>
<td>Mexc</td>
<td>AE / USDT</td>
<td>$ {{ formatNullable(formatNumber(mexc?.price)) }}</td>
<td>$ {{ formatNullable(formatNumber(mexc?.volume)) }}</td>
</tr>
<tr>
<td>HotCoin</td>
<td>AE / USDT</td>
<td>$ {{ formatNullable(formatNumber(hotCoin?.price)) }}</td>
<td>$ {{ formatNullable(formatNumber(hotCoin?.volume)) }}</td>
</tr>
<tr>
<td>CoinStore</td>
<td>AE / USDT</td>
<td>$ {{ formatNullable(formatNumber(coinStore?.price)) }}</td>
<td>$ {{ formatNullable(formatNumber(coinStore?.volume)) }}</td>
</tr>
<tr>
<td>CoinW</td>
<td>AE / USDT</td>
<td>$ {{ formatNullable(formatNumber(coinW?.price)) }}</td>
<td>$ {{ formatNullable(formatNumber(coinW?.volume)) }}</td>
</tr>
</table>
</template>

<script setup>
import { aeCoinHints } from '@/utils/hints/aeCoinHints'
defineProps({
gate: {
type: Object,
required: true,
},
mexc: {
type: Object,
required: true,
},
hotCoin: {
type: Object,
required: true,
},
coinStore: {
type: Object,
required: true,
},
coinW: {
type: Object,
required: true,
},
})
</script>
Loading

0 comments on commit 31da7e4

Please sign in to comment.