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
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { HomeDashboardTrendPointDto } from '@mento/shared';
import UiChart, { type UiChartOption } from '@/components/ui/UiChart.vue';
const props = defineProps<{
trend: HomeDashboardTrendPointDto[];
@@ -20,33 +21,61 @@ const demoTrend: HomeDashboardTrendPointDto[] = [
const trend = computed(() => (props.trend.length ? props.trend : demoTrend));
const change = computed(() => props.changePercent ?? 14);
const points = computed(() => {
const rows = trend.value;
const max = Math.max(...rows.map((p) => p.amount), 1);
const w = 360;
const h = 150;
const padX = 16;
const padY = 36;
return rows.map((p, i) => ({
...p,
x: padX + (i / Math.max(rows.length - 1, 1)) * (w - padX * 2),
y: h - padY - (p.amount / max) * (h - padY * 2),
}));
});
const line = computed(() => points.value.map((p) => `${p.x},${p.y}`).join(' '));
const area = computed(() => {
if (!points.value.length) return '';
const first = points.value[0]!;
const last = points.value[points.value.length - 1]!;
return `${line.value} ${last.x},160 ${first.x},160`;
});
const highlight = computed(() => {
if (!points.value.length) return null;
return points.value.reduce((best, cur) => (cur.amount >= best.amount ? cur : best));
});
const option = computed<UiChartOption>(() => ({
animationDuration: 400,
grid: { top: 28, right: 8, bottom: 28, left: 8, containLabel: true },
tooltip: {
trigger: 'axis',
textStyle: { fontFamily: 'IRANSans, Tahoma, sans-serif' },
formatter: (params) => {
const row = Array.isArray(params) ? params[0] : params;
const point = trend.value[row.dataIndex ?? 0];
if (!point) return '';
return `${point.monthLabel}<br/>${props.formatAmount(point.amount)}`;
},
},
xAxis: {
type: 'category',
data: trend.value.map((p) => p.monthLabel),
boundaryGap: false,
axisLine: { show: false },
axisTick: { show: false },
axisLabel: {
color: '#94a3b8',
fontFamily: 'IRANSans, Tahoma, sans-serif',
fontSize: 11,
},
},
yAxis: {
type: 'value',
splitLine: { lineStyle: { color: '#eef2f7' } },
axisLabel: { show: false },
},
series: [
{
type: 'line',
data: trend.value.map((p) => p.amount),
smooth: 0.35,
symbol: 'circle',
symbolSize: 8,
itemStyle: { color: '#14b8a6', borderColor: '#fff', borderWidth: 2 },
lineStyle: { color: '#14b8a6', width: 3 },
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: 'rgba(20, 184, 166, 0.28)' },
{ offset: 1, color: 'rgba(20, 184, 166, 0)' },
],
},
},
},
],
}));
</script>
<template>
@@ -57,73 +86,17 @@ const highlight = computed(() => {
{{ formatChange(change) }} نسبت به ماه قبل
</span>
</header>
<div class="chart-wrap">
<svg viewBox="0 0 360 170" class="line-chart" aria-hidden="true">
<defs>
<linearGradient id="homeTrendFill" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#14b8a6" stop-opacity="0.28" />
<stop offset="100%" stop-color="#14b8a6" stop-opacity="0" />
</linearGradient>
</defs>
<line
v-for="y in [40, 75, 110, 145]"
:key="y"
x1="12"
:y1="y"
x2="348"
:y2="y"
stroke="#eef2f7"
stroke-width="1"
/>
<polygon v-if="area" :points="area" fill="url(#homeTrendFill)" />
<polyline
v-if="line"
:points="line"
fill="none"
stroke="#14b8a6"
stroke-width="3.2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<g v-for="(p, i) in points" :key="i">
<circle :cx="p.x" :cy="p.y" r="4.5" fill="#fff" stroke="#14b8a6" stroke-width="2.4" />
</g>
<g v-if="highlight">
<rect
:x="Math.min(Math.max(highlight.x - 52, 4), 256)"
:y="highlight.y - 32"
width="104"
height="24"
rx="8"
fill="#0f766e"
/>
<text
:x="Math.min(Math.max(highlight.x, 56), 308)"
:y="highlight.y - 16"
text-anchor="middle"
fill="#fff"
font-size="9.5"
font-family="IRANSans, Tahoma, sans-serif"
>
{{ formatAmount(highlight.amount) }}
</text>
</g>
</svg>
<div class="chart-labels">
<span v-for="p in trend" :key="p.monthKey">{{ p.monthLabel }}</span>
</div>
</div>
<UiChart :option="option" height="210px" />
</article>
</template>
<style scoped>
.panel {
background: #fff;
border-radius: 20px;
padding: 1rem 1.1rem 0.9rem;
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;
height: 100%;
display: flex;
@@ -135,7 +108,7 @@ const highlight = computed(() => {
align-items: center;
justify-content: space-between;
gap: 0.75rem;
margin-bottom: 0;
margin-bottom: 0.35rem;
}
h2 {
@@ -149,7 +122,7 @@ h2 {
font-weight: 700;
color: #16a34a;
background: #dcfce7;
border-radius: 999px;
border-radius: var(--radius);
padding: 0.18rem 0.5rem;
white-space: nowrap;
}
@@ -158,24 +131,4 @@ h2 {
color: #dc2626;
background: #fee2e2;
}
.chart-wrap {
display: grid;
gap: 0.15rem;
margin-top: auto;
padding-top: 2.25rem;
}
.line-chart {
width: 100%;
height: auto;
}
.chart-labels {
display: flex;
justify-content: space-between;
color: #94a3b8;
font-size: 0.72rem;
padding: 0 0.35rem;
}
</style>