chore(catalog): simplify nested page headers, remove charts
Some checks failed
Build Docker Image / build (push) Has been cancelled
Some checks failed
Build Docker Image / build (push) Has been cancelled
- Remove chart components and unused price history code - Simplify headers to show only hint text - Keep navigation badges in search bar
This commit is contained in:
@@ -43,30 +43,7 @@
|
||||
</template>
|
||||
|
||||
<template #header>
|
||||
<Stack gap="3">
|
||||
<!-- Product info -->
|
||||
<div>
|
||||
<Heading :level="1">{{ product.name }}</Heading>
|
||||
<Text tone="muted" size="sm">{{ hub.name }}, {{ hub.country }}</Text>
|
||||
</div>
|
||||
|
||||
<!-- Price chart -->
|
||||
<Card padding="md">
|
||||
<Stack gap="2">
|
||||
<Text weight="semibold" size="sm">{{ t('catalogHub.product.priceHistory') }}</Text>
|
||||
<div class="h-48">
|
||||
<ClientOnly>
|
||||
<apexchart
|
||||
type="area"
|
||||
height="180"
|
||||
:options="chartOptions"
|
||||
:series="chartSeries"
|
||||
/>
|
||||
</ClientOnly>
|
||||
</div>
|
||||
</Stack>
|
||||
</Card>
|
||||
</Stack>
|
||||
<Text v-if="sources.length === 0 && !isLoadingRoutes" tone="muted">Нет доступных источников</Text>
|
||||
</template>
|
||||
|
||||
<template #card="{ item }">
|
||||
@@ -149,72 +126,6 @@ const handleRemoveFilter = (filterId: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 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: 30 }, (_, i) => {
|
||||
const variation = Math.sin(seed + i * 0.3) * 30 + Math.cos(seed * 0.2 + i) * 15
|
||||
return Math.round(basePrice + variation)
|
||||
})
|
||||
}
|
||||
|
||||
// Chart configuration
|
||||
const priceHistory = computed(() => getMockPriceHistory(productId.value))
|
||||
|
||||
const trend = computed(() => {
|
||||
if (priceHistory.value.length < 2) return 0
|
||||
const first = priceHistory.value[0]
|
||||
const last = priceHistory.value[priceHistory.value.length - 1]
|
||||
if (!first || first === 0) return 0
|
||||
return Math.round(((last - first) / first) * 100)
|
||||
})
|
||||
|
||||
const chartOptions = computed(() => ({
|
||||
chart: {
|
||||
type: 'area',
|
||||
toolbar: { show: false },
|
||||
animations: { enabled: true }
|
||||
},
|
||||
stroke: {
|
||||
curve: 'smooth',
|
||||
width: 2
|
||||
},
|
||||
fill: {
|
||||
type: 'gradient',
|
||||
gradient: {
|
||||
shadeIntensity: 1,
|
||||
opacityFrom: 0.4,
|
||||
opacityTo: 0.1
|
||||
}
|
||||
},
|
||||
colors: [trend.value >= 0 ? '#22c55e' : '#ef4444'],
|
||||
dataLabels: { enabled: false },
|
||||
xaxis: {
|
||||
categories: priceHistory.value.map((_, i) => `${i + 1}`),
|
||||
labels: { show: false }
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
formatter: (val: number) => `$${val}`
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
y: {
|
||||
formatter: (val: number) => `$${val}`
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
borderColor: '#e5e7eb',
|
||||
strokeDashArray: 4
|
||||
}
|
||||
}))
|
||||
|
||||
const chartSeries = computed(() => [{
|
||||
name: t('catalogHub.product.price'),
|
||||
data: priceHistory.value
|
||||
}])
|
||||
|
||||
// Transform sources for CatalogPage
|
||||
const sources = computed(() => {
|
||||
return rawSources.value.map(source => ({
|
||||
|
||||
@@ -19,28 +19,8 @@
|
||||
</template>
|
||||
|
||||
<template #header>
|
||||
<!-- Not Found -->
|
||||
<Card v-if="!isLoading && !hub" padding="lg">
|
||||
<Stack align="center" gap="4">
|
||||
<IconCircle tone="primary">
|
||||
<Icon name="lucide:map-pin" size="24" />
|
||||
</IconCircle>
|
||||
<Heading :level="2">{{ t('catalogHub.not_found.title') }}</Heading>
|
||||
<Text tone="muted">{{ t('catalogHub.not_found.subtitle') }}</Text>
|
||||
<Button @click="navigateTo(localePath('/catalog'))">
|
||||
{{ t('catalogHub.actions.back_to_catalog') }}
|
||||
</Button>
|
||||
</Stack>
|
||||
</Card>
|
||||
|
||||
<!-- Content Header -->
|
||||
<Stack v-else gap="4">
|
||||
<!-- Header -->
|
||||
<div>
|
||||
<Heading :level="1">{{ hub?.name }}</Heading>
|
||||
<Text tone="muted" size="sm">{{ hub?.country }}</Text>
|
||||
</div>
|
||||
</Stack>
|
||||
<Text v-if="!isLoading && !hub" tone="muted">Хаб не найден</Text>
|
||||
<Text v-else-if="!isLoading" tone="muted">Выберите товар</Text>
|
||||
</template>
|
||||
|
||||
<template #card="{ item }">
|
||||
|
||||
Reference in New Issue
Block a user