Edit dashboard appearance
This commit is contained in:
@@ -10,16 +10,9 @@ const props = defineProps<{
|
||||
formatAmount: (value: number) => string;
|
||||
}>();
|
||||
|
||||
const demoTrend: HomeDashboardTrendPointDto[] = [
|
||||
{ monthKey: '01', monthLabel: 'فروردین', amount: 980_000_000 },
|
||||
{ monthKey: '02', monthLabel: 'اردیبهشت', amount: 1_250_000_000 },
|
||||
{ monthKey: '03', monthLabel: 'خرداد', amount: 1_480_000_000 },
|
||||
{ monthKey: '04', monthLabel: 'تیر', amount: 1_860_000_000 },
|
||||
{ monthKey: '05', monthLabel: 'مرداد', amount: 2_450_000_000 },
|
||||
];
|
||||
|
||||
const trend = computed(() => (props.trend.length ? props.trend : demoTrend));
|
||||
const change = computed(() => props.changePercent ?? 14);
|
||||
const trend = computed(() => props.trend);
|
||||
const hasTrend = computed(() => trend.value.some((p) => p.amount > 0));
|
||||
const change = computed(() => props.changePercent);
|
||||
|
||||
const option = computed<UiChartOption>(() => ({
|
||||
animationDuration: 400,
|
||||
@@ -48,6 +41,8 @@ const option = computed<UiChartOption>(() => ({
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
min: 0,
|
||||
...(hasTrend.value ? {} : { max: 1 }),
|
||||
splitLine: { lineStyle: { color: '#eef2f7' } },
|
||||
axisLabel: { show: false },
|
||||
},
|
||||
@@ -82,7 +77,7 @@ const option = computed<UiChartOption>(() => ({
|
||||
<article class="panel">
|
||||
<header class="panel-head">
|
||||
<h2>روند فروش</h2>
|
||||
<span class="mini-badge" :class="{ down: change < 0 }">
|
||||
<span v-if="hasTrend && change != null" class="mini-badge" :class="{ down: change < 0 }">
|
||||
{{ formatChange(change) }} نسبت به ماه قبل
|
||||
</span>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user