Unify the web UI on shared controls and let pipeline columns be managed on the board.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-10 01:22:24 +03:30
co-authored by Cursor
parent f1aba1b386
commit b8ad4037b6
40 changed files with 2334 additions and 788 deletions
@@ -2,6 +2,7 @@
import { computed } from 'vue';
import { toFaDigits } from '@/lib/jalali';
import type { HomeDashboardSourceDto } from '@mento/shared';
import UiChart, { type UiChartOption } from '@/components/ui/UiChart.vue';
const props = defineProps<{
sources: HomeDashboardSourceDto[];
@@ -18,17 +19,31 @@ const demoSources: HomeDashboardSourceDto[] = [
const colors = ['#2563eb', '#14b8a6', '#22c55e', '#fb923c', '#94a3b8'];
const rows = computed(() => (props.sources.length ? props.sources : demoSources));
const segments = computed(() => {
let offset = 0;
return rows.value.map((s, i) => {
const seg = { ...s, color: colors[i % colors.length], offset };
offset += s.percent;
return seg;
});
});
const total = computed(() => rows.value.reduce((a, s) => a + s.count, 0));
const option = computed<UiChartOption>(() => ({
animationDuration: 400,
color: colors,
tooltip: {
trigger: 'item',
textStyle: { fontFamily: 'IRANSans, Tahoma, sans-serif' },
formatter: (p) => {
const item = Array.isArray(p) ? p[0] : p;
return `${item.name}<br/>${toFaDigits(Number(item.value ?? 0))} — ${toFaDigits(item.percent ?? 0)}٪`;
},
},
series: [
{
type: 'pie',
radius: ['58%', '82%'],
center: ['50%', '50%'],
avoidLabelOverlap: true,
label: { show: false },
labelLine: { show: false },
data: rows.value.map((s) => ({ name: s.label, value: s.count })),
},
],
}));
</script>
<template>
@@ -39,23 +54,7 @@ const total = computed(() => rows.value.reduce((a, s) => a + s.count, 0));
<div class="donut-wrap">
<div class="donut-chart-box">
<svg viewBox="0 0 140 140" class="donut-chart" aria-hidden="true">
<circle cx="70" cy="70" r="48" fill="none" stroke="#eef2f7" stroke-width="16" />
<circle
v-for="seg in segments"
:key="seg.label"
cx="70"
cy="70"
r="48"
fill="none"
:stroke="seg.color"
stroke-width="16"
stroke-linecap="butt"
:stroke-dasharray="`${seg.percent * 3.016} 301.6`"
:stroke-dashoffset="`${-seg.offset * 3.016}`"
transform="rotate(-90 70 70)"
/>
</svg>
<UiChart :option="option" height="132px" />
<div class="donut-center">
<strong>{{ toFaDigits(total) }}</strong>
<span>مشتری</span>
@@ -63,10 +62,10 @@ const total = computed(() => rows.value.reduce((a, s) => a + s.count, 0));
</div>
<ul class="donut-legend">
<li v-for="seg in segments" :key="seg.label">
<span class="dot" :style="{ background: seg.color }" />
<span class="lbl">{{ seg.label }}</span>
<em>{{ toFaDigits(seg.percent) }}٪</em>
<li v-for="(row, i) in rows" :key="row.label">
<span class="dot" :style="{ background: colors[i % colors.length] }" />
<span class="lbl">{{ row.label }}</span>
<em>{{ toFaDigits(row.percent) }}٪</em>
</li>
</ul>
</div>
@@ -76,10 +75,10 @@ const total = computed(() => rows.value.reduce((a, s) => a + s.count, 0));
<style scoped>
.panel {
background: #fff;
border-radius: 20px;
padding: 1rem 1.1rem;
border-radius: var(--radius);
padding: var(--pad-modal);
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
border: 1px solid #eef2f7;
border: 1px solid var(--line);
min-width: 0;
}
@@ -106,11 +105,6 @@ h2 {
height: 132px;
}
.donut-chart {
width: 132px;
height: 132px;
}
.donut-center {
position: absolute;
inset: 0;