41 lines
1.2 KiB
Vue
41 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
import { computed, toValue } from 'vue'
|
|
import { useHomePageContext } from '../../composables/useHomePage'
|
|
import PriceChart from '../../components/PriceChart.vue'
|
|
import DesktopHomeSection from './DesktopHomeSection.vue'
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
embedded?: boolean
|
|
}>(),
|
|
{
|
|
embedded: false,
|
|
},
|
|
)
|
|
|
|
const ctx = useHomePageContext()
|
|
|
|
const chartLayout = computed(() => (toValue(ctx.isBoursecuHomeLayout) ? 'boursecu' : 'default'))
|
|
const priceChartSeries = computed(() => toValue(ctx.priceChartSeries))
|
|
const chartSelection = computed(() => toValue(ctx.chartSelection))
|
|
const selectedChartMetal = computed(() => toValue(ctx.selectedChartMetal))
|
|
</script>
|
|
|
|
<template>
|
|
<component
|
|
:is="props.embedded ? 'div' : DesktopHomeSection"
|
|
:title="props.embedded ? undefined : 'نمودار قیمت'"
|
|
class="dhome-chart"
|
|
>
|
|
<PriceChart
|
|
variant="desktop"
|
|
:price-chart-series="priceChartSeries"
|
|
:layout="chartLayout"
|
|
:chart-selection="chartSelection"
|
|
:selected-metal="selectedChartMetal"
|
|
@update-data="ctx.updateChartData"
|
|
@update:selected-metal="ctx.setChartMetal"
|
|
/>
|
|
</component>
|
|
</template>
|