1
1
<script setup>
2
+ /** Vendor */
3
+ import { DateTime } from " luxon"
4
+
2
5
/** Services */
3
6
import { comma , formatBytes , abbreviate } from " @/services/utils"
4
7
@@ -14,6 +17,7 @@ const appStore = useAppStore()
14
17
15
18
const head = computed (() => appStore .head )
16
19
20
+ const series = ref ([])
17
21
const price = reactive ({
18
22
value: 0 ,
19
23
diff: 0 ,
@@ -24,8 +28,9 @@ onMounted(async () => {
24
28
const dataPrice = await fetchPrice ()
25
29
const dataSeries = await fetchPriceSeries ()
26
30
price .value = parseFloat (dataPrice .close )
31
+ series .value = dataSeries
27
32
28
- const prevDayClosePrice = parseFloat (dataSeries [1 ].close )
33
+ const prevDayClosePrice = parseFloat (series . value [1 ].close )
29
34
price .diff = (Math .abs (prevDayClosePrice - price .value ) / ((prevDayClosePrice + price .value ) / 2 )) * 100
30
35
price .side = price .value - prevDayClosePrice > 0 ? " rise" : " fall"
31
36
})
@@ -106,26 +111,39 @@ onMounted(async () => {
106
111
</Tooltip >
107
112
</Flex >
108
113
109
- <Flex align =" center" gap =" 6" :class =" $style.stat" >
110
- <Icon name =" coin" size =" 12" color =" secondary" :class =" $style.icon" />
114
+ <Tooltip position =" end" >
115
+ <Flex align =" center" gap =" 6" :class =" $style.stat" >
116
+ <Icon name =" coin" size =" 12" color =" secondary" :class =" $style.icon" />
111
117
112
- <Flex align =" center" gap =" 4" >
113
- <Text size =" 12" weight =" 500" color =" tertiary" noWrap :class =" $style.key" >TIA:</Text >
118
+ <Flex align =" center" gap =" 4" >
119
+ <Text size =" 12" weight =" 500" color =" tertiary" noWrap :class =" $style.key" >TIA:</Text >
114
120
115
- <Text v-if =" price.value" size =" 12" weight =" 600" noWrap :class =" $style.value" > ${{ price.value.toFixed(2) }} </Text >
116
- <Skeleton v-else w =" 36" h =" 12" />
117
- </Flex >
121
+ <Text v-if =" price.value" size =" 12" weight =" 600" noWrap :class =" $style.value" > ${{ price.value.toFixed(2) }} </Text >
122
+ <Skeleton v-else w =" 36" h =" 12" />
123
+ </Flex >
118
124
119
- <Flex v-if =" price.diff" align =" center" gap =" 4" >
120
- <Icon v-if =" price.side === 'rise'" name =" arrow-circle-right-up" size =" 12" color =" neutral-green" />
121
- <Icon v-else name =" arrow-circle-right-down" size =" 12" color =" secondary" />
125
+ <Flex v-if =" price.diff" align =" center" gap =" 4" >
126
+ <Icon v-if =" price.side === 'rise'" name =" arrow-circle-right-up" size =" 12" color =" neutral-green" />
127
+ <Icon v-else name =" arrow-circle-right-down" size =" 12" color =" secondary" />
122
128
123
- <Text size =" 12" weight =" 600" :color =" price.side === 'rise' ? 'neutral-green' : 'secondary'" noWrap >
124
- {{ price.diff.toFixed(2) }}%</Text
125
- >
129
+ <Text size =" 12" weight =" 600" :color =" price.side === 'rise' ? 'neutral-green' : 'secondary'" noWrap >
130
+ {{ price.diff.toFixed(2) }}%</Text
131
+ >
132
+ </Flex >
133
+ <Skeleton v-else w =" 50" h =" 12" />
126
134
</Flex >
127
- <Skeleton v-else w =" 50" h =" 12" />
128
- </Flex >
135
+
136
+ <template #content >
137
+ <Flex direction =" column" gap =" 6" >
138
+ Price diff from the previous day
139
+
140
+ <Flex align =" center" gap =" 4" >
141
+ <Text color =" tertiary" >{{ DateTime.fromISO(series[1].time).setLocale("en").toFormat("ff") }} -></Text >
142
+ <Text color =" primary" >${{ series[1].close }}</Text >
143
+ </Flex >
144
+ </Flex >
145
+ </template >
146
+ </Tooltip >
129
147
</Flex >
130
148
</Flex >
131
149
</template >
0 commit comments