-
Notifications
You must be signed in to change notification settings - Fork 137
Feat/nft showcase preview #371
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
8fc6457
47188c2
2854bfa
8ee0784
697d9c8
dc35fce
fe5014d
7883f61
9d17fe3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,8 +97,9 @@ | |
| <simple-center-loader *ngIf="loading"></simple-center-loader> | ||
|
|
||
| <div class="w-100 light-grey-divider border-bottom border-top border-color-grey" style="height:10px"></div> | ||
|
|
||
| <div *ngIf="posts.length > 0 && (!loading || loadingNewDrop)" class="p-15px fs-15px"> | ||
| <tab-selector [tabs]="feedTabs" [activeTab]="activeTab" (tabClick)="_handleTabClick($event)"></tab-selector> | ||
| <!--Admin panel--> | ||
| <div *ngIf="showShowcaseManagementTab()" class="p-15px fs-15px"> | ||
| <b *ngIf="!loadingNewDrop">NFTs in this drop:</b> | ||
| <div #uiScroll *uiScroll="let post of datasource" [ngClass]="{'d-flex align-items-center mt-15px border border-color-grey br-8px': !loadingNewDrop}"> | ||
|
||
| <i (click)="removeNFT(post.PostHashHex)" | ||
|
|
@@ -115,3 +116,7 @@ | |
| <span *ngIf="post.PostHashHex === nftBeingRemoved"> Removing...</span> | ||
| </div> | ||
| </div> | ||
| <!--Showcase preview--> | ||
| <div *ngIf="showShowcasePreviewTab()"> | ||
| <nft-showcase [showcaseIdx]="dropNumber"></nft-showcase> | ||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,21 @@ | ||
| import { Component, OnInit } from "@angular/core"; | ||
| import {Component, Input, OnInit} from "@angular/core"; | ||
lazynina marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| import { GlobalVarsService } from "../global-vars.service"; | ||
| import { BackendApiService } from "../backend-api.service"; | ||
| import { SwalHelper } from "../../lib/helpers/swal-helper"; | ||
| import { InfiniteScroller } from "../infinite-scroller"; | ||
| import { IAdapter, IDatasource } from "ngx-ui-scroll"; | ||
| import {ActivatedRoute, Router} from "@angular/router"; | ||
lazynina marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @Component({ | ||
| selector: "nft-drop-mgr", | ||
| templateUrl: "./nft-drop-mgr.component.html", | ||
| }) | ||
| export class NftDropMgrComponent implements OnInit { | ||
| static SHOWCASE_MANAGEMENT = "Manage Showcase"; | ||
| static SHOWCASE_PREVIEW_TAB = "Showcase Preview"; | ||
|
|
||
| @Input() activeTab = NftDropMgrComponent.SHOWCASE_MANAGEMENT; | ||
|
|
||
| globalVars: GlobalVarsService; | ||
|
|
||
| loading: boolean = false; | ||
|
|
@@ -47,10 +53,52 @@ export class NftDropMgrComponent implements OnInit { | |
|
|
||
| datasource: IDatasource<IAdapter<any>> = this.infiniteScroller.getDatasource(); | ||
|
|
||
| constructor(private _globalVars: GlobalVarsService, private backendApi: BackendApiService) { | ||
| feedTabs = [NftDropMgrComponent.SHOWCASE_MANAGEMENT, NftDropMgrComponent.SHOWCASE_PREVIEW_TAB]; | ||
| switchingTabs = false; | ||
|
|
||
| constructor( | ||
| private _globalVars: GlobalVarsService, | ||
| private backendApi: BackendApiService, | ||
| private router: Router, | ||
| private route: ActivatedRoute | ||
| ) { | ||
| this.globalVars = _globalVars; | ||
| } | ||
|
|
||
| showShowcaseManagementTab() { | ||
| return ( | ||
| this.activeTab === NftDropMgrComponent.SHOWCASE_MANAGEMENT && | ||
| this.posts.length > 0 && | ||
| (!this.loading || this.loadingNewDrop) | ||
| ); | ||
| } | ||
|
|
||
| showShowcasePreviewTab() { | ||
| return ( | ||
| this.activeTab === NftDropMgrComponent.SHOWCASE_PREVIEW_TAB && | ||
| this.posts.length > 0 && | ||
| (!this.loading || this.loadingNewDrop) | ||
| ); | ||
| } | ||
|
||
|
|
||
| _handleTabClick(tab: string) { | ||
| this.activeTab = tab; | ||
| this.router.navigate([], { | ||
| relativeTo: this.route, | ||
| queryParams: { feedTab: this.activeTab }, | ||
|
||
| queryParamsHandling: "merge", | ||
| }); | ||
| this._onTabSwitch(); | ||
| } | ||
|
|
||
| _onTabSwitch() { | ||
| // Delay rendering the posts for a hot second so nav is fast. | ||
| this.switchingTabs = true; | ||
| setTimeout(() => { | ||
| this.switchingTabs = false; | ||
| }, 0); | ||
| } | ||
|
||
|
|
||
| ngOnInit(): void { | ||
| // Get the latest NFT drop | ||
| this.loading = true; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |||||
| </div> | ||||||
| </div> | ||||||
|
|
||||||
| <div *ngIf="!loading && !nftCollections || !nftCollections.length" class="d-flex align-items-center justify-content-center"> | ||||||
| <div *ngIf="showcaseComingSoon()" class="d-flex align-items-center justify-content-center"> | ||||||
|
||||||
| <div *ngIf="showcaseComingSoon()" class="d-flex align-items-center justify-content-center"> | |
| <div *ngIf="!loading && !nftCollections?.length" class="d-flex align-items-center justify-content-center"> |
with the ?, we have safe access so !(null)?.length is truthy and so is !([])?.length
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,14 +1,17 @@ | ||||||||
| import { Component, OnInit } from "@angular/core"; | ||||||||
| import {Component, Input, OnInit} from "@angular/core"; | ||||||||
|
||||||||
| import {Component, Input, OnInit} from "@angular/core"; | |
| import { Component, Input, OnInit } from "@angular/core"; |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import { has } from "lodash"; |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be able to kill this function and just use the constants to define the conditional
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| console.log('Here is the showcase idx'); | |
| console.log(this.showcaseIdx); | |
| console.log(this.showcaseIdx === undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to live with the rest of the admin routes below.