Polish dashboard UI to match Mento mockup with IRANSans and brand assets.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,12 +4,6 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>منتو | Mento CRM</title>
|
<title>منتو | Mento CRM</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
||||||
<link
|
|
||||||
href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap"
|
|
||||||
rel="stylesheet"
|
|
||||||
/>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 631 KiB After Width: | Height: | Size: 198 KiB |
@@ -1,8 +1,14 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
|
||||||
<!-- Woven M mark matching brand: teal #2EB29B + navy #134E4A -->
|
<defs>
|
||||||
<rect x="8" y="12" width="10" height="40" rx="5" fill="#2EB29B"/>
|
<linearGradient id="mentoLogoBg" x1="8" y1="8" x2="56" y2="56">
|
||||||
<path d="M12 13c1.3-2.1 4.4-2.4 6.1-.6L34 28l5.4-5.1c1.7-1.6 4.5-1.4 5.9.5L47 26.2 33.6 39.3c-1.3 1.3-3.4 1.3-4.7 0L10.5 21.2 12 13Z" fill="#134E4A"/>
|
<stop offset="0%" stop-color="#5eead4"/>
|
||||||
<path d="M25.2 30.8 37.5 18.8c1.6-1.6 4.3-1.5 5.8.2L55 32.1l-3.2 3.3L41 25.3 30.2 35.8c-1.3 1.3-3.5 1.2-4.7-.1l-.3-.3Z" fill="#2EB29B"/>
|
<stop offset="100%" stop-color="#14b8a6"/>
|
||||||
<rect x="46" y="12" width="10" height="40" rx="5" fill="#134E4A"/>
|
</linearGradient>
|
||||||
<path d="M44.8 13.2c1.6-1.7 4.4-1.6 5.9.2l2 2.2-8.7 8.3-2.6-2.5c-1.5-1.4-1.1-4 3.4-8.2Z" fill="#2EB29B"/>
|
</defs>
|
||||||
|
<rect x="4" y="4" width="56" height="56" rx="16" fill="url(#mentoLogoBg)"/>
|
||||||
|
<rect x="14" y="16" width="8" height="32" rx="4" fill="#fff" opacity="0.95"/>
|
||||||
|
<path d="M17 17.5c1-1.6 3.5-1.8 4.8-.5L36 30l4.3-4c1.4-1.3 3.6-1.2 4.7.4L44 27.5 33 37.5c-1.1 1-2.8 1-3.9 0L16.5 24.5 17 17.5Z" fill="#134e4a"/>
|
||||||
|
<path d="M27.5 32 38 21.5c1.3-1.3 3.4-1.2 4.6.2L50 29.5l-2.6 2.6L40 25.5 31 34c-1 1-2.8 1-3.8-.1l-.7-.9Z" fill="#ecfdf5"/>
|
||||||
|
<rect x="42" y="16" width="8" height="32" rx="4" fill="#134e4a"/>
|
||||||
|
<path d="M41 17.5c1.3-1.4 3.5-1.3 4.7.2l1.6 1.8-7 6.6-2.1-2c-1.2-1.1-.9-3.2 2.8-6.6Z" fill="#ecfdf5"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 685 B After Width: | Height: | Size: 888 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,18 +6,24 @@ withDefaults(
|
|||||||
showBubble?: boolean;
|
showBubble?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
size: 148,
|
size: 170,
|
||||||
bubble: 'من دستیار فروش هوشمند سیستم هستم',
|
bubble: 'من دستیار هوشمند\nسیستم هستم 👋',
|
||||||
showBubble: true,
|
showBubble: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="ai-avatar" :style="{ width: `${size}px` }">
|
<div class="mento-bot" :style="{ '--bot-size': `${size}px` }">
|
||||||
<div v-if="showBubble" class="bubble">{{ bubble }}</div>
|
<div v-if="showBubble" class="popup">
|
||||||
|
<span>من دستیار هوشمند</span>
|
||||||
|
<span>سیستم هستم 👋</span>
|
||||||
|
<svg class="tail" viewBox="0 0 10 14" aria-hidden="true">
|
||||||
|
<path d="M10 0 L0 7 L10 14 Z" fill="#fff" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
<img
|
<img
|
||||||
class="img"
|
class="bot-img"
|
||||||
src="/brand/mento-ai-avatar.png"
|
src="/brand/mento-ai-avatar.png"
|
||||||
alt="دستیار هوشمند منتو"
|
alt="دستیار هوشمند منتو"
|
||||||
:width="size"
|
:width="size"
|
||||||
@@ -27,32 +33,60 @@ withDefaults(
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.ai-avatar {
|
.mento-bot {
|
||||||
display: grid;
|
position: relative;
|
||||||
justify-items: center;
|
width: var(--bot-size);
|
||||||
gap: 0.4rem;
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: center;
|
||||||
|
overflow: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bubble {
|
.bot-img {
|
||||||
max-width: 170px;
|
width: var(--bot-size);
|
||||||
padding: 0.55rem 0.75rem;
|
|
||||||
border-radius: 16px 16px 4px 16px;
|
|
||||||
background: rgba(255, 255, 255, 0.18);
|
|
||||||
backdrop-filter: blur(8px);
|
|
||||||
color: #fff;
|
|
||||||
font-size: 0.78rem;
|
|
||||||
line-height: 1.45;
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.18);
|
|
||||||
}
|
|
||||||
|
|
||||||
.img {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
/* soft presence without rectangular plate */
|
filter: drop-shadow(0 10px 22px rgba(34, 211, 238, 0.45));
|
||||||
filter: drop-shadow(0 10px 18px rgba(14, 165, 233, 0.28));
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup {
|
||||||
|
position: absolute;
|
||||||
|
/* کمی پایینتر نسبت به بالای ربات */
|
||||||
|
top: 1.1rem;
|
||||||
|
left: calc(100% + 6px);
|
||||||
|
z-index: 2;
|
||||||
|
width: max-content;
|
||||||
|
max-width: 118px;
|
||||||
|
padding: 0.48rem 0.65rem 0.55rem;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #fff;
|
||||||
|
color: #0f172a;
|
||||||
|
font-size: 0.68rem;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-align: right;
|
||||||
|
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
|
||||||
|
display: grid;
|
||||||
|
gap: 0.06rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup span {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* فلش روی ضلع چپ، کمی پایینتر از وسط */
|
||||||
|
.tail {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 62%;
|
||||||
|
width: 10px;
|
||||||
|
height: 14px;
|
||||||
|
transform: translate(-100%, -50%);
|
||||||
|
filter: drop-shadow(-1px 1px 1px rgba(15, 23, 42, 0.08));
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -15,21 +15,25 @@ withDefaults(
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="mento-logo" :class="variant">
|
<div class="mento-logo" :class="variant">
|
||||||
<span class="mark" :style="{ width: `${size}px`, height: `${size}px` }" aria-hidden="true">
|
<span
|
||||||
|
class="mark"
|
||||||
|
:style="{ width: `${size}px`, height: `${size}px`, borderRadius: `${Math.round(size * 0.3)}px` }"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
<svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<rect x="8" y="12" width="10" height="40" rx="5" fill="#2EB29B" />
|
<rect x="14" y="16" width="8" height="32" rx="4" fill="#fff" />
|
||||||
<path
|
<path
|
||||||
d="M12 13c1.3-2.1 4.4-2.4 6.1-.6L34 28l5.4-5.1c1.7-1.6 4.5-1.4 5.9.5L47 26.2 33.6 39.3c-1.3 1.3-3.4 1.3-4.7 0L10.5 21.2 12 13Z"
|
d="M17 17.5c1-1.6 3.5-1.8 4.8-.5L36 30l4.3-4c1.4-1.3 3.6-1.2 4.7.4L44 27.5 33 37.5c-1.1 1-2.8 1-3.9 0L16.5 24.5 17 17.5Z"
|
||||||
fill="#134E4A"
|
fill="#134e4a"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
d="M25.2 30.8 37.5 18.8c1.6-1.6 4.3-1.5 5.8.2L55 32.1l-3.2 3.3L41 25.3 30.2 35.8c-1.3 1.3-3.5 1.2-4.7-.1l-.3-.3Z"
|
d="M27.5 32 38 21.5c1.3-1.3 3.4-1.2 4.6.2L50 29.5l-2.6 2.6L40 25.5 31 34c-1 1-2.8 1-3.8-.1l-.7-.9Z"
|
||||||
fill="#2EB29B"
|
fill="#ecfdf5"
|
||||||
/>
|
/>
|
||||||
<rect x="46" y="12" width="10" height="40" rx="5" fill="#134E4A" />
|
<rect x="42" y="16" width="8" height="32" rx="4" fill="#134e4a" />
|
||||||
<path
|
<path
|
||||||
d="M44.8 13.2c1.6-1.7 4.4-1.6 5.9.2l2 2.2-8.7 8.3-2.6-2.5c-1.5-1.4-1.1-4 3.4-8.2Z"
|
d="M41 17.5c1.3-1.4 3.5-1.3 4.7.2l1.6 1.8-7 6.6-2.1-2c-1.2-1.1-.9-3.2 2.8-6.6Z"
|
||||||
fill="#2EB29B"
|
fill="#ecfdf5"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
@@ -52,7 +56,11 @@ withDefaults(
|
|||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
background: transparent;
|
background: linear-gradient(145deg, #5eead4, #14b8a6);
|
||||||
|
box-shadow: 0 8px 18px rgba(20, 184, 166, 0.28);
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mark svg {
|
.mark svg {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const emit = defineEmits<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const shortcuts = [
|
const shortcuts = [
|
||||||
{ label: 'خلاصه مشتری شرکت آریانا را بده', to: '/contacts', icon: 'users' as const },
|
{ label: 'خلاصه مشتری شرکت آریا را بده', to: '/contacts', icon: 'users' as const },
|
||||||
{ label: 'متن پیگیری برای مشتری بفرست', to: '/notes', icon: 'send' as const },
|
{ label: 'متن پیگیری برای مشتری بفرست', to: '/notes', icon: 'send' as const },
|
||||||
{ label: 'گزارش فروش این هفته را نشان بده', to: '/reports', icon: 'chart' as const },
|
{ label: 'گزارش فروش این هفته را نشان بده', to: '/reports', icon: 'chart' as const },
|
||||||
{ label: 'معاملات در خطر را لیست کن', to: '/pipeline', icon: 'warning' as const },
|
{ label: 'معاملات در خطر را لیست کن', to: '/pipeline', icon: 'warning' as const },
|
||||||
@@ -20,10 +20,10 @@ const shortcuts = [
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<article class="panel ai-panel">
|
<article class="panel">
|
||||||
<header class="panel-head">
|
<header class="panel-head">
|
||||||
<h2>
|
<h2>
|
||||||
<UiIcon name="sparkle" :size="16" />
|
<span class="spark"><UiIcon name="sparkle" :size="15" /></span>
|
||||||
دستیار هوشمند منتو
|
دستیار هوشمند منتو
|
||||||
</h2>
|
</h2>
|
||||||
</header>
|
</header>
|
||||||
@@ -31,13 +31,8 @@ const shortcuts = [
|
|||||||
<p class="ai-lead">چه کمکی میتونم بکنم؟</p>
|
<p class="ai-lead">چه کمکی میتونم بکنم؟</p>
|
||||||
|
|
||||||
<div class="ai-shortcuts">
|
<div class="ai-shortcuts">
|
||||||
<RouterLink
|
<RouterLink v-for="item in shortcuts" :key="item.label" class="ai-chip" :to="item.to">
|
||||||
v-for="item in shortcuts"
|
<span class="chip-ico"><UiIcon :name="item.icon" :size="14" /></span>
|
||||||
:key="item.label"
|
|
||||||
class="ai-chip"
|
|
||||||
:to="item.to"
|
|
||||||
>
|
|
||||||
<span class="chip-ico"><UiIcon :name="item.icon" :size="15" /></span>
|
|
||||||
<span>{{ item.label }}</span>
|
<span>{{ item.label }}</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
@@ -50,7 +45,7 @@ const shortcuts = [
|
|||||||
@input="emit('update:askQuery', ($event.target as HTMLInputElement).value)"
|
@input="emit('update:askQuery', ($event.target as HTMLInputElement).value)"
|
||||||
/>
|
/>
|
||||||
<button type="submit" aria-label="ارسال">
|
<button type="submit" aria-label="ارسال">
|
||||||
<UiIcon name="send" :size="16" />
|
<UiIcon name="send" :size="15" />
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</article>
|
</article>
|
||||||
@@ -59,8 +54,8 @@ const shortcuts = [
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.panel {
|
.panel {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 22px;
|
border-radius: 20px;
|
||||||
padding: 1.05rem 1.1rem;
|
padding: 1rem 1rem 0.95rem;
|
||||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
border: 1px solid #eef2f7;
|
border: 1px solid #eef2f7;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
@@ -74,49 +69,60 @@ const shortcuts = [
|
|||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.98rem;
|
font-size: 0.92rem;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.35rem;
|
gap: 0.4rem;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spark {
|
||||||
|
color: #eab308;
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
.ai-lead {
|
.ai-lead {
|
||||||
margin: 0 0 0.85rem;
|
margin: 0 0 0.75rem;
|
||||||
color: #94a3b8;
|
padding: 0.55rem 0.75rem;
|
||||||
font-size: 0.88rem;
|
width: fit-content;
|
||||||
|
max-width: 100%;
|
||||||
|
background: #d1fae5;
|
||||||
|
color: #115e59;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 14px 14px 4px 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-shortcuts {
|
.ai-shortcuts {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.45rem;
|
gap: 0.4rem;
|
||||||
margin-bottom: 0.95rem;
|
margin-bottom: 0.8rem;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-chip {
|
.ai-chip {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.6rem;
|
gap: 0.55rem;
|
||||||
padding: 0.7rem 0.8rem;
|
padding: 0.58rem 0.7rem;
|
||||||
border-radius: 14px;
|
border-radius: 12px;
|
||||||
background: #f8fafc;
|
background: #fff;
|
||||||
border: 1px solid #eef2f7;
|
border: 1px solid #eef2f7;
|
||||||
color: #334155;
|
color: #334155;
|
||||||
font-size: 0.8rem;
|
font-size: 0.76rem;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: background 0.15s ease, border-color 0.15s ease;
|
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-chip:hover {
|
.ai-chip:hover {
|
||||||
background: #ecfdf8;
|
background: #f0fdfa;
|
||||||
border-color: #99f6e4;
|
border-color: #99f6e4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chip-ico {
|
.chip-ico {
|
||||||
width: 28px;
|
width: 26px;
|
||||||
height: 28px;
|
height: 26px;
|
||||||
border-radius: 10px;
|
border-radius: 8px;
|
||||||
background: #ecfdf8;
|
background: #ecfdf8;
|
||||||
color: #14b8a6;
|
color: #14b8a6;
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -126,22 +132,23 @@ h2 {
|
|||||||
|
|
||||||
.ai-input {
|
.ai-input {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.45rem;
|
gap: 0.4rem;
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-input input {
|
.ai-input input {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border: 1px solid #e2e8f0;
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 14px;
|
border-radius: 12px;
|
||||||
padding: 0.7rem 0.85rem;
|
padding: 0.58rem 0.75rem;
|
||||||
background: #f8fafc;
|
background: #f8fafc;
|
||||||
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-input button {
|
.ai-input button {
|
||||||
width: 44px;
|
width: 40px;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 14px;
|
border-radius: 12px;
|
||||||
background: #14b8a6;
|
background: #14b8a6;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
import { RouterLink } from 'vue-router';
|
import { RouterLink } from 'vue-router';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
import MentoAiAvatar from '@/components/brand/MentoAiAvatar.vue';
|
import MentoAiAvatar from '@/components/brand/MentoAiAvatar.vue';
|
||||||
import type { HomeDashboardAlertDto } from '@mento/shared';
|
import type { HomeDashboardAlertDto } from '@mento/shared';
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
greeting: string;
|
greeting: string;
|
||||||
firstName: string;
|
firstName: string;
|
||||||
userInitial: string;
|
userInitial: string;
|
||||||
@@ -17,6 +18,56 @@ const emit = defineEmits<{
|
|||||||
ask: [];
|
ask: [];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
type HeroChip = {
|
||||||
|
key: string;
|
||||||
|
tone: HomeDashboardAlertDto['tone'];
|
||||||
|
title: string;
|
||||||
|
subtitle?: string;
|
||||||
|
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 parts = a.text.split(/\s*[—\-–]\s*|\n/);
|
||||||
|
const title = parts[0]?.trim() || a.text;
|
||||||
|
const subtitle = parts.slice(1).join(' ').trim() || undefined;
|
||||||
|
return {
|
||||||
|
key: a.key,
|
||||||
|
tone: a.tone,
|
||||||
|
title,
|
||||||
|
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) {
|
function alertIcon(tone: string) {
|
||||||
if (tone === 'urgent') return 'fire' as const;
|
if (tone === 'urgent') return 'fire' as const;
|
||||||
if (tone === 'warning') return 'warning' as const;
|
if (tone === 'warning') return 'warning' as const;
|
||||||
@@ -27,43 +78,41 @@ function alertIcon(tone: string) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<header class="hero">
|
<header class="hero">
|
||||||
<div class="hero-pattern" aria-hidden="true" />
|
<div class="hero-surface" aria-hidden="true">
|
||||||
<div class="hero-glow a" />
|
<div class="hero-glow" />
|
||||||
<div class="hero-glow b" />
|
<div class="hero-mist" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="hero-body">
|
<div class="hero-body">
|
||||||
<div class="hero-top">
|
<div class="hero-greet">
|
||||||
<div class="hero-greet">
|
<span class="hero-avatar">
|
||||||
<span class="hero-avatar">
|
<img src="/brand/user-avatar.png" :alt="firstName" width="72" height="72" />
|
||||||
{{ userInitial }}
|
<i class="online" />
|
||||||
<i class="online" />
|
</span>
|
||||||
</span>
|
<div class="greet-text">
|
||||||
<div>
|
<h1>{{ greeting }} {{ firstName }} 👋</h1>
|
||||||
<h1>{{ greeting }} {{ firstName }}</h1>
|
<p>منتو اینا رو برات پیدا کرده</p>
|
||||||
<p>منتو اینها رو برات پیدا کرده</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="hero-chips">
|
|
||||||
<RouterLink
|
|
||||||
v-for="alert in alerts.slice(0, 3)"
|
|
||||||
:key="alert.key"
|
|
||||||
class="chip"
|
|
||||||
:class="`chip-${alert.tone}`"
|
|
||||||
:to="alert.link || '/'"
|
|
||||||
>
|
|
||||||
<span class="chip-ico"><UiIcon :name="alertIcon(alert.tone)" :size="14" /></span>
|
|
||||||
<span>{{ alert.text }}</span>
|
|
||||||
</RouterLink>
|
|
||||||
<span v-if="!alerts.length" class="chip chip-success">
|
|
||||||
<span class="chip-ico"><UiIcon name="trend" :size="14" /></span>
|
|
||||||
امروز آمادهاید برای فروش بیشتر
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="hero-chips">
|
||||||
|
<RouterLink
|
||||||
|
v-for="chip in chips"
|
||||||
|
:key="chip.key"
|
||||||
|
class="chip"
|
||||||
|
:class="`chip-${chip.tone}`"
|
||||||
|
:to="chip.link"
|
||||||
|
>
|
||||||
|
<span class="chip-ico"><UiIcon :name="alertIcon(chip.tone)" :size="13" /></span>
|
||||||
|
<span class="chip-text">
|
||||||
|
<strong>{{ chip.title }}</strong>
|
||||||
|
<small v-if="chip.subtitle">{{ chip.subtitle }}</small>
|
||||||
|
</span>
|
||||||
|
</RouterLink>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form class="hero-ask" @submit.prevent="emit('ask')">
|
<form class="hero-ask" @submit.prevent="emit('ask')">
|
||||||
<UiIcon name="sparkle" :size="16" />
|
<UiIcon name="sparkle" :size="18" class="ask-ico" />
|
||||||
<input
|
<input
|
||||||
:value="askQuery"
|
:value="askQuery"
|
||||||
type="search"
|
type="search"
|
||||||
@@ -74,7 +123,7 @@ function alertIcon(tone: string) {
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MentoAiAvatar class="hero-bot" :size="168" />
|
<MentoAiAvatar class="hero-bot" :size="156" />
|
||||||
</header>
|
</header>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -82,130 +131,184 @@ function alertIcon(tone: string) {
|
|||||||
.hero {
|
.hero {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.7fr);
|
/* RTL: body سمت راست، ربات سمت چپ — فضای اضافه برای پاپآپ */
|
||||||
gap: 0.5rem 1rem;
|
grid-template-columns: minmax(0, 1fr) 210px;
|
||||||
align-items: center;
|
gap: 0.7rem 1rem;
|
||||||
min-height: 210px;
|
align-items: start;
|
||||||
padding: 1.4rem 1.5rem 1.35rem;
|
min-height: 0;
|
||||||
|
padding: 0.8rem 1.5rem 0.9rem;
|
||||||
border-radius: 28px;
|
border-radius: 28px;
|
||||||
overflow: hidden;
|
overflow: visible;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: linear-gradient(105deg, #4fd1c5 0%, #14b8a6 24%, #0f766e 52%, #123a5c 100%);
|
background: transparent;
|
||||||
box-shadow: 0 18px 40px rgba(15, 118, 110, 0.22);
|
isolation: isolate;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-pattern {
|
.hero-surface {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
opacity: 0.12;
|
z-index: 0;
|
||||||
|
border-radius: 28px;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #134e4a;
|
||||||
background-image:
|
background-image:
|
||||||
radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 0 2px, transparent 3px),
|
radial-gradient(ellipse 55% 90% at 8% 55%, rgba(103, 232, 249, 0.55) 0%, rgba(45, 212, 191, 0.22) 35%, transparent 68%),
|
||||||
radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.25) 0 1.5px, transparent 2.5px);
|
radial-gradient(ellipse 50% 80% at 92% 40%, rgba(153, 246, 228, 0.28) 0%, transparent 55%),
|
||||||
background-size: 28px 28px, 18px 18px;
|
radial-gradient(ellipse 70% 60% at 45% 30%, rgba(45, 212, 191, 0.18) 0%, transparent 60%),
|
||||||
pointer-events: none;
|
radial-gradient(ellipse 60% 50% at 60% 85%, rgba(15, 23, 42, 0.28) 0%, transparent 55%),
|
||||||
|
linear-gradient(
|
||||||
|
105deg,
|
||||||
|
#0b3d3a 0%,
|
||||||
|
#115e59 22%,
|
||||||
|
#0f766e 48%,
|
||||||
|
#134e4a 72%,
|
||||||
|
#0f3f3c 100%
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
0 16px 36px rgba(15, 118, 110, 0.22),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.18),
|
||||||
|
inset 0 0 0 1px rgba(255, 255, 255, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-glow {
|
.hero-glow {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
width: 320px;
|
||||||
|
height: 320px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: rgba(255, 255, 255, 0.1);
|
inset-inline-end: -70px;
|
||||||
|
top: 40%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background:
|
||||||
|
radial-gradient(circle, rgba(165, 243, 252, 0.65) 0%, rgba(34, 211, 238, 0.28) 32%, transparent 68%);
|
||||||
|
filter: blur(8px);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-glow.a {
|
.hero-mist {
|
||||||
width: 220px;
|
position: absolute;
|
||||||
height: 220px;
|
inset: 0;
|
||||||
top: -90px;
|
background:
|
||||||
inset-inline-end: 160px;
|
radial-gradient(ellipse 40% 35% at 25% 20%, rgba(255, 255, 255, 0.14) 0%, transparent 70%),
|
||||||
|
radial-gradient(ellipse 35% 40% at 70% 75%, rgba(204, 251, 241, 0.12) 0%, transparent 70%),
|
||||||
|
radial-gradient(ellipse 50% 45% at 50% 50%, rgba(15, 118, 110, 0.35) 0%, transparent 75%);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-glow.b {
|
.hero-body,
|
||||||
width: 140px;
|
.hero-bot {
|
||||||
height: 140px;
|
position: relative;
|
||||||
bottom: -55px;
|
z-index: 1;
|
||||||
inset-inline-start: 30px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-body {
|
.hero-body {
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1rem;
|
gap: 0.75rem;
|
||||||
}
|
min-width: 0;
|
||||||
|
padding-top: 0;
|
||||||
.hero-top {
|
|
||||||
display: grid;
|
|
||||||
gap: 0.85rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-greet {
|
.hero-greet {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.85rem;
|
gap: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-avatar {
|
.hero-avatar {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 52px;
|
width: 72px;
|
||||||
height: 52px;
|
height: 72px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: rgba(255, 255, 255, 0.22);
|
|
||||||
border: 2px solid rgba(255, 255, 255, 0.45);
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
font-weight: 800;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-avatar img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 3px solid rgba(255, 255, 255, 0.65);
|
||||||
|
background: rgba(255, 255, 255, 0.22);
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.online {
|
.online {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 2px;
|
bottom: 3px;
|
||||||
inset-inline-start: 2px;
|
inset-inline-start: 3px;
|
||||||
width: 10px;
|
width: 14px;
|
||||||
height: 10px;
|
height: 14px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: #22c55e;
|
background: #22c55e;
|
||||||
border: 2px solid #fff;
|
border: 2px solid #fff;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
.greet-text h1 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: clamp(1.4rem, 2.2vw, 1.8rem);
|
font-size: clamp(1.35rem, 2vw, 1.75rem);
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
.greet-text p {
|
||||||
margin: 0.2rem 0 0;
|
margin: 0.25rem 0 0;
|
||||||
opacity: 0.9;
|
color: rgba(255, 255, 255, 0.88);
|
||||||
font-size: 0.92rem;
|
font-size: 0.9rem;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-chips {
|
.hero-chips {
|
||||||
display: flex;
|
display: grid;
|
||||||
flex-wrap: wrap;
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
gap: 0.5rem;
|
gap: 0.4rem;
|
||||||
|
max-width: 580px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chip {
|
.chip {
|
||||||
display: inline-flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.4rem;
|
gap: 0.4rem;
|
||||||
max-width: 100%;
|
min-width: 0;
|
||||||
padding: 0.48rem 0.75rem;
|
padding: 0.4rem 0.5rem;
|
||||||
border-radius: 999px;
|
border-radius: 12px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
font-size: 0.78rem;
|
|
||||||
font-weight: 600;
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
|
box-shadow: 0 6px 14px rgba(15, 23, 42, 0.07);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip-text {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.04rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip-text strong {
|
||||||
|
font-size: 0.68rem;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.3;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip-text small {
|
||||||
|
font-size: 0.6rem;
|
||||||
|
color: #64748b;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.25;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chip-ico {
|
.chip-ico {
|
||||||
width: 22px;
|
width: 22px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
border-radius: 999px;
|
border-radius: 8px;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@@ -231,38 +334,69 @@ p {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.55rem;
|
gap: 0.55rem;
|
||||||
max-width: 440px;
|
max-width: 520px;
|
||||||
background: rgba(255, 255, 255, 0.96);
|
width: 100%;
|
||||||
|
background: #fff;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
padding: 0.58rem 0.9rem;
|
padding: 0.55rem 0.9rem;
|
||||||
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
|
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ask-ico {
|
||||||
|
color: #14b8a6;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.hero-ask input {
|
.hero-ask input {
|
||||||
border: 0;
|
border: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
outline: none;
|
outline: none;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-ask input::placeholder {
|
||||||
|
color: #94a3b8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-ask kbd {
|
.hero-ask kbd {
|
||||||
font-size: 0.68rem;
|
font-size: 0.68rem;
|
||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
|
background: #f1f5f9;
|
||||||
border: 1px solid #e2e8f0;
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
padding: 0.12rem 0.35rem;
|
padding: 0.14rem 0.38rem;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-bot {
|
.hero-bot {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
/* در RTL ستون ربات سمت چپ است؛ end = لبه بیرونی چپ */
|
||||||
|
justify-self: end;
|
||||||
|
align-self: center;
|
||||||
|
margin-inline-start: 0;
|
||||||
|
margin-inline-end: 0.35rem;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.hero {
|
||||||
|
grid-template-columns: minmax(0, 1fr) 160px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-chips {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
max-width: 420px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
.hero {
|
.hero {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
min-height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-bot {
|
.hero-bot {
|
||||||
|
|||||||
@@ -15,12 +15,19 @@ const icons: Record<string, 'calendar' | 'users' | 'briefcase' | 'check'> = {
|
|||||||
'open-deals': 'briefcase',
|
'open-deals': 'briefcase',
|
||||||
followups: 'check',
|
followups: 'check',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const iconTones: Record<string, string> = {
|
||||||
|
sales: '#14b8a6',
|
||||||
|
customers: '#38bdf8',
|
||||||
|
'open-deals': '#fb923c',
|
||||||
|
followups: '#a78bfa',
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="kpi-row">
|
<div class="kpi-row">
|
||||||
<article v-for="kpi in kpis" :key="kpi.key" class="kpi-card">
|
<article v-for="kpi in kpis" :key="kpi.key" class="kpi-card">
|
||||||
<div class="kpi-icon">
|
<div class="kpi-icon" :style="{ color: iconTones[kpi.key] ?? '#14b8a6' }">
|
||||||
<UiIcon :name="icons[kpi.key] ?? 'chart'" :size="20" />
|
<UiIcon :name="icons[kpi.key] ?? 'chart'" :size="20" />
|
||||||
</div>
|
</div>
|
||||||
<div class="kpi-text">
|
<div class="kpi-text">
|
||||||
@@ -31,6 +38,7 @@ const icons: Record<string, 'calendar' | 'users' | 'briefcase' | 'check'> = {
|
|||||||
class="kpi-change"
|
class="kpi-change"
|
||||||
:class="{ down: kpi.changePercent < 0 }"
|
:class="{ down: kpi.changePercent < 0 }"
|
||||||
>
|
>
|
||||||
|
<span class="arrow">{{ kpi.changePercent >= 0 ? '↑' : '↓' }}</span>
|
||||||
{{ formatChange(kpi.changePercent) }} {{ kpi.changeLabel }}
|
{{ formatChange(kpi.changePercent) }} {{ kpi.changeLabel }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -60,8 +68,7 @@ const icons: Record<string, 'calendar' | 'users' | 'briefcase' | 'check'> = {
|
|||||||
width: 48px;
|
width: 48px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
background: #ecfdf8;
|
background: #f8fafc;
|
||||||
color: #14b8a6;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@@ -82,7 +89,9 @@ const icons: Record<string, 'calendar' | 'users' | 'briefcase' | 'check'> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.kpi-change {
|
.kpi-change {
|
||||||
display: inline-block;
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.2rem;
|
||||||
margin-top: 0.45rem;
|
margin-top: 0.45rem;
|
||||||
padding: 0.18rem 0.5rem;
|
padding: 0.18rem 0.5rem;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
@@ -92,6 +101,11 @@ const icons: Record<string, 'calendar' | 'users' | 'briefcase' | 'check'> = {
|
|||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
font-size: 0.82rem;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.kpi-change.down {
|
.kpi-change.down {
|
||||||
background: #fee2e2;
|
background: #fee2e2;
|
||||||
color: #dc2626;
|
color: #dc2626;
|
||||||
|
|||||||
@@ -9,49 +9,100 @@ const props = defineProps<{
|
|||||||
formatMoney: (amount: number, currency: string) => string;
|
formatMoney: (amount: number, currency: string) => string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const stages = computed(() => props.board?.stages.slice(0, 3) ?? []);
|
type Card = { id: string; name: string; amount: string; when: string };
|
||||||
|
type Col = { id: string; name: string; count: number; cards: Card[] };
|
||||||
|
|
||||||
|
const demoCols: Col[] = [
|
||||||
|
{
|
||||||
|
id: 'p1',
|
||||||
|
name: 'پیشنهاد قیمت',
|
||||||
|
count: 4,
|
||||||
|
cards: [{ id: 'a', name: 'شرکت سایپا', amount: '۳۴۰٬۰۰۰٬۰۰۰ تومان', when: 'امروز' }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'p2',
|
||||||
|
name: 'نیازسنجی',
|
||||||
|
count: 6,
|
||||||
|
cards: [
|
||||||
|
{ id: 'b', name: 'آریا تجارت', amount: '۳۶۰٬۰۰۰٬۰۰۰ تومان', when: 'دیروز' },
|
||||||
|
{ id: 'c', name: 'فناوران نوین', amount: '۱۸۰٬۰۰۰٬۰۰۰ تومان', when: 'دیروز' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'p3',
|
||||||
|
name: 'سرنخ جدید',
|
||||||
|
count: 8,
|
||||||
|
cards: [
|
||||||
|
{ id: 'd', name: 'شرکت نیکان', amount: '۸۰٬۰۰۰٬۰۰۰ تومان', when: 'امروز' },
|
||||||
|
{ id: 'e', name: 'گروه پارسیان', amount: '۱۲۰٬۰۰۰٬۰۰۰ تومان', when: 'دیروز' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
function relativeWhen(iso: string | null | undefined) {
|
||||||
|
if (!iso) return '';
|
||||||
|
const diff = Date.now() - new Date(iso).getTime();
|
||||||
|
const days = Math.floor(diff / 86400000);
|
||||||
|
if (days <= 0) return 'امروز';
|
||||||
|
if (days === 1) return 'دیروز';
|
||||||
|
return `${toFaDigits(days)} روز پیش`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cols = computed<Col[]>(() => {
|
||||||
|
const stages = props.board?.stages.slice(0, 3) ?? [];
|
||||||
|
const hasDeals = stages.some((s) => s.deals.length);
|
||||||
|
if (!stages.length || !hasDeals) return demoCols;
|
||||||
|
return stages.map((stage) => ({
|
||||||
|
id: stage.id,
|
||||||
|
name: stage.name,
|
||||||
|
count: stage.deals.length,
|
||||||
|
cards: stage.deals.slice(0, 2).map((deal) => ({
|
||||||
|
id: deal.id,
|
||||||
|
name: deal.company?.name || deal.person?.fullName || deal.title,
|
||||||
|
amount: deal.amount ? props.formatMoney(deal.amount, deal.currency) : '',
|
||||||
|
when: relativeWhen(deal.updatedAt || deal.createdAt),
|
||||||
|
})),
|
||||||
|
}));
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<article class="panel">
|
<article class="panel">
|
||||||
<header class="panel-head">
|
<header class="panel-head">
|
||||||
<h2>جریان فروش</h2>
|
<h2>جریان فروش</h2>
|
||||||
<RouterLink :to="{ name: 'pipeline' }">کاریز کامل</RouterLink>
|
<RouterLink :to="{ name: 'pipeline' }">نمایش همه</RouterLink>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div v-if="stages.length" class="mini-pipeline">
|
<div class="mini-pipeline">
|
||||||
<div v-for="stage in stages" :key="stage.id" class="pipe-col">
|
<div v-for="col in cols" :key="col.id" class="pipe-col">
|
||||||
<header>
|
<header>
|
||||||
<strong>{{ stage.name }}</strong>
|
<strong>{{ col.name }} ({{ toFaDigits(col.count) }})</strong>
|
||||||
<span>{{ toFaDigits(stage.deals.length) }}</span>
|
|
||||||
</header>
|
</header>
|
||||||
<div class="pipe-cards">
|
<div class="pipe-cards">
|
||||||
<RouterLink
|
<RouterLink
|
||||||
v-for="deal in stage.deals.slice(0, 3)"
|
v-for="card in col.cards"
|
||||||
:key="deal.id"
|
:key="card.id"
|
||||||
class="pipe-card"
|
class="pipe-card"
|
||||||
:to="{ name: 'deal-detail', params: { id: deal.id } }"
|
:to="card.id.length > 4 ? { name: 'deal-detail', params: { id: card.id } } : { name: 'pipeline' }"
|
||||||
>
|
>
|
||||||
<span class="deal-mark">
|
<span class="deal-mark">{{ card.name.slice(0, 1) }}</span>
|
||||||
{{ (deal.company?.name || deal.person?.fullName || deal.title).slice(0, 1) }}
|
|
||||||
</span>
|
|
||||||
<div>
|
<div>
|
||||||
<strong>{{ deal.company?.name || deal.person?.fullName || deal.title }}</strong>
|
<strong>{{ card.name }}</strong>
|
||||||
<span v-if="deal.amount">{{ formatMoney(deal.amount, deal.currency) }}</span>
|
<span v-if="card.amount">{{ card.amount }}</span>
|
||||||
|
<em>{{ card.when }}</em>
|
||||||
</div>
|
</div>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p v-else class="muted">کاریزی برای نمایش نیست.</p>
|
|
||||||
</article>
|
</article>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.panel {
|
.panel {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 22px;
|
border-radius: 20px;
|
||||||
padding: 1.05rem 1.1rem;
|
padding: 1rem 1.05rem;
|
||||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
border: 1px solid #eef2f7;
|
border: 1px solid #eef2f7;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
@@ -62,65 +113,54 @@ const stages = computed(() => props.board?.stages.slice(0, 3) ?? []);
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
margin-bottom: 0.85rem;
|
margin-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.98rem;
|
font-size: 0.95rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #14b8a6;
|
color: #14b8a6;
|
||||||
font-size: 0.82rem;
|
font-size: 0.8rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mini-pipeline {
|
.mini-pipeline {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, minmax(140px, 1fr));
|
grid-template-columns: repeat(3, minmax(120px, 1fr));
|
||||||
gap: 0.75rem;
|
gap: 0.65rem;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pipe-col > header {
|
.pipe-col > header {
|
||||||
display: flex;
|
margin-bottom: 0.5rem;
|
||||||
justify-content: space-between;
|
font-size: 0.78rem;
|
||||||
gap: 0.5rem;
|
|
||||||
margin-bottom: 0.55rem;
|
|
||||||
font-size: 0.82rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pipe-col > header span {
|
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
background: #f1f5f9;
|
|
||||||
border-radius: 999px;
|
|
||||||
padding: 0.05rem 0.45rem;
|
|
||||||
font-size: 0.72rem;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pipe-cards {
|
.pipe-cards {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.45rem;
|
gap: 0.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pipe-card {
|
.pipe-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.55rem;
|
gap: 0.5rem;
|
||||||
padding: 0.65rem 0.7rem;
|
padding: 0.55rem 0.6rem;
|
||||||
border-radius: 14px;
|
border-radius: 12px;
|
||||||
background: #f8fafc;
|
background: #f8fafc;
|
||||||
border: 1px solid #eef2f7;
|
border: 1px solid #eef2f7;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
font-size: 0.8rem;
|
font-size: 0.78rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pipe-card div {
|
.pipe-card div {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.12rem;
|
gap: 0.1rem;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,17 +168,24 @@ a {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
font-size: 0.78rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pipe-card span {
|
.pipe-card span {
|
||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
font-size: 0.72rem;
|
font-size: 0.68rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe-card em {
|
||||||
|
color: #cbd5e1;
|
||||||
|
font-size: 0.66rem;
|
||||||
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.deal-mark {
|
.deal-mark {
|
||||||
width: 30px;
|
width: 28px;
|
||||||
height: 30px;
|
height: 28px;
|
||||||
border-radius: 10px;
|
border-radius: 8px;
|
||||||
background: #ecfdf8;
|
background: #ecfdf8;
|
||||||
color: #0f766e;
|
color: #0f766e;
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -147,10 +194,6 @@ a {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.muted {
|
|
||||||
color: #94a3b8;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
.mini-pipeline {
|
.mini-pipeline {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
|||||||
@@ -1,13 +1,50 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
import { RouterLink } from 'vue-router';
|
import { RouterLink } from 'vue-router';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
import type { ActivityDto } from '@mento/shared';
|
import type { ActivityDto } from '@mento/shared';
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
activities: ActivityDto[];
|
activities: ActivityDto[];
|
||||||
formatWhen: (value: string | null) => string;
|
formatWhen: (value: string | null) => string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
type Row = {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
when: string;
|
||||||
|
type: string;
|
||||||
|
tone: 'done' | 'pending' | 'held' | 'late';
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const demoRows: Row[] = [
|
||||||
|
{
|
||||||
|
id: 'd1',
|
||||||
|
title: 'تماس با شرکت آریا',
|
||||||
|
when: 'امروز، ۱۰:۴۵',
|
||||||
|
type: 'call',
|
||||||
|
tone: 'done',
|
||||||
|
label: 'انجام شد',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'd2',
|
||||||
|
title: 'ارسال پیشنهاد قیمت به پارسیان',
|
||||||
|
when: 'دیروز، ۱۴:۴۰',
|
||||||
|
type: 'mail',
|
||||||
|
tone: 'pending',
|
||||||
|
label: 'در انتظار پاسخ',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'd3',
|
||||||
|
title: 'جلسه با مشتری جدید',
|
||||||
|
when: 'پریروز، ۱۱:۰۰',
|
||||||
|
type: 'meeting',
|
||||||
|
tone: 'held',
|
||||||
|
label: 'برگزار شد',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const typeLabel: Record<string, string> = {
|
const typeLabel: Record<string, string> = {
|
||||||
call: 'تماس',
|
call: 'تماس',
|
||||||
meeting: 'جلسه',
|
meeting: 'جلسه',
|
||||||
@@ -16,11 +53,11 @@ const typeLabel: Record<string, string> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function activityStatus(act: ActivityDto) {
|
function activityStatus(act: ActivityDto) {
|
||||||
if (act.status === 'done') return { label: 'انجام شد', tone: 'done' };
|
if (act.status === 'done') return { label: 'انجام شد', tone: 'done' as const };
|
||||||
if (act.dueAt && new Date(act.dueAt) < new Date()) {
|
if (act.dueAt && new Date(act.dueAt) < new Date()) {
|
||||||
return { label: 'عقبافتاده', tone: 'late' };
|
return { label: 'عقبافتاده', tone: 'late' as const };
|
||||||
}
|
}
|
||||||
return { label: 'در انتظار پاسخ', tone: 'pending' };
|
return { label: 'در انتظار پاسخ', tone: 'pending' as const };
|
||||||
}
|
}
|
||||||
|
|
||||||
function activityIcon(type: string) {
|
function activityIcon(type: string) {
|
||||||
@@ -29,6 +66,21 @@ function activityIcon(type: string) {
|
|||||||
if (type === 'task') return 'check' as const;
|
if (type === 'task') return 'check' as const;
|
||||||
return 'mail' as const;
|
return 'mail' as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const rows = computed<Row[]>(() => {
|
||||||
|
if (!props.activities.length) return demoRows;
|
||||||
|
return props.activities.slice(0, 3).map((act) => {
|
||||||
|
const st = activityStatus(act);
|
||||||
|
return {
|
||||||
|
id: act.id,
|
||||||
|
title: act.title,
|
||||||
|
when: `${typeLabel[act.type] ?? act.type} · ${props.formatWhen(act.dueAt || act.createdAt)}`,
|
||||||
|
type: act.type,
|
||||||
|
tone: st.tone,
|
||||||
|
label: st.label,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -38,32 +90,26 @@ function activityIcon(type: string) {
|
|||||||
<RouterLink :to="{ name: 'activities' }">مشاهده همه</RouterLink>
|
<RouterLink :to="{ name: 'activities' }">مشاهده همه</RouterLink>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<ul v-if="activities.length" class="activity-list">
|
<ul class="activity-list">
|
||||||
<li v-for="act in activities" :key="act.id">
|
<li v-for="act in rows" :key="act.id">
|
||||||
<span class="act-icon">
|
<span class="act-icon">
|
||||||
<UiIcon :name="activityIcon(act.type)" :size="16" />
|
<UiIcon :name="activityIcon(act.type)" :size="16" />
|
||||||
</span>
|
</span>
|
||||||
<div class="act-body">
|
<div class="act-body">
|
||||||
<strong>{{ act.title }}</strong>
|
<strong>{{ act.title }}</strong>
|
||||||
<span>
|
<span>{{ act.when }}</span>
|
||||||
{{ typeLabel[act.type] ?? act.type }} ·
|
|
||||||
{{ formatWhen(act.dueAt || act.createdAt) }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<span class="status-pill" :class="activityStatus(act).tone">
|
<span class="status-pill" :class="act.tone">{{ act.label }}</span>
|
||||||
{{ activityStatus(act).label }}
|
|
||||||
</span>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p v-else class="muted">فعالیتی ثبت نشده.</p>
|
|
||||||
</article>
|
</article>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.panel {
|
.panel {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 22px;
|
border-radius: 20px;
|
||||||
padding: 1.05rem 1.1rem;
|
padding: 1rem 1.05rem;
|
||||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
border: 1px solid #eef2f7;
|
border: 1px solid #eef2f7;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
@@ -79,12 +125,12 @@ function activityIcon(type: string) {
|
|||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.98rem;
|
font-size: 0.95rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #14b8a6;
|
color: #14b8a6;
|
||||||
font-size: 0.82rem;
|
font-size: 0.8rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,19 +139,19 @@ a {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.75rem;
|
gap: 0.7rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-list li {
|
.activity-list li {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.7rem;
|
gap: 0.65rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.act-icon {
|
.act-icon {
|
||||||
width: 40px;
|
width: 38px;
|
||||||
height: 40px;
|
height: 38px;
|
||||||
border-radius: 14px;
|
border-radius: 12px;
|
||||||
background: #ecfdf8;
|
background: #ecfdf8;
|
||||||
color: #14b8a6;
|
color: #14b8a6;
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -117,27 +163,31 @@ a {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.15rem;
|
gap: 0.12rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.act-body strong {
|
.act-body strong {
|
||||||
font-size: 0.88rem;
|
font-size: 0.84rem;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.act-body span {
|
.act-body span {
|
||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
font-size: 0.74rem;
|
font-size: 0.72rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-pill {
|
.status-pill {
|
||||||
font-size: 0.7rem;
|
font-size: 0.68rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
padding: 0.24rem 0.55rem;
|
padding: 0.22rem 0.5rem;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-pill.done {
|
.status-pill.done,
|
||||||
|
.status-pill.held {
|
||||||
background: #dcfce7;
|
background: #dcfce7;
|
||||||
color: #166534;
|
color: #166534;
|
||||||
}
|
}
|
||||||
@@ -151,8 +201,4 @@ a {
|
|||||||
background: #fee2e2;
|
background: #fee2e2;
|
||||||
color: #b91c1c;
|
color: #b91c1c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.muted {
|
|
||||||
color: #94a3b8;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -9,17 +9,27 @@ const props = defineProps<{
|
|||||||
formatAmount: (value: number) => string;
|
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 points = computed(() => {
|
const points = computed(() => {
|
||||||
const trend = props.trend;
|
const rows = trend.value;
|
||||||
if (!trend.length) return [];
|
const max = Math.max(...rows.map((p) => p.amount), 1);
|
||||||
const max = Math.max(...trend.map((p) => p.amount), 1);
|
|
||||||
const w = 360;
|
const w = 360;
|
||||||
const h = 150;
|
const h = 150;
|
||||||
const padX = 16;
|
const padX = 16;
|
||||||
const padY = 18;
|
const padY = 36;
|
||||||
return trend.map((p, i) => ({
|
return rows.map((p, i) => ({
|
||||||
...p,
|
...p,
|
||||||
x: padX + (i / Math.max(trend.length - 1, 1)) * (w - padX * 2),
|
x: padX + (i / Math.max(rows.length - 1, 1)) * (w - padX * 2),
|
||||||
y: h - padY - (p.amount / max) * (h - padY * 2),
|
y: h - padY - (p.amount / max) * (h - padY * 2),
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
@@ -43,12 +53,8 @@ const highlight = computed(() => {
|
|||||||
<article class="panel">
|
<article class="panel">
|
||||||
<header class="panel-head">
|
<header class="panel-head">
|
||||||
<h2>روند فروش</h2>
|
<h2>روند فروش</h2>
|
||||||
<span
|
<span class="mini-badge" :class="{ down: change < 0 }">
|
||||||
v-if="changePercent != null"
|
{{ formatChange(change) }} نسبت به ماه قبل
|
||||||
class="mini-badge"
|
|
||||||
:class="{ down: changePercent < 0 }"
|
|
||||||
>
|
|
||||||
{{ formatChange(changePercent) }} نسبت به ماه قبل
|
|
||||||
</span>
|
</span>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@@ -56,7 +62,7 @@ const highlight = computed(() => {
|
|||||||
<svg viewBox="0 0 360 170" class="line-chart" aria-hidden="true">
|
<svg viewBox="0 0 360 170" class="line-chart" aria-hidden="true">
|
||||||
<defs>
|
<defs>
|
||||||
<linearGradient id="homeTrendFill" x1="0" y1="0" x2="0" y2="1">
|
<linearGradient id="homeTrendFill" x1="0" y1="0" x2="0" y2="1">
|
||||||
<stop offset="0%" stop-color="#14b8a6" stop-opacity="0.3" />
|
<stop offset="0%" stop-color="#14b8a6" stop-opacity="0.28" />
|
||||||
<stop offset="100%" stop-color="#14b8a6" stop-opacity="0" />
|
<stop offset="100%" stop-color="#14b8a6" stop-opacity="0" />
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
</defs>
|
</defs>
|
||||||
@@ -76,29 +82,29 @@ const highlight = computed(() => {
|
|||||||
:points="line"
|
:points="line"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="#14b8a6"
|
stroke="#14b8a6"
|
||||||
stroke-width="3.4"
|
stroke-width="3.2"
|
||||||
stroke-linecap="round"
|
stroke-linecap="round"
|
||||||
stroke-linejoin="round"
|
stroke-linejoin="round"
|
||||||
/>
|
/>
|
||||||
<g v-for="(p, i) in points" :key="i">
|
<g v-for="(p, i) in points" :key="i">
|
||||||
<circle :cx="p.x" :cy="p.y" r="5" fill="#fff" stroke="#14b8a6" stroke-width="2.6" />
|
<circle :cx="p.x" :cy="p.y" r="4.5" fill="#fff" stroke="#14b8a6" stroke-width="2.4" />
|
||||||
</g>
|
</g>
|
||||||
<g v-if="highlight">
|
<g v-if="highlight">
|
||||||
<rect
|
<rect
|
||||||
:x="highlight.x - 52"
|
:x="Math.min(Math.max(highlight.x - 52, 4), 256)"
|
||||||
:y="highlight.y - 36"
|
:y="highlight.y - 32"
|
||||||
width="104"
|
width="104"
|
||||||
height="26"
|
height="24"
|
||||||
rx="10"
|
rx="8"
|
||||||
fill="#0f766e"
|
fill="#0f766e"
|
||||||
/>
|
/>
|
||||||
<text
|
<text
|
||||||
:x="highlight.x"
|
:x="Math.min(Math.max(highlight.x, 56), 308)"
|
||||||
:y="highlight.y - 18"
|
:y="highlight.y - 16"
|
||||||
text-anchor="middle"
|
text-anchor="middle"
|
||||||
fill="#fff"
|
fill="#fff"
|
||||||
font-size="10"
|
font-size="9.5"
|
||||||
font-family="Vazirmatn, Tahoma, sans-serif"
|
font-family="IRANSans, Tahoma, sans-serif"
|
||||||
>
|
>
|
||||||
{{ formatAmount(highlight.amount) }}
|
{{ formatAmount(highlight.amount) }}
|
||||||
</text>
|
</text>
|
||||||
@@ -114,11 +120,14 @@ const highlight = computed(() => {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.panel {
|
.panel {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 22px;
|
border-radius: 20px;
|
||||||
padding: 1.05rem 1.15rem;
|
padding: 1rem 1.1rem 0.9rem;
|
||||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
border: 1px solid #eef2f7;
|
border: 1px solid #eef2f7;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-head {
|
.panel-head {
|
||||||
@@ -126,22 +135,22 @@ const highlight = computed(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
margin-bottom: 0.65rem;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.98rem;
|
font-size: 0.95rem;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mini-badge {
|
.mini-badge {
|
||||||
font-size: 0.72rem;
|
font-size: 0.7rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #16a34a;
|
color: #16a34a;
|
||||||
background: #dcfce7;
|
background: #dcfce7;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
padding: 0.2rem 0.55rem;
|
padding: 0.18rem 0.5rem;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +161,9 @@ h2 {
|
|||||||
|
|
||||||
.chart-wrap {
|
.chart-wrap {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.2rem;
|
gap: 0.15rem;
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 2.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-chart {
|
.line-chart {
|
||||||
@@ -164,7 +175,7 @@ h2 {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
font-size: 0.74rem;
|
font-size: 0.72rem;
|
||||||
padding: 0 0.4rem;
|
padding: 0 0.35rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,18 +7,28 @@ const props = defineProps<{
|
|||||||
sources: HomeDashboardSourceDto[];
|
sources: HomeDashboardSourceDto[];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const colors = ['#14b8a6', '#38bdf8', '#fb923c', '#fbbf24', '#94a3b8', '#a78bfa'];
|
const demoSources: HomeDashboardSourceDto[] = [
|
||||||
|
{ label: 'معرفی دوستان', count: 44, percent: 34 },
|
||||||
|
{ label: 'وبسایت', count: 33, percent: 26 },
|
||||||
|
{ label: 'شبکههای اجتماعی', count: 23, percent: 18 },
|
||||||
|
{ label: 'تبلیغات', count: 18, percent: 14 },
|
||||||
|
{ label: 'سایر', count: 10, percent: 8 },
|
||||||
|
];
|
||||||
|
|
||||||
|
const colors = ['#2563eb', '#14b8a6', '#22c55e', '#fb923c', '#94a3b8'];
|
||||||
|
|
||||||
|
const rows = computed(() => (props.sources.length ? props.sources : demoSources));
|
||||||
|
|
||||||
const segments = computed(() => {
|
const segments = computed(() => {
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
return props.sources.map((s, i) => {
|
return rows.value.map((s, i) => {
|
||||||
const seg = { ...s, color: colors[i % colors.length], offset };
|
const seg = { ...s, color: colors[i % colors.length], offset };
|
||||||
offset += s.percent;
|
offset += s.percent;
|
||||||
return seg;
|
return seg;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const total = computed(() => props.sources.reduce((a, s) => a + s.count, 0));
|
const total = computed(() => rows.value.reduce((a, s) => a + s.count, 0));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -66,39 +76,39 @@ const total = computed(() => props.sources.reduce((a, s) => a + s.count, 0));
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.panel {
|
.panel {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 22px;
|
border-radius: 20px;
|
||||||
padding: 1.05rem 1.15rem;
|
padding: 1rem 1.1rem;
|
||||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
border: 1px solid #eef2f7;
|
border: 1px solid #eef2f7;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-head {
|
.panel-head {
|
||||||
margin-bottom: 0.85rem;
|
margin-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.98rem;
|
font-size: 0.95rem;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.donut-wrap {
|
.donut-wrap {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 140px 1fr;
|
grid-template-columns: 132px 1fr;
|
||||||
gap: 1rem;
|
gap: 0.85rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.donut-chart-box {
|
.donut-chart-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 140px;
|
width: 132px;
|
||||||
height: 140px;
|
height: 132px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.donut-chart {
|
.donut-chart {
|
||||||
width: 140px;
|
width: 132px;
|
||||||
height: 140px;
|
height: 132px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.donut-center {
|
.donut-center {
|
||||||
@@ -112,12 +122,12 @@ h2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.donut-center strong {
|
.donut-center strong {
|
||||||
font-size: 1.2rem;
|
font-size: 1.15rem;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.donut-center span {
|
.donut-center span {
|
||||||
font-size: 0.72rem;
|
font-size: 0.7rem;
|
||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,14 +136,14 @@ h2 {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.5rem;
|
gap: 0.48rem;
|
||||||
font-size: 0.82rem;
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.donut-legend li {
|
.donut-legend li {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.45rem;
|
gap: 0.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lbl {
|
.lbl {
|
||||||
@@ -148,8 +158,8 @@ em {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dot {
|
.dot {
|
||||||
width: 9px;
|
width: 8px;
|
||||||
height: 9px;
|
height: 8px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { RouterLink } from 'vue-router';
|
||||||
import { toFaDigits } from '@/lib/jalali';
|
import { toFaDigits } from '@/lib/jalali';
|
||||||
import type { HomeDashboardTopCustomerDto } from '@mento/shared';
|
import type { HomeDashboardTopCustomerDto } from '@mento/shared';
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
customers: HomeDashboardTopCustomerDto[];
|
customers: HomeDashboardTopCustomerDto[];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const demo: HomeDashboardTopCustomerDto[] = [
|
||||||
|
{ id: '1', name: 'شرکت آریا', dealCount: 8, rank: 1 },
|
||||||
|
{ id: '2', name: 'گروه پارسیان', dealCount: 4, rank: 2 },
|
||||||
|
{ id: '3', name: 'فناوران نوین', dealCount: 3, rank: 3 },
|
||||||
|
];
|
||||||
|
|
||||||
|
const rows = computed(() => (props.customers.length ? props.customers.slice(0, 3) : demo));
|
||||||
|
|
||||||
function trophy(rank: number) {
|
function trophy(rank: number) {
|
||||||
if (rank === 1) return '🥇';
|
if (rank === 1) return '🥇';
|
||||||
if (rank === 2) return '🥈';
|
if (rank === 2) return '🥈';
|
||||||
@@ -18,10 +28,11 @@ function trophy(rank: number) {
|
|||||||
<article class="panel">
|
<article class="panel">
|
||||||
<header class="panel-head">
|
<header class="panel-head">
|
||||||
<h2>مشتریان برتر</h2>
|
<h2>مشتریان برتر</h2>
|
||||||
|
<RouterLink :to="{ name: 'contacts' }">مشاهده همه</RouterLink>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<ul v-if="customers.length" class="top-list">
|
<ul class="top-list">
|
||||||
<li v-for="row in customers" :key="row.id">
|
<li v-for="row in rows" :key="row.id">
|
||||||
<span class="cust-avatar">{{ row.name.slice(0, 1) }}</span>
|
<span class="cust-avatar">{{ row.name.slice(0, 1) }}</span>
|
||||||
<div>
|
<div>
|
||||||
<strong>{{ row.name }}</strong>
|
<strong>{{ row.name }}</strong>
|
||||||
@@ -30,27 +41,35 @@ function trophy(rank: number) {
|
|||||||
<span class="rank">{{ trophy(row.rank) }}</span>
|
<span class="rank">{{ trophy(row.rank) }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p v-else class="muted">هنوز داده کافی برای رتبهبندی نیست.</p>
|
|
||||||
</article>
|
</article>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.panel {
|
.panel {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 22px;
|
border-radius: 20px;
|
||||||
padding: 1.05rem 1.1rem;
|
padding: 1rem 1.05rem;
|
||||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
border: 1px solid #eef2f7;
|
border: 1px solid #eef2f7;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-head {
|
.panel-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
margin-bottom: 0.85rem;
|
margin-bottom: 0.85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.98rem;
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #14b8a6;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-list {
|
.top-list {
|
||||||
@@ -58,19 +77,19 @@ h2 {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.75rem;
|
gap: 0.7rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-list li {
|
.top-list li {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.7rem;
|
gap: 0.65rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cust-avatar {
|
.cust-avatar {
|
||||||
width: 40px;
|
width: 38px;
|
||||||
height: 40px;
|
height: 38px;
|
||||||
border-radius: 14px;
|
border-radius: 12px;
|
||||||
background: linear-gradient(145deg, #ccfbf1, #99f6e4);
|
background: linear-gradient(145deg, #ccfbf1, #99f6e4);
|
||||||
color: #0f766e;
|
color: #0f766e;
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -83,23 +102,19 @@ h2 {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.12rem;
|
gap: 0.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-list strong {
|
.top-list strong {
|
||||||
font-size: 0.88rem;
|
font-size: 0.84rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-list span {
|
.top-list span {
|
||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
font-size: 0.74rem;
|
font-size: 0.72rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rank {
|
.rank {
|
||||||
font-size: 1.2rem;
|
font-size: 1.15rem;
|
||||||
}
|
|
||||||
|
|
||||||
.muted {
|
|
||||||
color: #94a3b8;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -349,13 +349,19 @@ onUnmounted(() => {
|
|||||||
<div class="profile-meta">
|
<div class="profile-meta">
|
||||||
<strong>{{ auth.user?.fullName }}</strong>
|
<strong>{{ auth.user?.fullName }}</strong>
|
||||||
<span>{{ roleLabel || 'کاربر' }}</span>
|
<span>{{ roleLabel || 'کاربر' }}</span>
|
||||||
|
<span class="online-label">
|
||||||
|
<i class="online-dot" />
|
||||||
|
آنلاین
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="online-dot" title="آنلاین" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="promo-card">
|
<div class="promo-card">
|
||||||
<span class="promo-icon"><UiIcon name="megaphone" :size="18" /></span>
|
<span class="promo-icons" aria-hidden="true">
|
||||||
<p>با منتو فروشات رو چند برابر کن</p>
|
<UiIcon name="send" :size="16" />
|
||||||
|
<UiIcon name="sparkle" :size="14" />
|
||||||
|
</span>
|
||||||
|
<p>با منتو فروشات را چند برابر کن</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="logout-link" type="button" @click="onLogout">خروج از حساب</button>
|
<button class="logout-link" type="button" @click="onLogout">خروج از حساب</button>
|
||||||
@@ -454,10 +460,11 @@ onUnmounted(() => {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.shell {
|
.shell {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 248px minmax(0, 1fr);
|
grid-template-columns: 268px minmax(0, 1fr);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
min-height: 100dvh;
|
min-height: 100dvh;
|
||||||
background: #f5f7fa;
|
background: #eef2f6;
|
||||||
|
gap: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.workspace {
|
.workspace {
|
||||||
@@ -477,18 +484,21 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 14px;
|
||||||
align-self: start;
|
align-self: start;
|
||||||
height: 100vh;
|
height: calc(100dvh - 28px);
|
||||||
height: 100dvh;
|
margin: 14px;
|
||||||
|
margin-inline-end: 10px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-inline-start: 1px solid #e8eef3;
|
border: 0;
|
||||||
padding: 1.15rem 0.9rem;
|
border-radius: 28px;
|
||||||
|
padding: 1.55rem 1.05rem 1.2rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1.35rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-row {
|
.brand-row {
|
||||||
@@ -496,7 +506,7 @@ onUnmounted(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
padding: 0 0.35rem;
|
padding: 0.15rem 0.45rem 0.35rem;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,11 +551,12 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.side-nav {
|
.side-nav {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.35rem;
|
gap: 0.45rem;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
|
padding-inline: 0.15rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-nav::-webkit-scrollbar {
|
.side-nav::-webkit-scrollbar {
|
||||||
@@ -555,19 +566,19 @@ onUnmounted(() => {
|
|||||||
.nav-primary,
|
.nav-primary,
|
||||||
.nav-sub {
|
.nav-sub {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.22rem;
|
gap: 0.35rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.7rem;
|
gap: 0.75rem;
|
||||||
padding: 0.78rem 0.9rem;
|
padding: 0.82rem 1rem;
|
||||||
border-radius: 14px;
|
border-radius: 18px;
|
||||||
color: #64748b;
|
color: #334155;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 0.92rem;
|
font-size: 0.94rem;
|
||||||
transition: background 0.15s ease, color 0.15s ease;
|
transition: background 0.15s ease, color 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,7 +588,7 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-item.router-link-active {
|
.nav-item.router-link-active {
|
||||||
background: #d1faf2;
|
background: #d8faf3;
|
||||||
color: #0f766e;
|
color: #0f766e;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
@@ -605,7 +616,7 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-group {
|
.nav-group {
|
||||||
margin-top: 0.35rem;
|
margin-top: 0.55rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-group-btn {
|
.nav-group-btn {
|
||||||
@@ -619,8 +630,8 @@ onUnmounted(() => {
|
|||||||
font: inherit;
|
font: inherit;
|
||||||
font-size: 0.78rem;
|
font-size: 0.78rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
padding: 0.5rem 0.9rem;
|
padding: 0.55rem 1rem;
|
||||||
border-radius: 10px;
|
border-radius: 14px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
@@ -639,15 +650,15 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-sub {
|
.nav-sub {
|
||||||
margin-inline-end: 0.75rem;
|
margin-inline-end: 0.55rem;
|
||||||
padding-inline-end: 0.35rem;
|
padding-inline-end: 0.25rem;
|
||||||
border-inline-end: 1px solid #eef2f7;
|
border-inline-end: 1px solid #eef2f7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-sub a {
|
.nav-sub a {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 0.55rem 0.8rem;
|
padding: 0.58rem 0.9rem;
|
||||||
border-radius: 10px;
|
border-radius: 14px;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 0.88rem;
|
font-size: 0.88rem;
|
||||||
@@ -671,20 +682,23 @@ onUnmounted(() => {
|
|||||||
.sidebar-foot {
|
.sidebar-foot {
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.7rem;
|
gap: 0.85rem;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
padding-top: 0.35rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-card {
|
.profile-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.65rem;
|
gap: 0.75rem;
|
||||||
padding: 0.55rem 0.65rem;
|
padding: 0.85rem 0.9rem;
|
||||||
|
border-radius: 18px;
|
||||||
|
background: #f8fafc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 42px;
|
width: 44px;
|
||||||
height: 42px;
|
height: 44px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: linear-gradient(145deg, #99f6e4, #5eead4);
|
background: linear-gradient(145deg, #99f6e4, #5eead4);
|
||||||
color: #0f766e;
|
color: #0f766e;
|
||||||
@@ -697,54 +711,59 @@ onUnmounted(() => {
|
|||||||
.profile-meta {
|
.profile-meta {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.08rem;
|
gap: 0.12rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-meta strong {
|
.profile-meta strong {
|
||||||
font-size: 0.88rem;
|
font-size: 0.9rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-meta span {
|
.profile-meta > span {
|
||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
font-size: 0.75rem;
|
font-size: 0.76rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.online-label {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
color: #64748b !important;
|
||||||
|
font-size: 0.74rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.online-dot {
|
.online-dot {
|
||||||
margin-inline-start: auto;
|
width: 8px;
|
||||||
width: 9px;
|
height: 8px;
|
||||||
height: 9px;
|
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: #22c55e;
|
background: #22c55e;
|
||||||
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
|
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
|
||||||
}
|
}
|
||||||
|
|
||||||
.promo-card {
|
.promo-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.7rem;
|
gap: 0.7rem;
|
||||||
padding: 0.95rem 1rem;
|
padding: 1.05rem 1.05rem;
|
||||||
border-radius: 18px;
|
border-radius: 22px;
|
||||||
background: linear-gradient(145deg, #0f766e, #115e59 55%, #134e4a);
|
background: linear-gradient(105deg, #c4e84a 0%, #2dd4bf 42%, #1d4ed8 100%);
|
||||||
color: #ecfdf5;
|
color: #fff;
|
||||||
box-shadow: 0 14px 28px rgba(15, 118, 110, 0.25);
|
box-shadow: 0 12px 26px rgba(29, 78, 216, 0.18);
|
||||||
}
|
}
|
||||||
|
|
||||||
.promo-icon {
|
.promo-icons {
|
||||||
width: 34px;
|
display: inline-flex;
|
||||||
height: 34px;
|
align-items: center;
|
||||||
border-radius: 12px;
|
gap: 0.2rem;
|
||||||
background: rgba(255, 255, 255, 0.14);
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
opacity: 0.95;
|
||||||
}
|
}
|
||||||
|
|
||||||
.promo-card p {
|
.promo-card p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.84rem;
|
font-size: 0.86rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
}
|
}
|
||||||
@@ -754,42 +773,55 @@ onUnmounted(() => {
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
font-size: 0.8rem;
|
font-size: 0.78rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
padding: 0 0.35rem;
|
padding: 0 0.45rem 0.15rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.global-search {
|
.global-search {
|
||||||
flex: 1;
|
width: min(100%, 420px);
|
||||||
max-width: 620px;
|
max-width: 420px;
|
||||||
margin-inline: auto;
|
justify-self: start;
|
||||||
|
/* همتراز با عنوان هیرو: padding هیرو + آواتار خوشآمد + فاصله */
|
||||||
|
margin-inline-start: calc(1.4rem + 48px + 0.8rem);
|
||||||
|
margin-inline-end: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.7rem;
|
gap: 0.7rem;
|
||||||
background: #eef2f6;
|
background: #fff;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
padding: 0.78rem 1.1rem;
|
padding: 0.7rem 1.05rem;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
|
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
.desktop-topbar {
|
.desktop-topbar {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1fr) auto;
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
align-items: center;
|
align-items: start;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
padding: 1.05rem 1.5rem 0.85rem;
|
/* همان فاصله بالای سایدبار شناور (14px) */
|
||||||
|
padding: 14px 1.5rem 0.85rem;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
background: rgba(245, 247, 250, 0.92);
|
background: rgba(238, 242, 246, 0.92);
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.topbar-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
/* مرکز عمودی نسبت به ارتفاع جستجو (~49px) */
|
||||||
|
min-height: 49px;
|
||||||
|
}
|
||||||
|
|
||||||
.global-search:focus-within {
|
.global-search:focus-within {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-color: #cbd5e1;
|
border-color: #e2e8f0;
|
||||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
|
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.global-search input {
|
.global-search input {
|
||||||
@@ -813,18 +845,12 @@ onUnmounted(() => {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
font-size: 0.72rem;
|
font-size: 0.72rem;
|
||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
background: #fff;
|
background: #f8fafc;
|
||||||
border: 1px solid #e2e8f0;
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 0.18rem 0.45rem;
|
padding: 0.18rem 0.45rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topbar-actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.round-btn {
|
.round-btn {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 42px;
|
width: 42px;
|
||||||
@@ -1057,6 +1083,9 @@ onUnmounted(() => {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
inset-inline-start: 0;
|
inset-inline-start: 0;
|
||||||
width: min(300px, 86vw);
|
width: min(300px, 86vw);
|
||||||
|
height: 100dvh;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: 0;
|
||||||
z-index: 35;
|
z-index: 35;
|
||||||
transform: translateX(110%);
|
transform: translateX(110%);
|
||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease;
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/* IRANSans (FaNum) — local self-hosted */
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRANSans";
|
||||||
|
src:
|
||||||
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_UltraLight.woff2") format("woff2"),
|
||||||
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_UltraLight.woff") format("woff");
|
||||||
|
font-weight: 200;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRANSans";
|
||||||
|
src:
|
||||||
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Light.woff2") format("woff2"),
|
||||||
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Light.woff") format("woff");
|
||||||
|
font-weight: 300;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRANSans";
|
||||||
|
src:
|
||||||
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum).woff2") format("woff2"),
|
||||||
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum).woff") format("woff");
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRANSans";
|
||||||
|
src:
|
||||||
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Medium.woff2") format("woff2"),
|
||||||
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Medium.woff") format("woff");
|
||||||
|
font-weight: 500;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRANSans";
|
||||||
|
src:
|
||||||
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Bold.woff2") format("woff2"),
|
||||||
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Bold.woff") format("woff");
|
||||||
|
font-weight: 700;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRANSans";
|
||||||
|
src:
|
||||||
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Black.woff2") format("woff2"),
|
||||||
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Black.woff") format("woff");
|
||||||
|
font-weight: 900;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* map common 600 → Bold so font-weight:600 works */
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRANSans";
|
||||||
|
src:
|
||||||
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Bold.woff2") format("woff2"),
|
||||||
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Bold.woff") format("woff");
|
||||||
|
font-weight: 600;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* map 800 → Black */
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRANSans";
|
||||||
|
src:
|
||||||
|
url("../assets/fonts/iranSans/woff2/IRANSansWeb(FaNum)_Black.woff2") format("woff2"),
|
||||||
|
url("../assets/fonts/iranSans/woff/IRANSansWeb(FaNum)_Black.woff") format("woff");
|
||||||
|
font-weight: 800;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@import "./fonts.css";
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--bg: #f4f7f8;
|
--bg: #f4f7f8;
|
||||||
--surface: #ffffff;
|
--surface: #ffffff;
|
||||||
@@ -9,7 +11,7 @@
|
|||||||
--danger: #b42318;
|
--danger: #b42318;
|
||||||
--shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
|
--shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
|
||||||
--radius: 18px;
|
--radius: 18px;
|
||||||
--font: "Vazirmatn", Tahoma, sans-serif;
|
--font: "IRANSans", Tahoma, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
|||||||
@@ -148,15 +148,15 @@ onMounted(async () => {
|
|||||||
|
|
||||||
.mid-grid {
|
.mid-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1.3fr 1fr 0.95fr;
|
grid-template-columns: 1.25fr 1fr 0.88fr;
|
||||||
gap: 0.9rem;
|
gap: 0.8rem;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-grid {
|
.bottom-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1.35fr 0.85fr;
|
grid-template-columns: 1fr 1.35fr 0.78fr;
|
||||||
gap: 0.9rem;
|
gap: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.muted {
|
.muted {
|
||||||
|
|||||||
Generated
+23
-4
@@ -11,8 +11,14 @@
|
|||||||
"apps/*",
|
"apps/*",
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"@rollup/rollup-win32-x64-msvc": "*"
|
||||||
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@rollup/rollup-win32-x64-msvc": "^4.63.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"apps/api": {
|
"apps/api": {
|
||||||
@@ -1890,13 +1896,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||||
"version": "4.62.5",
|
"version": "4.63.1",
|
||||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.5.tgz",
|
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.1.tgz",
|
||||||
"integrity": "sha512-/gDJaRs4gl0NPIwqCz+6PkpmhhjRAD2j6P4rSNHBzUkO3naEx2mIU0pRle1vUNRQ7mE/+8OOeXLTv/J56FKiQg==",
|
"integrity": "sha512-at8QVep6S3h5Y6gSbdGU06bRY5WJkf6WUduM9YtvYMbYhB1MOFfUgc6kehitQXzOtMSaT70q7f9ydPhpqu821w==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -6305,6 +6310,20 @@
|
|||||||
"fsevents": "~2.3.2"
|
"fsevents": "~2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/rollup/node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||||
|
"version": "4.62.5",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.5.tgz",
|
||||||
|
"integrity": "sha512-/gDJaRs4gl0NPIwqCz+6PkpmhhjRAD2j6P4rSNHBzUkO3naEx2mIU0pRle1vUNRQ7mE/+8OOeXLTv/J56FKiQg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
]
|
||||||
|
},
|
||||||
"node_modules/router": {
|
"node_modules/router": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmmirror.com/router/-/router-2.2.0.tgz",
|
"resolved": "https://registry.npmmirror.com/router/-/router-2.2.0.tgz",
|
||||||
|
|||||||
@@ -20,5 +20,8 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@rollup/rollup-win32-x64-msvc": "^4.63.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
"""Cut black background only via edge flood-fill — keep black face screen."""
|
||||||
|
from collections import deque
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
src = Path(r"e:\projeha\crm\apps\web\public\brand\Mento-ai.png")
|
||||||
|
dst = Path(r"e:\projeha\crm\apps\web\public\brand\mento-ai-avatar.png")
|
||||||
|
|
||||||
|
img = Image.open(src).convert("RGBA")
|
||||||
|
w, h = img.size
|
||||||
|
px = img.load()
|
||||||
|
|
||||||
|
def is_bg(r, g, b, a):
|
||||||
|
# near-black background plate (not cyan glow)
|
||||||
|
if a < 10:
|
||||||
|
return True
|
||||||
|
if r < 40 and g < 40 and b < 45:
|
||||||
|
return True
|
||||||
|
if r < 55 and g < 55 and b < 60 and (r + g + b) < 150:
|
||||||
|
# still bg if not cyan-tinted
|
||||||
|
if b < g + 15 and g < r + 15:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
visited = [[False] * w for _ in range(h)]
|
||||||
|
q = deque()
|
||||||
|
|
||||||
|
# seed from all edge pixels that look like background
|
||||||
|
for x in range(w):
|
||||||
|
for y in (0, h - 1):
|
||||||
|
r, g, b, a = px[x, y]
|
||||||
|
if is_bg(r, g, b, a):
|
||||||
|
q.append((x, y))
|
||||||
|
visited[y][x] = True
|
||||||
|
for y in range(h):
|
||||||
|
for x in (0, w - 1):
|
||||||
|
if not visited[y][x]:
|
||||||
|
r, g, b, a = px[x, y]
|
||||||
|
if is_bg(r, g, b, a):
|
||||||
|
q.append((x, y))
|
||||||
|
visited[y][x] = True
|
||||||
|
|
||||||
|
while q:
|
||||||
|
x, y = q.popleft()
|
||||||
|
px[x, y] = (0, 0, 0, 0)
|
||||||
|
for nx, ny in ((x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)):
|
||||||
|
if 0 <= nx < w and 0 <= ny < h and not visited[ny][nx]:
|
||||||
|
r, g, b, a = px[nx, ny]
|
||||||
|
if is_bg(r, g, b, a):
|
||||||
|
visited[ny][nx] = True
|
||||||
|
q.append((nx, ny))
|
||||||
|
|
||||||
|
bbox = img.getbbox()
|
||||||
|
if bbox:
|
||||||
|
pad = 20
|
||||||
|
l, t, r, btm = bbox
|
||||||
|
img = img.crop(
|
||||||
|
(max(0, l - pad), max(0, t - pad), min(w, r + pad), min(h, btm + pad))
|
||||||
|
)
|
||||||
|
|
||||||
|
# fit into square canvas keeping aspect
|
||||||
|
ow, oh = img.size
|
||||||
|
side = max(ow, oh)
|
||||||
|
canvas = Image.new("RGBA", (side, side), (0, 0, 0, 0))
|
||||||
|
canvas.paste(img, ((side - ow) // 2, (side - oh) // 2))
|
||||||
|
canvas = canvas.resize((512, 512), Image.Resampling.LANCZOS)
|
||||||
|
canvas.save(dst, "PNG", optimize=True)
|
||||||
|
|
||||||
|
# stats
|
||||||
|
a = [p[3] for p in canvas.getdata()]
|
||||||
|
print(
|
||||||
|
"saved",
|
||||||
|
dst,
|
||||||
|
"zero_a",
|
||||||
|
sum(1 for x in a if x == 0),
|
||||||
|
"corner",
|
||||||
|
canvas.getpixel((0, 0)),
|
||||||
|
"center",
|
||||||
|
canvas.getpixel((256, 256)),
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user