-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from ordpool-space/friendly-wl2
Friendly wl2
- Loading branch information
Showing
18 changed files
with
242 additions
and
76 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
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
42 changes: 42 additions & 0 deletions
42
frontend/src/app/components/ordinals/cat21-mint/countdown-timer-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,42 @@ | ||
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; | ||
import { Observable, interval, map, startWith, takeWhile } from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'app-countdown-timer', | ||
templateUrl: './countdown-timer.component.html', | ||
styleUrls: ['./countdown-timer.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class CountdownTimerComponent implements OnInit { | ||
|
||
@Input() | ||
targetDate: string | undefined; | ||
countdown$: Observable<string>; | ||
|
||
ngOnInit() { | ||
this.countdown$ = interval(1000).pipe( | ||
startWith(0), | ||
map(() => { | ||
|
||
if (!this.targetDate) { | ||
return ''; | ||
} | ||
|
||
const now = new Date().getTime(); | ||
const distance = new Date(this.targetDate).getTime() - now; | ||
|
||
if (distance < 0) { | ||
return 'GO'; | ||
} | ||
|
||
const days = Math.floor(distance / (1000 * 60 * 60 * 24)); | ||
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); | ||
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); | ||
const seconds = Math.floor((distance % (1000 * 60)) / 1000); | ||
|
||
return `${days}d ${hours}h ${minutes}m ${seconds}s`; | ||
}), | ||
takeWhile(countdown => countdown !== 'GO', true) | ||
); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
frontend/src/app/components/ordinals/cat21-mint/countdown-timer.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,13 @@ | ||
<ng-container *ngIf="this.countdown$ | async as countdown"> | ||
<div class="countdown" *ngIf="countdown != 'GO'"> | ||
|
||
<h4>CCC (Colossal Cat Countdown)</h4> | ||
<h1>{{ countdown }}</h1> | ||
|
||
|
||
<img src="/resources/cat21-placholder.svg" width="200"><br> | ||
<br> | ||
<strong>Don't sleep on the cats!</strong><br> | ||
|
||
</div> | ||
</ng-container> |
Empty file.
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
Oops, something went wrong.