Skip to content

Commit

Permalink
fix: routing and remaining imports
Browse files Browse the repository at this point in the history
only layout pages should have the prefix "layout". "Module" routes are now loaded from main.ts
  • Loading branch information
michaelschoenbaechler committed Feb 9, 2024
1 parent 53e29d0 commit ed35b5f
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { Browser } from '@capacitor/browser';
import { Business } from 'swissparl';
import { TextCardComponent } from '../../../shared/components/text-card/text-card.component';
import { IonicModule } from '@ionic/angular';
import { NgIf } from '@angular/common';

@Component({
selector: 'app-business-detail-text',
templateUrl: './business-detail-text.component.html',
styleUrls: ['./business-detail-text.component.scss'],
standalone: true,
imports: [IonicModule, TextCardComponent]
imports: [NgIf, IonicModule, TextCardComponent]
})
export class BusinessDetailTextComponent {
@Input() business: Business;
Expand Down
12 changes: 0 additions & 12 deletions src/app/business/routes.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
import { Route } from '@angular/router';

export const BUSINESS_ROUTES: Route[] = [
{
path: 'list',
loadComponent: () =>
import('./containers/business-list/business-list.page').then(
(m) => m.BusinessListPage
)
},
{
path: 'detail/:id',
loadComponent: () =>
import('./containers/business-detail/business-detail.page').then(
(m) => m.BusinessDetailPage
)
},
{
path: '',
redirectTo: 'list',
pathMatch: 'full'
}
];
12 changes: 0 additions & 12 deletions src/app/council-member/routes.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
import { Route } from '@angular/router';

export const COUNCIL_MEMBER_ROUTES: Route[] = [
{
path: 'list',
loadComponent: () =>
import('./containers/member-list/member-list.page').then(
(m) => m.MemberListPage
)
},
{
path: 'detail/:id',
loadComponent: () =>
import('./containers/member-detail/member-detail.page').then(
(m) => m.MemberDetailPage
)
},
{
path: '',
redirectTo: 'list',
pathMatch: 'full'
}
];
26 changes: 13 additions & 13 deletions src/app/layout/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@ export const TAB_ROUTES: Routes = [
children: [
{
path: 'votes',
loadChildren: () =>
import('../votes/routes').then((mod) => mod.VOTE_ROUTES)
loadComponent: () =>
import('../votes/containers/vote-list/vote-list.page').then(
(m) => m.VoteListPage
)
},
{
path: 'council-member',
loadChildren: () =>
import('../council-member/routes').then(
(mod) => mod.COUNCIL_MEMBER_ROUTES
)
loadComponent: () =>
import(
'../council-member/containers/member-list/member-list.page'
).then((m) => m.MemberListPage)
},
{
path: 'business',
loadChildren: () =>
import('../business/routes').then((mod) => mod.BUSINESS_ROUTES)
loadComponent: () =>
import(
'../business/containers/business-list/business-list.page'
).then((m) => m.BusinessListPage)
},

{
path: 'settings',
loadComponent: () =>
import(
'../settings/containers/settings-overview/settings-overview.page'
).then((mod) => mod.SettingsOverviewPage)
},
{
path: '',
redirectTo: '/layout/votes/list',
pathMatch: 'full'
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion src/app/votes/containers/vote-detail/vote-detail.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { VoteCardComponent } from '../../components/vote-card/vote-card.componen
import { TextCardComponent } from '../../../shared/components/text-card/text-card.component';
import { LoadingScreenComponent } from '../../../shared/components/loading-screen/loading-screen.component';
import { ErrorScreenComponent } from '../../../shared/components/error-screen/error-screen.component';
import { NgIf } from '@angular/common';
import { NgFor, NgIf } from '@angular/common';

@UntilDestroy()
@Component({
Expand All @@ -21,6 +21,7 @@ import { NgIf } from '@angular/common';
standalone: true,
imports: [
NgIf,
NgFor,
RouterLink,
ReactiveFormsModule,
IonicModule,
Expand Down
12 changes: 0 additions & 12 deletions src/app/votes/routes.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
import { Route } from '@angular/router';

export const VOTE_ROUTES: Route[] = [
{
path: 'list',
loadComponent: () =>
import('./containers/vote-list/vote-list.page').then(
(m) => m.VoteListPage
)
},
{
path: 'detail/:id',
loadComponent: () =>
import('./containers/vote-detail/vote-detail.page').then(
(m) => m.VoteDetailPage
)
},
{
path: '',
redirectTo: 'list',
pathMatch: 'full'
}
];
9 changes: 2 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { IonicStorageModule } from '@ionic/storage-angular';
import { APP_ROUTES } from './routes';

if (environment.production) {
enableProdMode();
Expand All @@ -15,12 +16,6 @@ bootstrapApplication(AppComponent, {
providers: [
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
importProvidersFrom(IonicModule.forRoot(), IonicStorageModule.forRoot()),
provideRouter([
{
path: '',
loadChildren: () =>
import('./app/layout/routes').then((m) => m.TAB_ROUTES)
}
])
provideRouter(APP_ROUTES)
]
}).then(() => console.log('Application started'));
25 changes: 25 additions & 0 deletions src/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Route } from '@angular/router';

export const APP_ROUTES: Route[] = [
{
path: 'business',
loadChildren: () =>
import('./app/business/routes').then((mod) => mod.BUSINESS_ROUTES)
},
{
path: 'council-member',
loadChildren: () =>
import('./app/council-member/routes').then(
(mod) => mod.COUNCIL_MEMBER_ROUTES
)
},
{
path: 'votes',
loadChildren: () =>
import('./app/votes/routes').then((mod) => mod.VOTE_ROUTES)
},
{
path: '',
loadChildren: () => import('./app/layout/routes').then((m) => m.TAB_ROUTES)
}
];

0 comments on commit ed35b5f

Please sign in to comment.