Skip to content

Commit 3b51934

Browse files
committed
feat(shop): add shop detail component
1 parent c78ab87 commit 3b51934

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,46 @@
11
import { ChangeDetectionStrategy, Component } from '@angular/core';
2+
import { Router } from '@angular/router';
3+
import { combineLatest, tap } from 'rxjs';
4+
5+
import { ROUTER } from '@console-core/config';
6+
import {
7+
filterEmptyAndNullishAndUndefined,
8+
ShopFacade,
9+
} from '@console-core/state';
210

311
@Component({
412
selector: 'app-module-management-shop-index',
5-
template: ` <h3>Shopx</h3> `,
6-
changeDetection: ChangeDetectionStrategy.OnPush,
13+
template: `
14+
@if(vm$ | async; as vm) {
15+
<h3>Shops</h3>
16+
}
17+
`,
718
standalone: false,
19+
changeDetection: ChangeDetectionStrategy.OnPush,
820
})
9-
export class ShopIndexComponent {}
21+
export class ShopIndexComponent {
22+
readonly vm$ = combineLatest({
23+
selectedOrganizationId: this.shopFacade.selectedId$.pipe(
24+
tap((data) => console.log(`data: ${data}`)),
25+
filterEmptyAndNullishAndUndefined(),
26+
tap((id) => {
27+
console.log('view route:');
28+
console.log(
29+
ROUTER.pages.main.children.management.children.shops.children.view.getLink(
30+
{ id }
31+
)
32+
);
33+
this.router.navigate(
34+
ROUTER.pages.main.children.management.children.shops.children.view.getLink(
35+
{ id }
36+
)
37+
);
38+
})
39+
),
40+
});
41+
42+
constructor(
43+
private readonly router: Router,
44+
private readonly shopFacade: ShopFacade
45+
) {}
46+
}

packages/modules/management/src/lib/components/shop/shop-view.component.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ import {
1212
@Component({
1313
selector: 'app-module-management-shop-view',
1414
template: `
15-
<h3>Shop view</h3>
16-
<ng-container *ngIf="vm$ | async as vm">
17-
<!-- <app-module-management-shop-details [vm]="vm" /> -->
18-
{{ vm.shop | json }}
19-
</ng-container>
15+
@if(vm$ | async; as vm) {
16+
<!-- <app-module-management-shop-details [vm]="vm" /> -->
17+
{{ vm.shop | json }}
18+
}
2019
`,
2120
changeDetection: ChangeDetectionStrategy.OnPush,
2221
standalone: false,

0 commit comments

Comments
 (0)