fix: dashboard

This commit is contained in:
sajjadtalkhabi
2026-06-27 15:45:07 +03:30
parent a4432a30cb
commit 2c617258f4
12 changed files with 727 additions and 41 deletions
@@ -1,69 +1,226 @@
<template>
<div class="student-dashboard">
<div class="student-dashboard__welcome">
<img :src="flower" alt="flower" class="student-dashboard__flower" />
<div>
<p class="student-dashboard__hi">سلام بر شما</p>
<p class="student-dashboard__greeting">به سامانه موسسه بانو خوش آمدید.</p>
</div>
<div class="dashboard">
<div class="dashboard__main">
<!-- گزارش عملکرد -->
<section class="dashboard__section">
<BoxedIconTitleBlock title="گزارش عملکرد" desc="مروری بر شاخص‌های آموزشی و فعالیت‌های شما.">
<template #icon>
<SvgIcon name="heart" :size="24" color="var(--color-primary)" />
</template>
</BoxedIconTitleBlock>
<div class="dashboard__stats">
<DashboardStatCard
v-for="(stat, i) in performanceStats"
:key="i"
:icon="stat.icon"
:label="stat.label"
:value="stat.value"
:unit="stat.unit"
:subtitle="stat.subtitle"
/>
</div>
</section>
<!-- فعالیت های اخیر -->
<section class="dashboard__section">
<BoxedIconTitleBlock
title="فعالیت های اخیر"
desc="گزارشی از جدیدترین خریدها و دوره‌های تکمیل‌شده"
>
<template #icon>
<SvgIcon name="heart" :size="24" color="var(--color-primary)" />
</template>
</BoxedIconTitleBlock>
<div class="dashboard__activities">
<div v-for="(act, i) in activities" :key="i" class="dashboard__activity">
<div class="dashboard__pill">
<SvgIcon :name="act.pillIcon" :size="'1.125rem'" class="dashboard__pill-icon" />
<span class="dashboard__pill-label">{{ act.pillLabel }}</span>
</div>
<DashboardActivityCard :title="act.title" :meta="act.meta" :meta-icon="act.metaIcon" />
</div>
</div>
</section>
</div>
<p class="student-dashboard__placeholder">این بخش در مراحل بعدی توسعه مییابد.</p>
<aside class="dashboard__aside">
<DashboardProfileCard
:name="profile.name"
:location="profile.location"
:stats="profile.stats"
/>
<DashboardCalendar :month-label="calendar.month" :days="calendar.days" />
</aside>
</div>
</template>
<script setup>
import { gallery } from '@/utils/gallery'
import SvgIcon from '@/components/icons/SvgIcon.vue'
import BoxedIconTitleBlock from '@/components/blocks/BoxedIconTitleBlock.vue'
import DashboardStatCard from '@/features/student/pages/components/DashboardStatCard.vue'
import DashboardCalendar from '@/features/student/pages/components/DashboardCalendar.vue'
import DashboardProfileCard from '@/features/student/pages/components/DashboardProfileCard.vue'
import DashboardActivityCard from '@/features/student/pages/components/DashboardActivityCard.vue'
const flower = gallery.registrationCompleteFlower
const performanceStats = [
{
icon: 'clock',
label: 'ساعات آموزشی سپری‌شده',
value: '۲۵',
unit: 'ساعت',
subtitle: 'گذرانده شده',
},
{
icon: 'video',
label: 'دوره های خریداری شده',
value: '۶',
unit: 'دوره',
subtitle: 'خریداری شده',
},
{
icon: 'user-sound',
label: 'تعداد جلسات اعزام شده',
value: '۱۲',
unit: 'جلسه',
subtitle: 'اعزام شده است',
},
]
const activities = [
{
pillIcon: 'shopping-bag',
pillLabel: 'آخرین دوره خریداری شده',
title: 'دوره تاریخچه ایران قدیم',
metaIcon: 'calendar',
meta: [
{ label: 'تاریخ شروع:', value: '۱۴۰۰/۷/۱۹, ۸:۳۰', numeric: true },
{ label: 'استاد:', value: 'علیرضا حسنی' },
{ label: 'تاریخ پایان:', value: '۱۴۰۰/۱۱/۱۰, ۸:۳۰', numeric: true },
],
},
{
pillIcon: 'video',
pillLabel: 'اخرین جلسه دیده شده',
title: 'دوره تخصصی تربیت مبلغ بین الملل',
metaIcon: 'video',
meta: [
{ label: 'جلسه:', value: 'بیستم و دوم' },
{ label: 'استاد:', value: 'علیرضا حسنی' },
],
},
]
const profile = {
name: 'سید احمد علیزاده',
location: 'قم، ایران',
stats: [
{ label: 'مدت عضویت', value: '۲۳', unit: 'روز' },
{ label: 'دوره‌های تکمیل‌شده', value: '۱۲', unit: 'عدد' },
{ label: 'دوره‌های فعال', value: '۵', unit: 'عدد' },
],
}
const calendar = {
month: 'شهریور ماه',
days: [
{ weekday: 'شنبه', day: '۱۵' },
{ weekday: 'یکشنبه', day: '۱۴' },
{ weekday: 'دوشنبه', day: '۱۳', marker: true },
{ weekday: 'سه شنبه', day: '۱۲' },
{ weekday: 'چهارشنبه', day: '۱۱', selected: true },
{ weekday: 'پنجشنبه', day: '۱۰' },
{ weekday: 'جمعه', day: '۹' },
],
}
</script>
<style lang="scss" scoped>
.student-dashboard {
.dashboard {
display: flex;
flex-direction: column;
gap: 1.5rem;
flex-direction: column-reverse;
gap: 2rem;
&__welcome {
display: flex;
@media (min-width: 1024px) {
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
gap: 0.625rem;
}
&__flower {
object-fit: contain;
max-height: 2.75rem;
&__main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2rem;
}
&__hi {
font-family: var(--font-family-fa);
font-weight: 400;
font-size: 1rem;
color: var(--color-prim-gray);
margin: 0;
&__section {
display: flex;
flex-direction: column;
gap: 1.25rem;
}
&__greeting {
font-family: var(--font-family-fa);
font-weight: 500;
font-size: 1rem;
margin: 0;
&__stats {
display: grid;
grid-template-columns: 1fr;
gap: 0.875rem;
@media (min-width: 1024px) {
font-size: 1.5rem;
@media (min-width: 640px) {
grid-template-columns: repeat(3, 1fr);
}
}
&__placeholder {
&__activities {
display: grid;
grid-template-columns: 1fr;
gap: 1.25rem;
@media (min-width: 768px) {
grid-template-columns: repeat(2, 1fr);
}
}
&__activity {
display: flex;
flex-direction: column;
gap: 1rem;
}
&__pill {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 0.5rem;
padding: 0.75rem 1.25rem;
background: rgba(255, 255, 255, 58%);
box-shadow: 0 6.75px 19.425px rgba(0, 0, 0, 4%);
border-radius: 0.9375rem;
}
&__pill-icon {
order: 2;
}
&__pill-label {
order: 1;
font-family: var(--font-family-fa);
font-size: 0.875rem;
color: var(--color-prim-gray);
text-align: center;
padding: 3rem 0;
background: #fff;
border-radius: 1rem;
margin: 0;
font-weight: 500;
font-size: 1.125rem;
color: #4b4b4b;
}
&__aside {
display: flex;
flex-direction: column;
gap: 1.5rem;
@media (min-width: 1024px) {
width: 19.625rem;
flex-shrink: 0;
border-inline-start: 1px solid #e6e6e6;
padding-inline-start: 2rem;
}
}
}
</style>
@@ -0,0 +1,126 @@
<template>
<div class="activity-card">
<SvgIcon name="card-corner-arrow" :size="'1.5rem'" class="activity-card__corner" />
<div class="activity-card__thumb">
<SvgIcon name="play" :size="'1.5rem'" />
</div>
<div class="activity-card__body">
<p class="activity-card__title">{{ title }}</p>
<div class="activity-card__meta">
<SvgIcon :name="metaIcon" :size="'0.875rem'" class="activity-card__meta-icon" />
<div class="activity-card__rows">
<p v-for="(row, i) in meta" :key="i" class="activity-card__row">
<span class="activity-card__row-label">{{ row.label }}</span>
<span
class="activity-card__row-value"
:class="{ 'activity-card__row-value--num': row.numeric }"
>
{{ row.value }}
</span>
</p>
</div>
</div>
</div>
</div>
</template>
<script setup>
import SvgIcon from '@/components/icons/SvgIcon.vue'
defineProps({
title: { type: String, default: '' },
/** rows of { label, value, numeric? } */
meta: { type: Array, default: () => [] },
/** @type {import('vue').PropType<import('@/components/icons/icon-names').IconName>} */
metaIcon: { type: String, default: 'calendar' },
})
</script>
<style lang="scss" scoped>
.activity-card {
position: relative;
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.875rem 1rem;
min-height: 5.9375rem;
background: rgba(255, 255, 255, 58%);
box-shadow: 0 6.75px 19.425px rgba(0, 0, 0, 4%);
border-radius: 0.9375rem;
&__corner {
position: absolute;
inset-block-start: 0.75rem;
inset-inline-end: 1rem;
}
&__thumb {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
width: 3.6875rem;
height: 3.6875rem;
background: #f4f4f4;
border-radius: 0.9375rem;
}
&__body {
flex: 1;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.625rem;
text-align: start;
min-width: 0;
}
&__title {
margin: 0;
font-family: var(--font-family-fa);
font-weight: 400;
font-size: 0.875rem;
color: #4b4b4b;
}
&__meta {
display: flex;
align-items: flex-start;
justify-content: flex-start;
gap: 0.375rem;
}
&__meta-icon {
order: 2;
margin-top: 0.125rem;
}
&__rows {
order: 1;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
&__row {
display: flex;
align-items: center;
gap: 0.375rem;
margin: 0;
font-family: var(--font-family-fa);
font-weight: 400;
font-size: 0.6875rem;
color: #4b4b4b;
}
&__row-value {
&--num {
font-family: var(--font-family-number-fa);
direction: ltr;
}
}
}
</style>
@@ -0,0 +1,99 @@
<template>
<div class="calendar">
<p class="calendar__title">{{ monthLabel }}</p>
<div class="calendar__week">
<div
v-for="(d, i) in days"
:key="i"
class="calendar__day"
:class="{ 'calendar__day--active': d.selected }"
>
<span v-if="d.marker" class="calendar__marker" />
<span class="calendar__weekday">{{ d.weekday }}</span>
<span class="calendar__date">{{ d.day }}</span>
</div>
</div>
</div>
</template>
<script setup>
defineProps({
monthLabel: { type: String, default: '' },
/** ordered right-to-left: { weekday, day, selected?, marker? } */
days: { type: Array, default: () => [] },
})
</script>
<style lang="scss" scoped>
.calendar {
display: flex;
flex-direction: column;
gap: 0.75rem;
padding: 1.125rem 1rem;
background: rgba(255, 255, 255, 58%);
box-shadow: 0 6.75px 19.425px rgba(0, 0, 0, 4%);
border-radius: 0.9375rem;
&__title {
margin: 0;
text-align: start;
font-family: var(--font-family-fa);
font-weight: 500;
font-size: 1.25rem;
color: #000;
}
&__week {
display: flex;
justify-content: space-between;
gap: 0.125rem;
}
&__day {
position: relative;
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
padding: 0.375rem 0.125rem;
border-radius: 999px;
&--active {
background: var(--color-secondary);
box-shadow: 0 9px 9.75px rgba(0, 112, 116, 19%);
.calendar__weekday,
.calendar__date {
color: #fff;
}
}
}
&__marker {
position: absolute;
inset-block-start: 0.125rem;
inset-inline-start: 0.25rem;
width: 0.25rem;
height: 0.25rem;
border-radius: 50%;
background: var(--color-secondary);
}
&__weekday {
font-family: var(--font-family-fa);
font-weight: 400;
font-size: 0.625rem;
color: #828282;
white-space: nowrap;
}
&__date {
font-family: var(--font-family-number-fa);
font-weight: 700;
font-size: 0.875rem;
color: #717171;
}
}
</style>
@@ -0,0 +1,121 @@
<template>
<div class="profile-card">
<div class="profile-card__avatar">
<img v-if="avatarUrl" :src="avatarUrl" :alt="name" />
</div>
<p class="profile-card__name">{{ name }}</p>
<div class="profile-card__location">
<SvgIcon name="map-pin-simple-area" :size="'0.9375rem'" />
<span>{{ location }}</span>
</div>
<div class="profile-card__stats">
<div v-for="(stat, i) in stats" :key="i" class="profile-card__stat">
<span class="profile-card__stat-label">{{ stat.label }}</span>
<span class="profile-card__stat-value">
{{ stat.value }}
<span class="profile-card__stat-unit">{{ stat.unit }}</span>
</span>
</div>
</div>
</div>
</template>
<script setup>
import SvgIcon from '@/components/icons/SvgIcon.vue'
defineProps({
name: { type: String, default: '' },
location: { type: String, default: '' },
avatarUrl: { type: String, default: '' },
/** mini-stats of { label, value, unit } */
stats: { type: Array, default: () => [] },
})
</script>
<style lang="scss" scoped>
.profile-card {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.75rem;
padding: 2rem 1.25rem 1.5rem;
background: rgba(255, 255, 255, 58%);
box-shadow: 0 6.75px 19.425px rgba(0, 0, 0, 4%);
border-radius: 0.9375rem;
&__avatar {
width: 7.75rem;
height: 7.75rem;
border-radius: 50%;
background: #f4f4f4;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
&__name {
margin: 0;
font-family: var(--font-family-fa);
font-weight: 500;
font-size: 1.25rem;
color: #000;
}
&__location {
display: flex;
align-items: center;
gap: 0.25rem;
font-family: var(--font-family-fa);
font-weight: 400;
font-size: 0.875rem;
color: #989898;
}
&__stats {
display: flex;
justify-content: space-between;
align-items: flex-start;
width: 100%;
margin-top: 0.5rem;
}
&__stat {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
flex: 1;
}
&__stat-label {
font-family: var(--font-family-fa);
font-weight: 500;
font-size: 0.6875rem;
color: #a7a7a7;
}
&__stat-value {
display: inline-flex;
align-items: baseline;
gap: 0.25rem;
font-family: var(--font-family-number-fa);
font-weight: 400;
font-size: 1.5625rem;
color: #818181;
}
&__stat-unit {
font-family: var(--font-family-fa);
font-weight: 300;
font-size: 0.75rem;
color: #929292;
}
}
</style>
@@ -0,0 +1,108 @@
<template>
<div class="stat-card">
<SvgIcon name="card-corner-arrow" :size="'1.5rem'" class="stat-card__corner" />
<div class="stat-card__head">
<SvgIcon :name="icon" :size="'1.0625rem'" class="stat-card__head-icon" />
<span class="stat-card__label">{{ label }}</span>
</div>
<div class="stat-card__body">
<span class="stat-card__value">{{ value }}</span>
<div class="stat-card__meta">
<span class="stat-card__unit">{{ unit }}</span>
<span class="stat-card__subtitle">{{ subtitle }}</span>
</div>
</div>
</div>
</template>
<script setup>
import SvgIcon from '@/components/icons/SvgIcon.vue'
defineProps({
/** @type {import('vue').PropType<import('@/components/icons/icon-names').IconName>} */
icon: { type: String, required: true },
label: { type: String, default: '' },
value: { type: [String, Number], default: '' },
unit: { type: String, default: '' },
subtitle: { type: String, default: '' },
})
</script>
<style lang="scss" scoped>
.stat-card {
position: relative;
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 1.125rem 1.25rem;
min-height: 8.75rem;
background: rgba(255, 255, 255, 58%);
box-shadow: 0 6.75px 19.425px rgba(0, 0, 0, 4%);
border-radius: 0.9375rem;
&__corner {
position: absolute;
inset-block-start: 0.875rem;
inset-inline-end: 1.125rem;
}
&__head {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 0.375rem;
}
&__head-icon {
order: 2;
}
&__label {
order: 1;
font-family: var(--font-family-fa);
font-weight: 500;
font-size: 1.125rem;
color: #4b4b4b;
}
&__body {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 0.625rem;
margin-top: auto;
}
&__value {
font-family: var(--font-family-number-fa);
font-weight: 700;
font-size: 4rem;
line-height: 1;
color: var(--color-primary);
text-shadow: 0 5.25px 8.625px rgba(243, 102, 117, 18%);
}
&__meta {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.125rem;
}
&__unit {
font-family: var(--font-family-fa);
font-weight: 300;
font-size: 1.125rem;
color: #6e6e6e;
}
&__subtitle {
font-family: var(--font-family-fa);
font-weight: 500;
font-size: 1.25rem;
color: #6e6e6e;
}
}
</style>