-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
105 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<script setup lang="ts"> | ||
import { useTickerStore } from '@/store/ticker'; | ||
import { concatNumber } from '@/helpers/helpers'; | ||
import { computed } from 'vue'; | ||
import type { TickerData, SizeType } from '@/types/types'; | ||
import { SizeMap } from '@/defaults/defaults'; | ||
const tickerStore = useTickerStore(); | ||
const { tickerId, boxSize, rLink } = defineProps<{ | ||
tickerId: string; | ||
boxSize: SizeType; | ||
rLink: string; | ||
}>(); | ||
const ticker = computed<TickerData>(() => { | ||
return tickerStore.tickerValue(tickerId); | ||
}); | ||
const sInfo = SizeMap[boxSize]; | ||
</script> | ||
|
||
<template> | ||
<div class="p-1.5 w-full h-full"> | ||
<div class="bg-zinc-800 rounded-2xl w-full h-full"> | ||
<RouterLink :to="rLink"> | ||
<div class="p-2 h-full w-full flex flex-wrap flex-col"> | ||
<h1 class="font-medium" :class="sInfo.name">{{ ticker.id }}</h1> | ||
<div v-if="ticker.status == 'CONNECTING'"> | ||
<h1 class="font-medium" :class="sInfo.status">Connecting...</h1> | ||
</div> | ||
<div v-else-if="ticker.status == 'ERROR'"> | ||
<h1 class="font-medium" :class="sInfo.status">Error</h1> | ||
</div> | ||
<div v-else-if="ticker.status == 'CONNECTED'" class="flex grow flex-wrap"> | ||
<div class="inline-flex items-center text-center" :class="sInfo.padding"> | ||
<svg class="w-auto" :class="[ticker.dirFilter, sInfo.iconSize]" viewBox="0 0 31.417 31.416"> | ||
<path | ||
d="M29.462 15.707a3.004 3.004 0 0 1-1.474 2.583L6.479 30.999c-.47.275-.998.417-1.526.417a2.98 2.98 0 0 1-1.487-.396 2.997 2.997 0 0 1-1.513-2.604V2.998A3.002 3.002 0 0 1 6.479.415l21.509 12.709a2.997 2.997 0 0 1 1.474 2.583z" | ||
/> | ||
</svg> | ||
<h1 class="text-emerald-500 font-medium px-1" :class="sInfo.price"> | ||
${{ concatNumber(ticker.curPrice, 2, true, false) }} | ||
</h1> | ||
</div> | ||
<div class="grow flex h-auto items-end justify-end"> | ||
<h1 class="font-medium text-left inline-block px-1 w-1/2" :class="sInfo.info"> | ||
{{ concatNumber(ticker.volume, 2, false, true) }} | ||
</h1> | ||
<h1 | ||
class="font-medium text-right inline-block px-1 w-1/2" | ||
:class="[ticker.dayPercentage >= 0 ? 'text-emerald-500' : 'text-red-500', sInfo.info]" | ||
> | ||
{{ ticker.dayPercentage.toPrecision(3) }}% | ||
</h1> | ||
</div> | ||
</div> | ||
</div> | ||
</RouterLink> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,20 @@ | ||
<script setup lang="ts"> | ||
import { useTickerStore } from '@/store/ticker'; | ||
import { concatNumber } from '@/helpers/helpers'; | ||
import { type SizeType } from '@/types/types'; | ||
import TickerBox from '@/components/ticker/TickerBox.vue'; | ||
const tickerStore = useTickerStore(); | ||
const boxSize = 'SMALL' as SizeType; | ||
</script> | ||
|
||
<template> | ||
<div v-if="tickerStore.status.overall == 'CONNECTING'" class="text-center"> | ||
<h1 class="font-medium text-4xl">Connecting...</h1> | ||
</div> | ||
<div v-else-if="tickerStore.status.overall == 'CONNECTED'" class="flex flex-wrap justify-center m-auto w-full h-full"> | ||
<div v-for="[id, ticker] in tickerStore.tickerData" :key="id" class="w-1/2 h-1/2"> | ||
<div class="p-1 w-full h-full"> | ||
<div class="bg-zinc-800 rounded-2xl w-full h-full"> | ||
<RouterLink :to="id"> | ||
<div class="p-2 h-full w-full flex flex-wrap flex-col"> | ||
<h1 class="font-medium text-4xl">{{ ticker.id }}</h1> | ||
<div v-if="ticker.status == 'CONNECTING'"> | ||
<h1 class="font-medium text-4xl">Connecting...</h1> | ||
</div> | ||
<div v-else-if="ticker.status == 'ERROR'"> | ||
<h1 class="font-medium text-4xl">Error</h1> | ||
</div> | ||
<div v-else-if="ticker.status == 'CONNECTED'" class="flex grow flex-wrap"> | ||
<div class="inline-flex items-center text-center pl-1"> | ||
<svg class="h-5 w-auto" :class="ticker.dirFilter" viewBox="0 0 31.417 31.416"> | ||
<path | ||
d="M29.462 15.707a3.004 3.004 0 0 1-1.474 2.583L6.479 30.999c-.47.275-.998.417-1.526.417a2.98 2.98 0 0 1-1.487-.396 2.997 2.997 0 0 1-1.513-2.604V2.998A3.002 3.002 0 0 1 6.479.415l21.509 12.709a2.997 2.997 0 0 1 1.474 2.583z" | ||
/> | ||
</svg> | ||
<h1 class="text-emerald-500 font-medium text-4xl py-2 px-1"> | ||
${{ concatNumber(ticker.curPrice, 2, true, false) }} | ||
</h1> | ||
</div> | ||
<div class="grow flex h-auto items-end justify-end"> | ||
<h1 class="font-medium text-2xl text-left w-1/2 px-1"> | ||
{{ concatNumber(ticker.volume, 2, false, true) }} | ||
</h1> | ||
<h1 | ||
class="font-medium text-2xl text-right w-1/2 px-1" | ||
:class="[ticker.dayPercentage >= 0 ? 'text-emerald-500' : 'text-red-500']" | ||
> | ||
{{ ticker.dayPercentage.toPrecision(3) }}% | ||
</h1> | ||
</div> | ||
</div> | ||
</div> | ||
</RouterLink> | ||
</div> | ||
</div> | ||
<div v-for="id in tickerStore.tickerKeys" :key="id" class="w-1/2 h-1/2"> | ||
<TickerBox :tickerId="id" :boxSize="boxSize" :rLink="id"></TickerBox> | ||
</div> | ||
</div> | ||
</template> |