feat(quotes): show world copper, dollar, ton, and kilo on home

Add assets chart hover so the portfolio line shows the value under the pointer.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-03 19:57:39 +03:30
co-authored by Cursor
parent c21738950d
commit 5596fc75d0
8 changed files with 380 additions and 109 deletions
+40 -71
View File
@@ -29,31 +29,15 @@
</template>
<template v-else>
<div class="price-label price-label--boursecu">
قیمت لحظه‌ای کاتد مس
</div>
<div class="w-full items-center flex justify-center">
<div v-if="price" class="flex gap-1 text-xs items-center">
<div
v-if="percentChange !== 0"
class="price-change-badge"
:class="percentChange > 0 ? 'price-change-badge--up' : 'price-change-badge--down'"
>
<Icon
:key="displayGoldVal"
:size="15"
:icon="percentChange > 0 ? 'vuesax-linear:send' : 'vuesax-linear:received'"
:color="percentChange > 0 ? 'green-600' : 'red-600'"
/>
<span class="price-change-badge__value">{{ formatSignedPercentChange(percentChange) }}</span>
</div>
<span
class="o-text !text-xl font-bold price-odometer--boursecu"
style="direction: ltr"
>{{ usePriceWithoutType(displayGoldVal) }}</span>
<span class="price-unit--boursecu">ریال</span>
</div>
</div>
<ul class="hero-quotes">
<li v-for="row in quoteRows" :key="row.label" class="hero-quotes__row">
<span class="hero-quotes__label">{{ row.label }}</span>
<span class="hero-quotes__value" dir="ltr">
<bdi>{{ row.value }}</bdi>
<small v-if="row.unit">{{ row.unit }}</small>
</span>
</li>
</ul>
</template>
</div>
</template>
@@ -62,7 +46,7 @@
import { computed } from 'vue'
import Icon from '@/components/BasicPacks/BasicIcon.vue'
import { useUserStore } from '@/store/userStore'
import { getTradeBuyPrice, lastPrice, percentPriceChanged, price } from '@/utils/price'
import { useHomeQuoteRows } from '@/views/base/home/composables/useHomeQuoteRows'
import {
NO_QUOTE_MESSAGE,
STORE_CLOSED_TITLE,
@@ -70,7 +54,6 @@ import {
getStoreClosedHint,
isHomeQuotePending,
} from '@/utils/storeHours'
import { formatSignedPercentChange, usePriceWithoutType } from '@/utils/usePrice'
const userStore = useUserStore()
@@ -98,17 +81,7 @@ const containerClass = computed(() => {
return 'boursecu-price-box boursecu-price-box--open'
})
const percentChange = computed(() => {
if (!getTradeBuyPrice(lastPrice.value)) return 0
return percentPriceChanged()
})
const displayGoldVal = computed(() => {
if (displayState.value !== 'open') return 0
return getTradeBuyPrice(lastPrice.value)
})
void price
const { quoteRows } = useHomeQuoteRows()
</script>
<style scoped>
@@ -128,20 +101,42 @@ void price
min-height: 88px;
}
.price-label--boursecu {
.hero-quotes {
display: flex;
flex-direction: column;
gap: 8px;
margin: 0;
padding: 0 12px;
list-style: none;
}
.hero-quotes__row {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 8px;
min-width: 0;
}
.hero-quotes__label {
color: rgba(255, 255, 255, 0.92);
font-size: 12px;
font-weight: 600;
width: 100%;
text-align: center;
min-width: 0;
}
.price-odometer--boursecu {
color: #ffffff !important;
.hero-quotes__value {
color: #fff;
font-size: 13px;
font-weight: 700;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.price-unit--boursecu {
color: rgba(255, 255, 255, 0.85);
.hero-quotes__value small {
margin-left: 4px;
color: rgba(255, 255, 255, 0.8);
font-size: 11px;
font-weight: 500;
}
@@ -191,30 +186,4 @@ void price
.status-box--boursecu .status-box__hint {
color: rgba(255, 255, 255, 0.78);
}
.price-change-badge {
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 0.2rem 0.65rem;
border-radius: 0.5rem;
font-weight: 600;
}
.price-change-badge--up {
background: #dcfce7;
color: #16a34a;
}
.price-change-badge--down {
background: #fee2e2;
color: #dc2626;
}
.price-change-badge__value {
direction: ltr;
unicode-bidi: isolate;
font-variant-numeric: tabular-nums;
letter-spacing: 0.01em;
}
</style>