Files
CRM_Montzar/apps/web/src/layouts/AdmLayout.vue
T

425 lines
9.0 KiB
Vue
Raw Normal View History

2026-09-19 21:54:21 +03:30
<script setup lang="ts">
import { computed } from 'vue';
import { RouterLink, RouterView, useRoute, useRouter } from 'vue-router';
2026-09-19 21:54:21 +03:30
import { usePlatformAuthStore } from '@/stores/platform-auth';
import UiIcon from '@/components/UiIcon.vue';
import MentoLogo from '@/components/brand/MentoLogo.vue';
import BrandName from '@/components/brand/BrandName.vue';
const platform = usePlatformAuthStore();
const router = useRouter();
const route = useRoute();
2026-09-19 21:54:21 +03:30
const displayName = computed(() => platform.admin?.fullName || 'سوپرادمین');
const pageTitle = computed(() => {
switch (route.name) {
case 'adm-dashboard':
return 'داشبورد';
case 'adm-organizations':
return 'محیط‌ها';
case 'adm-users':
return 'کاربران';
case 'adm-admins':
return 'ادمین‌ها';
default:
return 'سوپرادمین';
}
});
const tabs = [
{ name: 'adm-dashboard', label: 'خانه', icon: 'home' as const },
{ name: 'adm-organizations', label: 'محیط‌ها', icon: 'building' as const },
{ name: 'adm-users', label: 'کاربران', icon: 'users' as const },
{ name: 'adm-admins', label: 'ادمین‌ها', icon: 'lock' as const },
];
2026-09-19 21:54:21 +03:30
function onLogout() {
platform.logout();
void router.push({ name: 'adm-login' });
}
</script>
<template>
<div class="adm-shell">
<aside class="sidebar desktop-only">
2026-09-19 21:54:21 +03:30
<div class="brand">
<div class="brand-mark">
<MentoLogo :size="36" :show-text="false" />
</div>
2026-09-19 21:54:21 +03:30
<div class="brand-copy">
<BrandName />
<span>کنترل پلتفرم</span>
2026-09-19 21:54:21 +03:30
</div>
</div>
<nav class="nav" aria-label="منوی سوپرادمین">
<RouterLink
v-for="tab in tabs"
:key="tab.name"
:to="{ name: tab.name }"
class="nav-item"
>
<span class="nav-ico" aria-hidden="true">
<UiIcon :name="tab.icon" :size="18" />
</span>
<span>{{ tab.label }}</span>
2026-09-19 22:42:51 +03:30
</RouterLink>
2026-09-19 21:54:21 +03:30
</nav>
<div class="side-foot">
<div class="who-card">
<span class="who-avatar" aria-hidden="true">
{{ displayName.slice(0, 1) }}
</span>
<div class="who-meta">
<strong>{{ displayName }}</strong>
<small>سوپرادمین</small>
</div>
</div>
2026-09-19 21:54:21 +03:30
<button type="button" class="logout" @click="onLogout">
<UiIcon name="logout" :size="16" />
<span>خروج</span>
</button>
</div>
</aside>
<div class="stage">
<header class="topbar">
<div class="top-brand mobile-only">
<MentoLogo :size="28" :show-text="false" />
<div>
<strong>{{ pageTitle }}</strong>
<small>سوپرادمین</small>
</div>
</div>
<div class="top-desktop desktop-only">
<h1>{{ pageTitle }}</h1>
<p>مدیریت حساب‌ها، اشتراک و ماژول‌ها</p>
</div>
<button type="button" class="logout-top mobile-only" @click="onLogout">
<UiIcon name="logout" :size="18" />
</button>
</header>
<main class="main">
<RouterView />
</main>
</div>
<nav class="tabbar" aria-label="ناوبری پایین">
<RouterLink
v-for="tab in tabs"
:key="tab.name"
:to="{ name: tab.name }"
class="tab"
>
<UiIcon :name="tab.icon" :size="20" />
<span>{{ tab.label }}</span>
</RouterLink>
</nav>
2026-09-19 21:54:21 +03:30
</div>
</template>
<style scoped>
.adm-shell {
min-height: 100vh;
min-height: 100dvh;
display: grid;
grid-template-columns: 260px minmax(0, 1fr);
background:
radial-gradient(ellipse 70% 45% at 100% -10%, rgba(20, 184, 166, 0.14), transparent 55%),
radial-gradient(ellipse 50% 35% at 0% 100%, rgba(14, 165, 233, 0.08), transparent 50%),
linear-gradient(180deg, #f4fbfa 0%, var(--bg) 40%);
}
.desktop-only {
display: flex;
}
.mobile-only {
display: none;
2026-09-19 21:54:21 +03:30
}
.sidebar {
flex-direction: column;
gap: 1.35rem;
padding: 1.25rem 1rem;
background: rgba(255, 255, 255, 0.86);
backdrop-filter: blur(12px);
border-inline-end: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
box-shadow: 10px 0 40px rgba(15, 23, 42, 0.04);
2026-09-19 21:54:21 +03:30
}
.brand {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.35rem 0.4rem;
}
.brand-mark {
display: grid;
place-items: center;
width: 48px;
height: 48px;
border-radius: 16px;
background: linear-gradient(145deg, var(--accent-subtle), #fff);
border: 1px solid color-mix(in srgb, var(--accent) 18%, white);
box-shadow: 0 8px 20px rgba(13, 148, 136, 0.08);
2026-09-19 21:54:21 +03:30
}
.brand-copy {
display: grid;
min-width: 0;
gap: 0.1rem;
2026-09-19 21:54:21 +03:30
}
.brand-copy span {
color: var(--muted);
font-size: 0.72rem;
font-weight: 800;
letter-spacing: -0.01em;
2026-09-19 21:54:21 +03:30
}
.nav {
display: grid;
gap: 0.35rem;
2026-09-19 21:54:21 +03:30
flex: 1;
align-content: start;
2026-09-19 21:54:21 +03:30
}
.nav-item {
display: flex;
align-items: center;
gap: 0.7rem;
padding: 0.72rem 0.8rem;
border-radius: 14px;
2026-09-19 21:54:21 +03:30
color: var(--ink-secondary);
text-decoration: none;
font-weight: 750;
font-size: 0.92rem;
transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.nav-item:hover {
background: rgba(255, 255, 255, 0.9);
color: var(--ink);
}
.nav-ico {
display: grid;
place-items: center;
width: 34px;
height: 34px;
border-radius: 11px;
background: var(--surface-subtle);
color: var(--muted);
2026-09-19 21:54:21 +03:30
}
.nav-item.router-link-active {
background: linear-gradient(135deg, var(--accent-subtle), #fff);
2026-09-19 21:54:21 +03:30
color: var(--accent-deep);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, white);
}
.nav-item.router-link-active .nav-ico {
background: var(--accent);
color: #fff;
2026-09-19 21:54:21 +03:30
}
.side-foot {
display: grid;
gap: 0.65rem;
padding-top: 0.35rem;
border-top: 1px solid var(--line-light);
2026-09-19 21:54:21 +03:30
}
.who-card {
display: flex;
align-items: center;
gap: 0.65rem;
padding: 0.55rem;
border-radius: 14px;
background: #fff;
border: 1px solid var(--line-light);
}
.who-avatar {
display: grid;
place-items: center;
width: 40px;
height: 40px;
border-radius: 12px;
background: var(--accent-soft);
color: var(--accent-deep);
font-weight: 900;
}
.who-meta {
display: grid;
min-width: 0;
}
.who-meta strong {
font-size: 0.86rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.who-meta small {
2026-09-19 21:54:21 +03:30
color: var(--muted);
font-size: 0.72rem;
2026-09-19 21:54:21 +03:30
font-weight: 700;
}
.logout {
display: inline-flex;
align-items: center;
justify-content: center;
2026-09-19 21:54:21 +03:30
gap: 0.4rem;
border: 1px solid var(--line);
background: #fff;
color: var(--muted);
2026-09-19 21:54:21 +03:30
font: inherit;
font-size: 0.82rem;
font-weight: 750;
cursor: pointer;
padding: 0.55rem 0.75rem;
border-radius: 12px;
}
.logout:hover {
color: var(--danger);
border-color: color-mix(in srgb, var(--danger) 30%, white);
}
.stage {
min-width: 0;
display: flex;
flex-direction: column;
min-height: 100dvh;
}
.topbar {
position: sticky;
top: 0;
z-index: 20;
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.75rem;
padding: 1rem 1.5rem 0.85rem;
background: color-mix(in srgb, #f4fbfa 78%, transparent);
backdrop-filter: blur(14px);
border-bottom: 1px solid transparent;
}
.top-desktop h1 {
margin: 0;
font-size: 1.35rem;
letter-spacing: -0.02em;
}
.top-desktop p {
margin: 0.2rem 0 0;
color: var(--muted);
font-size: 0.84rem;
}
.top-brand {
display: flex;
align-items: center;
gap: 0.65rem;
}
.top-brand strong {
display: block;
font-size: 1rem;
}
.top-brand small {
color: var(--muted);
font-size: 0.72rem;
font-weight: 700;
}
.logout-top {
border: 0;
background: #fff;
width: 40px;
height: 40px;
border-radius: 12px;
display: grid;
place-items: center;
color: var(--muted);
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
2026-09-19 21:54:21 +03:30
cursor: pointer;
}
.main {
flex: 1;
2026-09-19 21:54:21 +03:30
min-width: 0;
padding: 0.4rem 1.5rem 2rem;
2026-09-19 21:54:21 +03:30
}
.tabbar {
display: none;
position: sticky;
bottom: 0;
z-index: 30;
grid-template-columns: repeat(4, 1fr);
gap: 0.15rem;
padding: 0.45rem 0.55rem calc(0.45rem + env(safe-area-inset-bottom));
background: rgba(255, 255, 255, 0.92);
backdrop-filter: blur(16px);
border-top: 1px solid var(--line-light);
box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.06);
}
.tab {
display: grid;
justify-items: center;
gap: 0.15rem;
padding: 0.45rem 0.2rem;
border-radius: 12px;
text-decoration: none;
color: var(--muted);
font-size: 0.68rem;
font-weight: 800;
}
.tab.router-link-active {
color: var(--accent-deep);
background: var(--accent-subtle);
}
@media (max-width: 860px) {
2026-09-19 21:54:21 +03:30
.adm-shell {
grid-template-columns: 1fr;
}
.desktop-only {
display: none !important;
2026-09-19 21:54:21 +03:30
}
.mobile-only {
display: flex;
2026-09-19 21:54:21 +03:30
}
.topbar {
padding: 0.75rem 0.9rem;
border-bottom: 1px solid var(--line-light);
2026-09-19 21:54:21 +03:30
}
.main {
padding: 0.75rem 0.9rem calc(1.2rem + env(safe-area-inset-bottom));
}
.tabbar {
display: grid;
2026-09-19 21:54:21 +03:30
}
}
</style>