feat: complete url modal/tab deeplinking, standardized inputs, and sync dynamic menu
Deploy Canina / deploy (push) Successful in 1m44s
Deploy Canina / deploy (push) Successful in 1m44s
This commit is contained in:
1 parent
33c1bee483
commit
5029edaaeb
9 files changed
+454
-70
No files matched your search
@@ -30,14 +30,62 @@ export class MenuService implements OnModuleInit {
|
||||
return;
|
||||
}
|
||||
|
||||
// Seed with current site navigation
|
||||
const headerItems = [
|
||||
{ label: 'راهکارهای درمانی', href: '/shop?view=symptoms', order: 1 },
|
||||
{ label: 'محصولات تخصصی', href: '/shop', order: 2 },
|
||||
{ label: 'دانشنامه علمی', href: '/wiki', order: 3 },
|
||||
{ label: 'مجله سلامت پت', href: '/blog', order: 4 },
|
||||
{ label: 'شناسنامه پتها', href: '/dashboard/pets', order: 5 },
|
||||
{ label: 'ویدیوها', href: '/videos', order: 6 },
|
||||
// Seed with comprehensive hierarchical site navigation matching application
|
||||
const headerGroups = [
|
||||
{
|
||||
label: 'دستهبندی درمانی محصولات',
|
||||
href: '/shop?view=symptoms',
|
||||
order: 1,
|
||||
icon: 'Pill',
|
||||
children: [
|
||||
{ label: 'مفاصل و استخوان', href: '/shop?category=joints', order: 1 },
|
||||
{ label: 'تقویت سیستم ایمنی و گوارش', href: '/shop?category=immune', order: 2 },
|
||||
{ label: 'ویتامینها و انرژیبخشها', href: '/shop?category=energy', order: 3 },
|
||||
{ label: 'مراقبتهای ویژه (پوست، دندان و چشم)', href: '/shop?category=special-care', order: 4 },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'فروشگاه و محصولات',
|
||||
href: '/shop',
|
||||
order: 2,
|
||||
icon: 'ShoppingBag',
|
||||
children: [
|
||||
{ label: 'فروشگاه تخصصی محصولات کنینا', href: '/shop', order: 1 },
|
||||
{ label: 'کاتالوگ دیجیتال و راهنمای بالینی', href: '/catalog', order: 2 },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'دانشنامه و آکادمی',
|
||||
href: '/wiki',
|
||||
order: 3,
|
||||
icon: 'BookOpen',
|
||||
children: [
|
||||
{ label: 'دانشنامه علمی کنینا', href: '/wiki', order: 1 },
|
||||
{ label: 'مجله سلامت پت (وبلاگ)', href: '/blog', order: 2 },
|
||||
{ label: 'آکادمی ویدئویی و مشاوره دامپزشک', href: '/videos', order: 3 },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'ابزارهای هوشمند',
|
||||
href: '/profile',
|
||||
order: 4,
|
||||
icon: 'Sparkles',
|
||||
children: [
|
||||
{ label: 'شناسنامه و سوابق سلامت پت', href: '/profile', order: 1 },
|
||||
{ label: 'پایش هوشمند مصرف مکملها', href: '/dashboard', order: 2 },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'درباره کنینا و تماس',
|
||||
href: '/about',
|
||||
order: 5,
|
||||
icon: 'Building2',
|
||||
children: [
|
||||
{ label: 'درباره کمپانی کنینا آلمان', href: '/about', order: 1 },
|
||||
{ label: 'نمادهای اعتماد و مجوزهای رسمی', href: '/trust-seals', order: 2 },
|
||||
{ label: 'تماس با مرکز پشتیبانی', href: '/contact', order: 3 },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const footerCol1 = [
|
||||
@@ -48,20 +96,48 @@ export class MenuService implements OnModuleInit {
|
||||
];
|
||||
|
||||
const footerCol2 = [
|
||||
{ label: 'فروشگاه تخصصی', href: '/shop', order: 1 },
|
||||
{ label: 'دستهٔبندی درمانی', href: '/shop?view=symptoms', order: 2 },
|
||||
{ label: 'محصولات تخصصی', href: '/shop', order: 1 },
|
||||
{ label: 'کاتالوگ دیجیتال', href: '/catalog', order: 2 },
|
||||
{ label: 'دانشنامه علمی', href: '/wiki', order: 3 },
|
||||
{ label: 'مجله سلامت پت', href: '/blog', order: 4 },
|
||||
{ label: 'مجله سلامت پت (وبلاگ)', href: '/blog', order: 4 },
|
||||
];
|
||||
|
||||
const footerCol3 = [
|
||||
{ label: 'شناسنامه پتها', href: '/dashboard/pets', order: 1 },
|
||||
{ label: 'شناسنامه پتها', href: '/profile', order: 1 },
|
||||
{ label: 'سفارشات من', href: '/dashboard/orders', order: 2 },
|
||||
{ label: 'ردیابی سفارش', href: '/track', order: 3 },
|
||||
{ label: 'ورود / ثبتنام', href: '/?login=1', order: 4 },
|
||||
];
|
||||
|
||||
const createItems = (items: typeof headerItems, menuType: MenuType) =>
|
||||
for (const group of headerGroups) {
|
||||
const parent = await this.prisma.menuItem.create({
|
||||
data: {
|
||||
label: group.label,
|
||||
href: group.href,
|
||||
order: group.order,
|
||||
icon: group.icon,
|
||||
menuType: 'HEADER',
|
||||
isActive: true,
|
||||
isExternal: false,
|
||||
},
|
||||
});
|
||||
|
||||
if (group.children && group.children.length > 0) {
|
||||
await this.prisma.menuItem.createMany({
|
||||
data: group.children.map((child) => ({
|
||||
label: child.label,
|
||||
href: child.href,
|
||||
order: child.order,
|
||||
parentId: parent.id,
|
||||
menuType: 'HEADER',
|
||||
isActive: true,
|
||||
isExternal: false,
|
||||
})),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const createFooterItems = (items: typeof footerCol1, menuType: MenuType) =>
|
||||
items.map((item) => ({
|
||||
...item,
|
||||
menuType,
|
||||
@@ -71,14 +147,14 @@ export class MenuService implements OnModuleInit {
|
||||
|
||||
await this.prisma.menuItem.createMany({
|
||||
data: [
|
||||
...createItems(headerItems, 'HEADER'),
|
||||
...createItems(footerCol1, 'FOOTER_COL1'),
|
||||
...createItems(footerCol2, 'FOOTER_COL2'),
|
||||
...createItems(footerCol3, 'FOOTER_COL3'),
|
||||
...createFooterItems(footerCol1, 'FOOTER_COL1'),
|
||||
...createFooterItems(footerCol2, 'FOOTER_COL2'),
|
||||
...createFooterItems(footerCol3, 'FOOTER_COL3'),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async findByType(menuType: string) {
|
||||
const items = await this.prisma.menuItem.findMany({
|
||||
where: { menuType, isActive: true, parentId: null },
|
||||
|
||||
Reference in new issue
Block a user