Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge master #93

Merged
merged 4 commits into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ jobs:
node-version: 20
- name: Install Dependencies
run: npm install
- name: Copy ENV variables
run: cp -f src/environments/environment.prod.ts src/environments/environment.ts
- name: Build project
run: npm run build
- name: Publish to Cloudflare Pages
3 changes: 0 additions & 3 deletions src/app/@api/collection.api.ts
Original file line number Diff line number Diff line change
@@ -56,9 +56,6 @@ export class CollectionApi extends BaseApi<Collection> {
public update = (req: WenRequest): Observable<Collection | undefined> =>
this.request(WEN_FUNC.updateCollection, req);

public approve = (req: WenRequest): Observable<Collection | undefined> =>
this.request(WEN_FUNC.approveCollection, req);

public reject = (req: WenRequest): Observable<Collection | undefined> =>
this.request(WEN_FUNC.rejectCollection, req);
}
Original file line number Diff line number Diff line change
@@ -57,9 +57,11 @@ export class CollectionHighlightCardComponent implements OnDestroy {
this.collections.forEach((collection) => {
const space$ = new BehaviorSubject<Space | undefined>(undefined);
this.spaces$.push(space$);
this.subscriptions$.push(
this.spaceApi.listen(collection?.space).pipe(untilDestroyed(this)).subscribe(space$),
);
if (collection?.space) {
this.subscriptions$.push(
this.spaceApi.listen(collection?.space).pipe(untilDestroyed(this)).subscribe(space$),
);
}
});
}

Original file line number Diff line number Diff line change
@@ -17,11 +17,7 @@
nzType="primary"
nzSize="default"
class="w-full"
*ngIf="
(isGuardianWithinSpace$ | async) &&
!helper.isMinted(data.collection$ | async) &&
(data.collection$ | async)?.approved === true
"
*ngIf="(isGuardianWithinSpace$ | async) && !helper.isMinted(data.collection$ | async)"
[disabled]="helper.mintInProgress(data.collection$ | async)"
(click)="isMintOnNetorkVisible = true"
>
@@ -33,15 +29,12 @@
>...)
</ng-container>
</ng-container>
<ng-template #mintText i18n>Mint Collection</ng-template>
<ng-template #mintText i18n>Mint & Publish Collection</ng-template>
</button>

<div
class="font-medium"
*ngIf="
!helper.isMinted(data.collection$ | async) &&
((isGuardianWithinSpace$ | async) === false || (data.collection$ | async)?.approved !== true)
"
*ngIf="!helper.isMinted(data.collection$ | async) && (isGuardianWithinSpace$ | async) === false"
i18n
>
Collection is not yet migrated to the decentralized network.
24 changes: 0 additions & 24 deletions src/app/pages/collection/pages/collection/collection.page.html
Original file line number Diff line number Diff line change
@@ -69,18 +69,6 @@
<h1 class="mt-3 mb-0 lg:mt-2">{{ (data.collection$ | async)?.name }}</h1>

<div class="w-full mt-10 mb-4 space-y-4" *ngIf="(deviceService.isMobile$ | async)">
<button
nz-button
nzType="primary"
(click)="approve()"
*ngIf="data.isPending(data.collection$ | async) && (data.isGuardianWithinSpace$ | async)"
nzBlock
nzSize="large"
i18n
>
Publish Collection
</button>

<button
nz-button
class="wen-secondary"
@@ -289,18 +277,6 @@ <h1 class="mt-3 mb-0 lg:mt-2">{{ (data.collection$ | async)?.name }}</h1>
style="max-width: 450px"
*ngIf="(deviceService.isDesktop$ | async)"
>
<button
nz-button
nzType="primary"
(click)="approve()"
*ngIf="data.isPending(data.collection$ | async) && (data.isGuardianWithinSpace$ | async)"
nzBlock
nzSize="large"
i18n
>
Publish Collection
</button>

<button
nz-button
class="wen-secondary"
29 changes: 6 additions & 23 deletions src/app/pages/collection/pages/collection/collection.page.ts
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ export class CollectionPage implements OnInit, OnDestroy {
this.guardiansSubscription$.unsubscribe();
}

