feat: implement scalable multi-brand architecture
Architecture: - Each brand has its own pages folder with Angular components - brand-routes.ts defines routes for default brand (dexar) - brand-routes.novo.ts defines routes for novo brand - angular.json fileReplacements swaps brand-routes.ts based on build config Structure: - src/app/brands/dexar/pages/ - Dexar HTML templates - src/app/brands/novo/pages/ - Novo components (TS + HTML) - src/app/brands/brand-routes.ts - Default (dexar) routes - src/app/brands/brand-routes.novo.ts - Novo routes This approach allows: - Adding 3rd, 4th, 5th brands by creating new folders - Each brand has completely separate templates - No @if conditionals needed in templates - Build-time separation (zero runtime overhead)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { brandInfoRoutes, brandLegalRoutes } from './brands/brand-routes';
|
||||
|
||||
export const routes: Routes = [
|
||||
// Core routes (same across all brands)
|
||||
const coreRoutes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
loadComponent: () => import('./pages/home/home.component').then(m => m.HomeComponent)
|
||||
@@ -24,49 +26,16 @@ export const routes: Routes = [
|
||||
{
|
||||
path: 'cart',
|
||||
loadComponent: () => import('./pages/cart/cart.component').then(m => m.CartComponent)
|
||||
},
|
||||
{
|
||||
path: 'company-details',
|
||||
loadComponent: () => import('./pages/legal/company-details/company-details.component').then(m => m.CompanyDetailsComponent)
|
||||
},
|
||||
{
|
||||
path: 'payment-terms',
|
||||
loadComponent: () => import('./pages/legal/payment-terms/payment-terms.component').then(m => m.PaymentTermsComponent)
|
||||
},
|
||||
{
|
||||
path: 'return-policy',
|
||||
loadComponent: () => import('./pages/legal/return-policy/return-policy.component').then(m => m.ReturnPolicyComponent)
|
||||
},
|
||||
{
|
||||
path: 'public-offer',
|
||||
loadComponent: () => import('./pages/legal/public-offer/public-offer.component').then(m => m.PublicOfferComponent)
|
||||
},
|
||||
{
|
||||
path: 'privacy-policy',
|
||||
loadComponent: () => import('./pages/legal/privacy-policy/privacy-policy.component').then(m => m.PrivacyPolicyComponent)
|
||||
},
|
||||
{
|
||||
path: 'about',
|
||||
loadComponent: () => import('./pages/info/about/about.component').then(m => m.AboutComponent)
|
||||
},
|
||||
{
|
||||
path: 'contacts',
|
||||
loadComponent: () => import('./pages/info/contacts/contacts.component').then(m => m.ContactsComponent)
|
||||
},
|
||||
{
|
||||
path: 'faq',
|
||||
loadComponent: () => import('./pages/info/faq/faq.component').then(m => m.FaqComponent)
|
||||
},
|
||||
{
|
||||
path: 'delivery',
|
||||
loadComponent: () => import('./pages/info/delivery/delivery.component').then(m => m.DeliveryComponent)
|
||||
},
|
||||
{
|
||||
path: 'guarantee',
|
||||
loadComponent: () => import('./pages/info/guarantee/guarantee.component').then(m => m.GuaranteeComponent)
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
// Combine core routes with brand-specific routes
|
||||
export const routes: Routes = [
|
||||
...coreRoutes,
|
||||
...brandInfoRoutes,
|
||||
...brandLegalRoutes,
|
||||
{
|
||||
path: '**',
|
||||
redirectTo: ''
|
||||
}
|
||||
];
|
||||
];
|
||||
Reference in New Issue
Block a user