-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: implement requested changes
- Loading branch information
1 parent
f33651e
commit 104422d
Showing
34 changed files
with
567 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/app/extensions/wishlists/guards/fetch-shared-wishlist.guard.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { inject } from '@angular/core'; | ||
import { ActivatedRouteSnapshot } from '@angular/router'; | ||
import { Store } from '@ngrx/store'; | ||
import { Observable } from 'rxjs'; | ||
import { map, tap } from 'rxjs/operators'; | ||
|
||
import { wishlistActions } from '../store/wishlist'; | ||
|
||
/** | ||
* Fetch the shared wishlist | ||
*/ | ||
export function fetchSharedWishlist(route: ActivatedRouteSnapshot): boolean | Observable<boolean> { | ||
const store = inject(Store); | ||
|
||
return store.pipe( | ||
tap(() => { | ||
store.dispatch( | ||
wishlistActions.loadSharedWishlist({ | ||
wishlistId: route.params.wishlistId, | ||
owner: route.queryParams.owner, | ||
secureCode: route.queryParams.secureCode, | ||
}) | ||
); | ||
}), | ||
map(() => true) | ||
); | ||
} |
2 changes: 0 additions & 2 deletions
2
src/app/extensions/wishlists/models/wishlist-sharing/wishlist-sharing.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
...ail/account-wishlist-detail-line-item/account-wishlist-detail-line-item.component.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/app/extensions/wishlists/pages/shared-wishlist/shared-wishlist-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!-- Error message --> | ||
<ish-error-message [error]="wishlistError$ | async" /> | ||
|
||
<ng-container *ngIf="wishlist$ | async as wishlist"> | ||
<div class="col-9"> | ||
<h1>{{ wishlist.title }}</h1> | ||
|
||
<div class="container"> | ||
<ng-container *ngIf="wishlist.itemsCount; else noItems"> | ||
<div class="list-header row"> | ||
<div class="col-3 col-sm-3 list-header-item">{{ 'wishlist.table.header.item' | translate }}</div> | ||
<div class="col-sm-9 col-9 list-header-item column-price"> | ||
{{ 'wishlist.table.header.price' | translate }} | ||
</div> | ||
</div> | ||
<div class="list-body"> | ||
<ng-container *ngFor="let item of wishlist.items; trackBy: trackByFn"> | ||
<div class="list-item-row"> | ||
<ish-wishlist-line-item | ||
ishProductContext | ||
[sku]="item.sku" | ||
[wishlistItemData]="item" | ||
[currentWishlist]="wishlist" | ||
[readOnly]="true" | ||
/> | ||
</div> | ||
</ng-container> | ||
</div> | ||
</ng-container> | ||
</div> | ||
|
||
<ng-template #noItems> | ||
<p>{{ 'wishlist.no_entries' | translate }}</p> | ||
</ng-template> | ||
</div> | ||
</ng-container> | ||
|
||
<ish-loading *ngIf="wishlistLoading$ | async" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/app/extensions/wishlists/pages/shared-wishlist/shared-wishlist-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
|
||
import { HttpError } from 'ish-core/models/http-error/http-error.model'; | ||
|
||
import { WishlistsFacade } from '../../facades/wishlists.facade'; | ||
import { Wishlist, WishlistItem } from '../../models/wishlist/wishlist.model'; | ||
|
||
@Component({ | ||
selector: 'ish-wishlist-page', | ||
templateUrl: './shared-wishlist-page.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class SharedWishlistPageComponent implements OnInit { | ||
wishlistId: string; | ||
owner: string; | ||
secureCode: string; | ||
wishlist$: Observable<Wishlist>; | ||
wishlistError$: Observable<HttpError>; | ||
wishlistLoading$: Observable<boolean>; | ||
|
||
constructor(private wishlistsFacade: WishlistsFacade) {} | ||
|
||
ngOnInit(): void { | ||
this.wishlist$ = this.wishlistsFacade.currentWishlist$; | ||
this.wishlistError$ = this.wishlistsFacade.wishlistError$; | ||
this.wishlistLoading$ = this.wishlistsFacade.wishlistLoading$; | ||
} | ||
|
||
trackByFn(_: number, item: WishlistItem) { | ||
return item.id; | ||
} | ||
} |
Oops, something went wrong.