Edit dashboard appearance

This commit is contained in:
2026-09-21 17:55:05 +03:30
parent d7d82102af
commit 1adc217375
9 changed files with 169 additions and 130 deletions
+7 -33
View File
@@ -32,31 +32,8 @@ type HeroChip = {
link: string;
};
const defaultChips: HeroChip[] = [
{
key: 'demo-urgent',
tone: 'urgent',
title: 'شرکت آماده تصمیم‌گیریه',
subtitle: 'امروز تماس بگیر',
link: '/pipeline',
},
{
key: 'demo-warning',
tone: 'warning',
title: '۳ معامله بیشتر از ۵ روزه',
subtitle: 'پیگیری نشدن',
link: '/pipeline',
},
{
key: 'demo-success',
tone: 'success',
title: 'این ماه از تارگت جلوتری',
link: '/sales/forecast',
},
];
const chips = computed<HeroChip[]>(() => {
const fromApi = props.alerts.slice(0, 3).map((a) => {
const chips = computed<HeroChip[]>(() =>
props.alerts.slice(0, 3).map((a) => {
const parts = a.text.split(/\s*[—\-–]\s*|\n/);
const title = parts[0]?.trim() || a.text;
const subtitle = parts.slice(1).join(' ').trim() || undefined;
@@ -67,12 +44,8 @@ const chips = computed<HeroChip[]>(() => {
subtitle,
link: a.link || '/',
};
});
if (fromApi.length >= 3) return fromApi;
const usedTones = new Set(fromApi.map((c) => c.tone));
const fillers = defaultChips.filter((c) => !usedTones.has(c.tone));
return [...fromApi, ...fillers].slice(0, 3);
});
}),
);
function alertIcon(tone: string) {
if (tone === 'urgent') return 'fire' as const;
@@ -103,11 +76,12 @@ const shortcutLabel = computed(() =>
</span>
<div class="greet-text">
<h1>{{ greeting }} {{ firstName }} 👋</h1>
<p>{{ brand.nameFa }} اینا رو برات پیدا کرده</p>
<p v-if="chips.length">{{ brand.nameFa }} اینا رو برات پیدا کرده</p>
<p v-else>از {{ brand.nameFa }} بپرس یا کار امروز را شروع کن</p>
</div>
</div>
<div class="hero-chips">
<div v-if="chips.length" class="hero-chips">
<RouterLink
v-for="chip in chips"
:key="chip.key"