if (this.auth.member$.value?.uid) {
if (this.auth.member$.value?.uid && obj.space) {
this.guardiansSubscription$ = this.spaceApi
.isGuardianWithinSpace(obj.space, this.auth.member$.value.uid)
.pipe(untilDestroyed(this))
@@ -141,9 +141,11 @@ export class CollectionPage implements OnInit, OnDestroy {

this.data.collection$.pipe(skip(1), first()).subscribe(async (p) => {
if (p) {
this.subscriptions$.push(
this.spaceApi.listen(p.space).pipe(untilDestroyed(this)).subscribe(this.data.space$),
);
if (p.space) {
this.subscriptions$.push(
this.spaceApi.listen(p.space).pipe(untilDestroyed(this)).subscribe(this.data.space$),
);
}
if (p.royaltiesSpace) {
this.subscriptions$.push(
this.spaceApi
@@ -200,25 +202,6 @@ export class CollectionPage implements OnInit, OnDestroy {
return CollectionType;
}

public async approve(): Promise<void> {
if (!this.data.collection$.value?.uid) {
return;
}

await this.auth.sign(
{
uid: this.data.collection$.value.uid,
},
(sc, finish) => {
this.notification
.processRequest(this.collectionApi.approve(sc), 'Approved.', finish)
.subscribe(() => {
// none.
});
},
);
}

public async reject(): Promise<void> {
if (!this.data.collection$.value?.uid) {
return;
2 changes: 1 addition & 1 deletion src/app/pages/collection/pages/upsert/upsert.page.ts
Original file line number Diff line number Diff line change
@@ -479,7 +479,7 @@ export class UpsertPage implements OnInit, OnDestroy {
public getSpaceListOptions(list?: Space[] | null): SelectSpaceOption[] {
return (list || [])
.filter((o) => {
return !!(o.validatedAddress || {})[DEFAULT_NETWORK];
return !!(o?.validatedAddress || {})[DEFAULT_NETWORK];
})
.map((o) => ({
label: o.name || o.uid,
18 changes: 11 additions & 7 deletions src/app/pages/token/pages/token/token.page.ts
Original file line number Diff line number Diff line change
@@ -101,9 +101,11 @@ export class TokenPage implements OnInit, OnDestroy {
o === 'image' ? t.overviewGraphics : undefined,
);
});
this.subscriptions$.push(
this.spaceApi.listen(t.space).pipe(untilDestroyed(this)).subscribe(this.data.space$),
);
if (t.space) {
this.subscriptions$.push(
this.spaceApi.listen(t.space).pipe(untilDestroyed(this)).subscribe(this.data.space$),
);
}
this.subscriptions$.push(
this.tokenApi
.getDistributionsLive(t.uid)
@@ -218,10 +220,12 @@ export class TokenPage implements OnInit, OnDestroy {
this.memberDistributionSub$ = this.tokenApi
.getMembersDistribution(this.data.token$.value?.uid, member.uid)
.subscribe(this.data.memberDistribution$);
this.guardiansSubscription$ = this.spaceApi
.isGuardianWithinSpace(this.data.token$.value?.space, member?.uid)
.pipe(untilDestroyed(this))
.subscribe(this.isGuardianWithinSpace$);
if (this.data.token$.value?.space) {
this.guardiansSubscription$ = this.spaceApi
.isGuardianWithinSpace(this.data.token$.value?.space, member?.uid)
.pipe(untilDestroyed(this))
.subscribe(this.isGuardianWithinSpace$);
}
} else {
this.data.memberDistribution$?.next(undefined);
}
8 changes: 5 additions & 3 deletions src/app/pages/token/pages/trade/trade.page.ts
Original file line number Diff line number Diff line change
@@ -272,9 +272,11 @@ export class TradePage implements OnInit, OnDestroy {
o === 'image' ? t.overviewGraphics : undefined,
);
});
this.subscriptions$.push(
this.spaceApi.listen(t.space).pipe(untilDestroyed(this)).subscribe(this.data.space$),
);
if (t.space) {
this.subscriptions$.push(
this.spaceApi.listen(t.space).pipe(untilDestroyed(this)).subscribe(this.data.space$),
);
}
this.listenToMemberSubs(this.auth.member$.value);
this.isFavourite = ((getItem(StorageItem.FavouriteTokens) as string[]) || []).includes(
t.uid,
Loading