43 lines
1.5 KiB
Vue
43 lines
1.5 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { price } from '@/utils/price'
|
|
import { usePriceWithoutType } from '@/utils/usePrice'
|
|
import { getHomeLayoutId } from '../../layouts/registry'
|
|
import { resolveMetalDayRangePrices, usePriceChart } from '../../composables/usePriceChart'
|
|
|
|
const { selectedChartMetal, selectedMetalChartRatio } = usePriceChart()
|
|
const isBoursecuLayout = computed(() => getHomeLayoutId() === 'boursecu')
|
|
|
|
const rangePrices = computed(() =>
|
|
resolveMetalDayRangePrices({
|
|
price: price.value,
|
|
metal: selectedChartMetal.value,
|
|
isBoursecuLayout: isBoursecuLayout.value,
|
|
metalRatio: selectedMetalChartRatio.value,
|
|
})
|
|
)
|
|
|
|
const highPrice = computed(() => rangePrices.value.high)
|
|
const lowPrice = computed(() => rangePrices.value.low)
|
|
</script>
|
|
|
|
<template>
|
|
<div class="dhome-surface dhome-price-range">
|
|
<div class="dhome-price-range__item">
|
|
<span class="dhome-label">بیشترین امروز</span>
|
|
<span class="dhome-price-range__value dhome-price-range__value--high">
|
|
{{ usePriceWithoutType(highPrice) }}
|
|
<span class="text-xs font-medium text-gray-400 mr-1">ریال</span>
|
|
</span>
|
|
</div>
|
|
<div class="dhome-price-range__divider" />
|
|
<div class="dhome-price-range__item">
|
|
<span class="dhome-label">کمترین امروز</span>
|
|
<span class="dhome-price-range__value dhome-price-range__value--low">
|
|
{{ usePriceWithoutType(lowPrice) }}
|
|
<span class="text-xs font-medium text-gray-400 mr-1">ریال</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|