feat: добавить мок-данные графиков цен на карточки продуктов
All checks were successful
Build Docker Image / build (push) Successful in 4m43s

This commit is contained in:
Ruslan Bakiev
2026-01-15 23:50:52 +07:00
parent 71663186e2
commit 25030f0350
2 changed files with 70 additions and 0 deletions

View File

@@ -48,6 +48,7 @@
v-for="product in products"
:key="product.uuid"
:name="product.name"
:price-history="getMockPriceHistory(product.uuid)"
:selected="selectedProductUuid === product.uuid"
@select="selectedProductUuid = product.uuid"
/>
@@ -97,6 +98,16 @@ const selectedSourceUuid = ref('')
const rawSources = ref<any[]>([])
const offersData = ref<Map<string, any>>(new Map())
// Mock price history generator (seeded by uuid for consistent results)
const getMockPriceHistory = (uuid: string): number[] => {
const seed = uuid.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0)
const basePrice = 100 + (seed % 200)
return Array.from({ length: 7 }, (_, i) => {
const variation = Math.sin(seed + i * 0.5) * 20 + Math.cos(seed * 0.3 + i) * 10
return Math.round(basePrice + variation)
})
}
const hubId = computed(() => route.params.id as string)
// Selected product name