195 lines
6.8 KiB
TypeScript
195 lines
6.8 KiB
TypeScript
import { Routes } from '@angular/router';
|
|
// Core components (eagerly loaded - needed for initial navigation)
|
|
import { LogoutComponent } from './components/logout/logout.component';
|
|
import { NotFoundComponent } from './components/not-found/not-found.component';
|
|
import { TestSsrComponent } from './components/test-ssr/test-ssr.component';
|
|
import { EmailAuthorizedComponent } from './components/email-authorized/email-authorized.component';
|
|
import { EmailVerificationComponent } from './components/email-verification/email-verification.component';
|
|
import { LoginRegisterComponent } from './components/login-register/login-register.component';
|
|
|
|
// Guards
|
|
import { AuthGuard } from './guards/auth.guard';
|
|
import { ListingCategoryGuard } from './guards/listing-category.guard';
|
|
|
|
// Public pages (eagerly loaded - high traffic)
|
|
import { DetailsBusinessListingComponent } from './pages/details/details-business-listing/details-business-listing.component';
|
|
import { DetailsCommercialPropertyListingComponent } from './pages/details/details-commercial-property-listing/details-commercial-property-listing.component';
|
|
import { DetailsUserComponent } from './pages/details/details-user/details-user.component';
|
|
import { HomeComponent } from './pages/home/home.component';
|
|
import { BrokerListingsComponent } from './pages/listings/broker-listings/broker-listings.component';
|
|
import { BusinessListingsComponent } from './pages/listings/business-listings/business-listings.component';
|
|
import { CommercialPropertyListingsComponent } from './pages/listings/commercial-property-listings/commercial-property-listings.component';
|
|
import { SuccessComponent } from './pages/success/success.component';
|
|
import { TermsOfUseComponent } from './pages/legal/terms-of-use.component';
|
|
import { PrivacyStatementComponent } from './pages/legal/privacy-statement.component';
|
|
|
|
// Note: Account, Edit, Admin, Favorites, MyListing, and EmailUs components are now lazy-loaded below
|
|
|
|
export const routes: Routes = [
|
|
{
|
|
path: 'test-ssr',
|
|
component: TestSsrComponent,
|
|
},
|
|
{
|
|
path: 'businessListings',
|
|
component: BusinessListingsComponent,
|
|
runGuardsAndResolvers: 'always',
|
|
},
|
|
{
|
|
path: 'commercialPropertyListings',
|
|
component: CommercialPropertyListingsComponent,
|
|
runGuardsAndResolvers: 'always',
|
|
},
|
|
{
|
|
path: 'brokerListings',
|
|
component: BrokerListingsComponent,
|
|
runGuardsAndResolvers: 'always',
|
|
},
|
|
{
|
|
path: 'home',
|
|
component: HomeComponent,
|
|
},
|
|
// #########
|
|
// Listings Details - New SEO-friendly slug-based URLs
|
|
{
|
|
path: 'business/:slug',
|
|
component: DetailsBusinessListingComponent,
|
|
},
|
|
{
|
|
path: 'commercial-property/:slug',
|
|
component: DetailsCommercialPropertyListingComponent,
|
|
},
|
|
// Backward compatibility redirects for old UUID-based URLs
|
|
{
|
|
path: 'details-business-listing/:id',
|
|
redirectTo: 'business/:id',
|
|
pathMatch: 'full',
|
|
},
|
|
{
|
|
path: 'details-commercial-property-listing/:id',
|
|
redirectTo: 'commercial-property/:id',
|
|
pathMatch: 'full',
|
|
},
|
|
{
|
|
path: 'listing/:id',
|
|
canActivate: [ListingCategoryGuard],
|
|
component: NotFoundComponent, // Dummy-Komponente, wird nie angezeigt, da der Guard weiterleitet
|
|
},
|
|
// {
|
|
// path: 'login/:page',
|
|
// component: LoginComponent, // Dummy-Komponente, wird nie angezeigt, da der Guard weiterleitet
|
|
// },
|
|
{
|
|
path: 'login/:page',
|
|
component: LoginRegisterComponent, // Dummy-Komponente, wird nie angezeigt, da der Guard weiterleitet
|
|
},
|
|
{
|
|
path: 'login',
|
|
component: LoginRegisterComponent, // Dummy-Komponente, wird nie angezeigt, da der Guard weiterleitet
|
|
},
|
|
{
|
|
path: 'notfound',
|
|
component: NotFoundComponent,
|
|
},
|
|
// #########
|
|
// User Details
|
|
{
|
|
path: 'details-user/:id',
|
|
component: DetailsUserComponent,
|
|
},
|
|
// #########
|
|
// User edit (lazy-loaded)
|
|
{
|
|
path: 'account',
|
|
loadComponent: () => import('./pages/subscription/account/account.component').then(m => m.AccountComponent),
|
|
canActivate: [AuthGuard],
|
|
},
|
|
{
|
|
path: 'account/:id',
|
|
loadComponent: () => import('./pages/subscription/account/account.component').then(m => m.AccountComponent),
|
|
canActivate: [AuthGuard],
|
|
},
|
|
// #########
|
|
// Create, Update Listings (lazy-loaded)
|
|
{
|
|
path: 'editBusinessListing/:id',
|
|
loadComponent: () => import('./pages/subscription/edit-business-listing/edit-business-listing.component').then(m => m.EditBusinessListingComponent),
|
|
canActivate: [AuthGuard],
|
|
},
|
|
{
|
|
path: 'createBusinessListing',
|
|
loadComponent: () => import('./pages/subscription/edit-business-listing/edit-business-listing.component').then(m => m.EditBusinessListingComponent),
|
|
canActivate: [AuthGuard],
|
|
},
|
|
{
|
|
path: 'editCommercialPropertyListing/:id',
|
|
loadComponent: () => import('./pages/subscription/edit-commercial-property-listing/edit-commercial-property-listing.component').then(m => m.EditCommercialPropertyListingComponent),
|
|
canActivate: [AuthGuard],
|
|
},
|
|
{
|
|
path: 'createCommercialPropertyListing',
|
|
loadComponent: () => import('./pages/subscription/edit-commercial-property-listing/edit-commercial-property-listing.component').then(m => m.EditCommercialPropertyListingComponent),
|
|
canActivate: [AuthGuard],
|
|
},
|
|
// #########
|
|
// My Listings (lazy-loaded)
|
|
{
|
|
path: 'myListings',
|
|
loadComponent: () => import('./pages/subscription/my-listing/my-listing.component').then(m => m.MyListingComponent),
|
|
canActivate: [AuthGuard],
|
|
},
|
|
// #########
|
|
// My Favorites (lazy-loaded)
|
|
{
|
|
path: 'myFavorites',
|
|
loadComponent: () => import('./pages/subscription/favorites/favorites.component').then(m => m.FavoritesComponent),
|
|
canActivate: [AuthGuard],
|
|
},
|
|
// #########
|
|
// Email Us (lazy-loaded)
|
|
{
|
|
path: 'emailUs',
|
|
loadComponent: () => import('./pages/subscription/email-us/email-us.component').then(m => m.EmailUsComponent),
|
|
// canActivate: [AuthGuard],
|
|
},
|
|
// #########
|
|
// Logout
|
|
{
|
|
path: 'logout',
|
|
component: LogoutComponent,
|
|
canActivate: [AuthGuard],
|
|
},
|
|
// #########
|
|
// Email Verification
|
|
{
|
|
path: 'emailVerification',
|
|
component: EmailVerificationComponent,
|
|
},
|
|
{
|
|
path: 'email-authorized',
|
|
component: EmailAuthorizedComponent,
|
|
},
|
|
{
|
|
path: 'success',
|
|
component: SuccessComponent,
|
|
},
|
|
// #########
|
|
// Admin Pages (lazy-loaded)
|
|
{
|
|
path: 'admin/users',
|
|
loadComponent: () => import('./pages/admin/user-list/user-list.component').then(m => m.UserListComponent),
|
|
canActivate: [AuthGuard],
|
|
},
|
|
// #########
|
|
// Legal Pages
|
|
{
|
|
path: 'terms-of-use',
|
|
component: TermsOfUseComponent,
|
|
},
|
|
{
|
|
path: 'privacy-statement',
|
|
component: PrivacyStatementComponent,
|
|
},
|
|
{ path: '**', redirectTo: 'home' },
|
|
];
|