feat(web): adopt vuesax icons and shared skeleton loading

Replace the inline SVG icon set with the vuesax linear pack, add skeleton primitives for loading states, and keep page scroll inside the app shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-05 14:46:35 +03:30
co-authored by Cursor
parent 41f310f3a2
commit 6c6e32e099
133 changed files with 9069 additions and 7416 deletions
+88 -32
View File
@@ -1,11 +1,27 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { RouterLink } from 'vue-router';
import { computed, onMounted, ref } from 'vue';
import { RouterLink, useRouter } from 'vue-router';
import type { DiscDistributionRow } from '@mento/shared';
import {
Alert as AAlert,
Button as AButton,
Card as ACard,
Col as ACol,
Empty as AEmpty,
Flex as AFlex,
Progress as AProgress,
Row as ARow,
Space as ASpace,
Typography,
} from 'ant-design-vue';
import { ArrowRightOutlined, DownloadOutlined } from '@/icons/ant-bridge';
import { api } from '@/lib/api';
import { toFaDigits } from '@/lib/jalali';
import { UiButton, UiPageHeader } from '@/components/ui';
import { CrmSkeleton, CrmSkeletonCard } from '@/components/skeleton';
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
const router = useRouter();
const rows = ref<DiscDistributionRow[]>([]);
const error = ref('');
const loading = ref(true);
@@ -40,36 +56,76 @@ async function exportExcel() {
}
}
const total = () => rows.value.reduce((sum, row) => sum + row.count, 0);
const totalCount = computed(() => rows.value.reduce((sum, row) => sum + row.count, 0));
function percentOf(count: number) {
return totalCount.value ? Math.round((count / totalCount.value) * 100) : 0;
}
</script>
<template>
<section class="page">
<UiPageHeader title="توزیع تیپ‌های DISC" lead="فقط ارزیابی‌های تأییدشده و قابل اتکا، در محدودهٔ دسترسی شما" :back-to="{ name: 'contacts' }">
<template #actions>
<UiButton variant="outline" :disabled="exporting" @click="exportExcel">خروجی اکسل</UiButton>
</template>
</UiPageHeader>
<p v-if="loading" class="muted">در حال بارگذاری…</p>
<p v-else-if="error" class="error">{{ error }}</p>
<p v-else-if="!rows.length" class="muted">هنوز تیپ قابل اتکایی ثبت نشده است.</p>
<ul v-else class="list">
<li v-for="row in rows" :key="row.label">
<RouterLink :to="{ name: 'contacts', query: { disc: row.label } }">{{ row.label }}</RouterLink>
<span>{{ toFaDigits(row.count) }}</span>
<i><b :style="{ width: `${total() ? Math.round((row.count / total()) * 100) : 0}%` }" /></i>
</li>
</ul>
<p class="muted">درصدها سهم مشتریان دارای ارزیابی معتبر هستند، نه دقت یک آزمون روان‌شناسی.</p>
</section>
</template>
<a-row :gutter="[16, 16]">
<a-col :span="24">
<a-flex justify="space-between" align="center" wrap="wrap" :gap="12">
<div>
<a-typography-title :level="3" :style="{ margin: 0 }">
توزیع تیپ‌های DISC
</a-typography-title>
<a-typography-text type="secondary">
فقط ارزیابی‌های تأییدشده و قابل اتکا، در محدودهٔ دسترسی شما
</a-typography-text>
</div>
<a-space wrap>
<a-button @click="router.push({ name: 'contacts' })">
<template #icon><ArrowRightOutlined /></template>
بازگشت
</a-button>
<a-button :disabled="exporting" :loading="exporting" @click="exportExcel">
<template #icon><DownloadOutlined /></template>
خروجی اکسل
</a-button>
</a-space>
</a-flex>
</a-col>
<style scoped>
.page { display: flex; flex-direction: column; gap: 0.8rem; }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.list li { display: grid; grid-template-columns: 6rem auto 1fr; gap: 0.6rem; align-items: center; }
.list i { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.list b { display: block; height: 100%; background: #0f766e; }
.muted { color: #64748b; }
.error { color: #b91c1c; }
</style>
<a-col :span="24">
<CrmSkeleton :loading="loading">
<CrmSkeletonCard :rows="6">
<a-alert v-if="error" type="error" show-icon :message="error" />
<a-empty
v-else-if="!rows.length"
description="هنوز تیپ قابل اتکایی ثبت نشده است."
/>
<a-card v-else :bordered="false">
<a-flex vertical :gap="16">
<a-row
v-for="row in rows"
:key="row.label"
:gutter="[12, 8]"
align="middle"
>
<a-col :xs="24" :sm="4">
<RouterLink :to="{ name: 'contacts', query: { disc: row.label } }">
{{ row.label }}
</RouterLink>
</a-col>
<a-col :xs="8" :sm="4">
<a-typography-text>{{ toFaDigits(row.count) }}</a-typography-text>
</a-col>
<a-col :xs="16" :sm="16">
<a-progress :percent="percentOf(row.count)" :show-info="false" />
</a-col>
</a-row>
</a-flex>
</a-card>
</CrmSkeletonCard>
</CrmSkeleton>
</a-col>
<a-col :span="24">
<a-typography-text type="secondary">
درصدها سهم مشتریان دارای ارزیابی معتبر هستند، نه دقت یک آزمون روان‌شناسی.
</a-typography-text>
</a-col>
</a-row>
</template>