Skip to content

Commit

Permalink
Merge branch 'develop' into amenconi-shopping-cart-bug-fixes-1
Browse files Browse the repository at this point in the history
  • Loading branch information
amenconi authored Mar 19, 2024
2 parents 30d5106 + 2089a58 commit d0de990
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 23 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ User | PR | SOON Reward | SMR Address | Authorized By | Comments |
---- | -- | ----------- | ----------- | ------------- | -------- |
[@emmap3-do](https://github.com/emmap3-do) | https://github.com/soonaverse/app/pull/47 | 500 | smr1qzt5qs6m6s2us8ll0hdfefzpr43cdz2xmjzywmrkz0sc2uyegvzjwazr6f8 | [@adam_unchained](https://github.com/adam_unchained) | Testing, continuous support in #dev channel
[@emmap3-do](https://github.com/emmap3-do) | https://github.com/soonaverse/app/pull/56 | 75 | smr1qzt5qs6m6s2us8ll0hdfefzpr43cdz2xmjzywmrkz0sc2uyegvzjwazr6f8 | [@adam_unchained](https://github.com/adam_unchained) | Minor fixes
[@amenconi](https://github.com/amenconi) | https://github.com/soonaverse/app/pull/128 | 76'000 | smr1qrncyy5lcfpr4hta0hg7qp2cmw6ssm0ycllx5nnz5pwcup8rxs0zzp2jp64 | [SOON_COMMITTEE - request 83](https://github.com/soonaverse/foundation/issues/83) | Bulk Buying feature
[@emmap3-do](https://github.com/emmap3-do) | https://github.com/soonaverse/app/pull/128 | 15'200 | smr1qzt5qs6m6s2us8ll0hdfefzpr43cdz2xmjzywmrkz0sc2uyegvzjwazr6f8 | [SOON_COMMITTEE - request 83](https://github.com/soonaverse/foundation/issues/83) | Bulk Buying feature
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class MemberAboutComponent implements OnInit {
this.drawerVisible$.next(false);
}

public trackByUid(index: number, item: any): number {
return item.uid;
public trackByUid(index: number, item: any): any {
return item ? item.uid : index;
}
}
4 changes: 2 additions & 2 deletions src/app/pages/member/pages/activity/activity.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class ActivityPage implements OnInit {
return ['/', ROUTER_UTILS.config.space.root, spaceId];
}

public trackByUid(index: number, item: any): number {
return item.uid;
public trackByUid(index: number, item: any): any {
return item ? item.uid : index;
}
}
4 changes: 2 additions & 2 deletions src/app/pages/member/pages/awards/awards.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class AwardsPage {
return this.auth.isLoggedIn$;
}

public trackByUid(index: number, item: any): number {
return item.uid;
public trackByUid(index: number, item: any): any {
return item ? item.uid : index;
}
}
4 changes: 2 additions & 2 deletions src/app/pages/member/pages/badges/badges.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class BadgesPage implements OnInit {
return this.auth.isLoggedIn$;
}

public trackByUid(index: number, item: Transaction) {
return item.uid;
public trackByUid(index: number, item: any): any {
return item ? item.uid : index;
}
}
39 changes: 32 additions & 7 deletions src/app/pages/member/pages/member/member.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { SeoService } from '@core/services/seo';
import { ROUTER_UTILS } from '@core/utils/router.utils';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { FILE_SIZES, Member } from '@build-5/interfaces';
import { BehaviorSubject, Subscription, skip } from 'rxjs';
import { BehaviorSubject, Subscription, filter, map, skip } from 'rxjs';
import { MemberApi } from './../../../../@api/member.api';
import { NavigationService } from './../../../../@core/services/navigation/navigation.service';
import { DataService } from './../../services/data.service';
Expand Down Expand Up @@ -104,6 +104,16 @@ export class MemberPage implements OnInit, OnDestroy {
}

public listenMember(memberId: string): void {
const isValidMemberId = typeof memberId === 'string' && /[a-zA-Z0-9]/.test(memberId);

if (!isValidMemberId) {
this.data.awardsCompleted$.next([]);
this.data.awardsPending$.next([]);
this.data.space$.next([]);
this.data.member$.next(undefined);
return;
}

this.subscriptions$.push(
this.memberApi
.topAwardsCompleted(memberId)
Expand All @@ -118,19 +128,34 @@ export class MemberPage implements OnInit, OnDestroy {
);
// TODO Implement search. This is parked since we will be implementing new search here.
this.subscriptions$.push(
this.memberApi.topSpaces(memberId).pipe(untilDestroyed(this)).subscribe(this.data.space$),
this.memberApi
.topSpaces(memberId)
.pipe(
untilDestroyed(this),
map((spaces) =>
spaces.filter(
(space) => space && typeof space.uid === 'string' && space.uid.trim() !== '',
),
),
)
.subscribe((filteredSpaces) => {
this.data.space$.next(filteredSpaces);
}),
);
this.subscriptions$.push(
this.memberApi
.listen(memberId)
.pipe(untilDestroyed(this))
.subscribe((v) => {
// Only pass next stage.
this.data.member$.next(v);
.pipe(
untilDestroyed(this),
filter((v) => v && typeof v.uid === 'string' && v.uid.trim() !== ''),
)
.subscribe((validMember) => {
// Only pass next stage if valid.
this.data.member$.next(validMember);
}),
);

// Badges.
// Continue with other actions if memberId is valid.
this.data.refreshBadges();
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/member/pages/nfts/nfts.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export class NFTsPage implements OnInit {
return this.auth.member$;
}

public trackByUid(_index: number, item: any): number {
return item.uid;
public trackByUid(index: number, item: any): any {
return item ? item.uid : index;
}

public convertAllToSoonaverseModel(algoliaItems: any[]) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/member/pages/spaces/member-spaces.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class MemberSpacesComponent implements OnInit {
);
}

public trackByUid(index: number, item: any): number {
return item.uid;
public trackByUid(index: number, item: any): any {
return item ? item.uid : index;
}
}
4 changes: 2 additions & 2 deletions src/app/pages/member/pages/tokens/tokens.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ export class TokensPage implements OnInit, OnDestroy {
);
}

public trackByUid(index: number, item: any): number {
return item.uid;
public trackByUid(index: number, item: any): any {
return item ? item.uid : index;
}

public understandNotMintedWarning(): void {
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/member/pages/transactions/transactions.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ export class TransactionsPage implements OnInit, OnDestroy {
});
}

public trackByUid(index: number, item: any): number {
return item.uid;
public trackByUid(index: number, item: any): any {
return item ? item.uid : index;
}

private cancelSubscriptions(): void {
Expand Down

0 comments on commit d0de990

Please sign in to comment.