273 lines
5.5 KiB
Vue
273 lines
5.5 KiB
Vue
<script setup lang="ts">
|
||||
|
|
import { RouterLink } from 'vue-router';
|
|||
|
|
import UiIcon from '@/components/UiIcon.vue';
|
|||
|
|
import MentoAiAvatar from '@/components/brand/MentoAiAvatar.vue';
|
|||
|
|
import type { HomeDashboardAlertDto } from '@mento/shared';
|
|||
|
|
|
|||
|
|
defineProps<{
|
|||
|
|
greeting: string;
|
|||
|
|
firstName: string;
|
|||
|
|
userInitial: string;
|
|||
|
|
alerts: HomeDashboardAlertDto[];
|
|||
|
|
askQuery: string;
|
|||
|
|
}>();
|
|||
|
|
|
|||
|
|
const emit = defineEmits<{
|
|||
|
|
'update:askQuery': [value: string];
|
|||
|
|
ask: [];
|
|||
|
|
}>();
|
|||
|
|
|
|||
|
|
function alertIcon(tone: string) {
|
|||
|
|
if (tone === 'urgent') return 'fire' as const;
|
|||
|
|
if (tone === 'warning') return 'warning' as const;
|
|||
|
|
if (tone === 'success') return 'trend' as const;
|
|||
|
|
return 'sparkle' as const;
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<template>
|
|||
|
|
<header class="hero">
|
|||
|
|
<div class="hero-pattern" aria-hidden="true" />
|
|||
|
|
<div class="hero-glow a" />
|
|||
|
|
<div class="hero-glow b" />
|
|||
|
|
|
|||
|
|
<div class="hero-body">
|
|||
|
|
<div class="hero-top">
|
|||
|
|
<div class="hero-greet">
|
|||
|
|
<span class="hero-avatar">
|
|||
|
|
{{ userInitial }}
|
|||
|
|
<i class="online" />
|
|||
|
|
</span>
|
|||
|
|
<div>
|
|||
|
|
<h1>{{ greeting }} {{ firstName }}</h1>
|
|||
|
|
<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>
|
|||
|
|
|
|||
|
|
<form class="hero-ask" @submit.prevent="emit('ask')">
|
|||
|
|
<UiIcon name="sparkle" :size="16" />
|
|||
|
|
<input
|
|||
|
|
:value="askQuery"
|
|||
|
|
type="search"
|
|||
|
|
placeholder="از منتو بپرس..."
|
|||
|
|
@input="emit('update:askQuery', ($event.target as HTMLInputElement).value)"
|
|||
|
|
/>
|
|||
|
|
<kbd>⌘K</kbd>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<MentoAiAvatar class="hero-bot" :size="150" />
|
|||
|
|
</header>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<style scoped>
|
|||
|
|
.hero {
|
|||
|
|
position: relative;
|
|||
|
|
display: grid;
|
|||
|
|
grid-template-columns: minmax(0, 1fr) 180px;
|
|||
|
|
gap: 1rem;
|
|||
|
|
align-items: center;
|
|||
|
|
min-height: 196px;
|
|||
|
|
padding: 1.35rem 1.4rem;
|
|||
|
|
border-radius: 28px;
|
|||
|
|
overflow: hidden;
|
|||
|
|
color: #fff;
|
|||
|
|
background: linear-gradient(110deg, #5eead4 0%, #14b8a6 26%, #0f766e 55%, #163a5f 100%);
|
|||
|
|
box-shadow: 0 18px 40px rgba(15, 118, 110, 0.22);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-pattern {
|
|||
|
|
position: absolute;
|
|||
|
|
inset: 0;
|
|||
|
|
opacity: 0.12;
|
|||
|
|
background-image:
|
|||
|
|
radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 0 2px, transparent 3px),
|
|||
|
|
radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.25) 0 1.5px, transparent 2.5px);
|
|||
|
|
background-size: 28px 28px, 18px 18px;
|
|||
|
|
pointer-events: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-glow {
|
|||
|
|
position: absolute;
|
|||
|
|
border-radius: 999px;
|
|||
|
|
background: rgba(255, 255, 255, 0.1);
|
|||
|
|
pointer-events: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-glow.a {
|
|||
|
|
width: 220px;
|
|||
|
|
height: 220px;
|
|||
|
|
top: -90px;
|
|||
|
|
inset-inline-end: 160px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-glow.b {
|
|||
|
|
width: 140px;
|
|||
|
|
height: 140px;
|
|||
|
|
bottom: -55px;
|
|||
|
|
inset-inline-start: 30px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-body {
|
|||
|
|
position: relative;
|
|||
|
|
z-index: 1;
|
|||
|
|
display: grid;
|
|||
|
|
gap: 1rem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-top {
|
|||
|
|
display: grid;
|
|||
|
|
gap: 0.85rem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-greet {
|
|||
|
|
display: flex;
|
|||
|
|
align-items: center;
|
|||
|
|
gap: 0.85rem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-avatar {
|
|||
|
|
position: relative;
|
|||
|
|
width: 52px;
|
|||
|
|
height: 52px;
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.online {
|
|||
|
|
position: absolute;
|
|||
|
|
bottom: 2px;
|
|||
|
|
inset-inline-start: 2px;
|
|||
|
|
width: 10px;
|
|||
|
|
height: 10px;
|
|||
|
|
border-radius: 999px;
|
|||
|
|
background: #22c55e;
|
|||
|
|
border: 2px solid #fff;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
h1 {
|
|||
|
|
margin: 0;
|
|||
|
|
font-size: clamp(1.4rem, 2.2vw, 1.8rem);
|
|||
|
|
font-weight: 800;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
p {
|
|||
|
|
margin: 0.2rem 0 0;
|
|||
|
|
opacity: 0.9;
|
|||
|
|
font-size: 0.92rem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-chips {
|
|||
|
|
display: flex;
|
|||
|
|
flex-wrap: wrap;
|
|||
|
|
gap: 0.5rem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.chip {
|
|||
|
|
display: inline-flex;
|
|||
|
|
align-items: center;
|
|||
|
|
gap: 0.4rem;
|
|||
|
|
max-width: 100%;
|
|||
|
|
padding: 0.48rem 0.75rem;
|
|||
|
|
border-radius: 999px;
|
|||
|
|
background: #fff;
|
|||
|
|
color: #0f172a;
|
|||
|
|
font-size: 0.78rem;
|
|||
|
|
font-weight: 600;
|
|||
|
|
text-decoration: none;
|
|||
|
|
box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.chip-ico {
|
|||
|
|
width: 22px;
|
|||
|
|
height: 22px;
|
|||
|
|
border-radius: 999px;
|
|||
|
|
display: grid;
|
|||
|
|
place-items: center;
|
|||
|
|
flex-shrink: 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.chip-urgent .chip-ico {
|
|||
|
|
background: #fee2e2;
|
|||
|
|
color: #ef4444;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.chip-warning .chip-ico {
|
|||
|
|
background: #fef3c7;
|
|||
|
|
color: #d97706;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.chip-success .chip-ico,
|
|||
|
|
.chip-info .chip-ico {
|
|||
|
|
background: #dcfce7;
|
|||
|
|
color: #16a34a;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-ask {
|
|||
|
|
display: flex;
|
|||
|
|
align-items: center;
|
|||
|
|
gap: 0.55rem;
|
|||
|
|
max-width: 440px;
|
|||
|
|
background: rgba(255, 255, 255, 0.96);
|
|||
|
|
color: #0f172a;
|
|||
|
|
border-radius: 999px;
|
|||
|
|
padding: 0.58rem 0.9rem;
|
|||
|
|
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-ask input {
|
|||
|
|
border: 0;
|
|||
|
|
background: transparent;
|
|||
|
|
flex: 1;
|
|||
|
|
outline: none;
|
|||
|
|
font-size: 0.9rem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-ask kbd {
|
|||
|
|
font-size: 0.68rem;
|
|||
|
|
color: #94a3b8;
|
|||
|
|
border: 1px solid #e2e8f0;
|
|||
|
|
border-radius: 7px;
|
|||
|
|
padding: 0.12rem 0.35rem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-bot {
|
|||
|
|
position: relative;
|
|||
|
|
z-index: 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@media (max-width: 700px) {
|
|||
|
|
.hero {
|
|||
|
|
grid-template-columns: 1fr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.hero-bot {
|
|||
|
|
display: none;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</style>
|