From 18afb5e538d223976e311d59fcda872157d9a92f Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 6 Jul 2019 20:13:05 -0400 Subject: [PATCH] added comrad welcome --- .../add-new-account.component.html | 17 +++++-- .../add-new-account.component.scss | 47 +++++++++++++++++ .../add-new-account.component.ts | 48 ++++++++++++++---- src/assets/img/juche-background.jpg | Bin 0 -> 250831 bytes 4 files changed, 98 insertions(+), 14 deletions(-) create mode 100644 src/assets/img/juche-background.jpg diff --git a/src/app/components/floating-column/add-new-account/add-new-account.component.html b/src/app/components/floating-column/add-new-account/add-new-account.component.html index d9fa4851..23ccf41d 100644 --- a/src/app/components/floating-column/add-new-account/add-new-account.component.html +++ b/src/app/components/floating-column/add-new-account/add-new-account.component.html @@ -1,11 +1,18 @@ -
-

Add new account

+
+

Add new account

+

Welcome Comrad!

- - Please provide your comrad account: +
- +
+ +
+ + + +
\ No newline at end of file diff --git a/src/app/components/floating-column/add-new-account/add-new-account.component.scss b/src/app/components/floating-column/add-new-account/add-new-account.component.scss index 53fc6d86..bf13b7c3 100644 --- a/src/app/components/floating-column/add-new-account/add-new-account.component.scss +++ b/src/app/components/floating-column/add-new-account/add-new-account.component.scss @@ -1,6 +1,11 @@ @import "variables"; @import "panel"; +.panel { + + background-position: 0 100%; +} + .form-color { background-color: $column-color; border-color: $button-border-color; @@ -11,4 +16,46 @@ } height: 29px; padding: 0 5px 0 5px; +} + +$comrad_yellow: #ffcc00; +$comrad_red: #a50000; +.comrad { + &__title { + font-size: 18px; + margin-left: 5px; + color: $comrad_yellow; + font-weight: bold; + } + + &__text { + color: $comrad_yellow; + } + + &__button { + background: $comrad_yellow; + border-color: $comrad_yellow; + color: $comrad_red; + } + + &__video { + width: 300px; + // height: 200px; + padding-top: 20px; + margin: auto; + // outline: 1px solid greenyellow; + } + + &__input { + color: $comrad_red; + border-color: $comrad_yellow; + background: $comrad_yellow; + } + + &__background { + transition: all 3s; + background-image: url("assets/img/juche-background.jpg"); + background-color: $comrad_red; + background-position: 0 0; + } } \ No newline at end of file diff --git a/src/app/components/floating-column/add-new-account/add-new-account.component.ts b/src/app/components/floating-column/add-new-account/add-new-account.component.ts index eeee2d61..93a28fca 100644 --- a/src/app/components/floating-column/add-new-account/add-new-account.component.ts +++ b/src/app/components/floating-column/add-new-account/add-new-account.component.ts @@ -14,8 +14,21 @@ import { NotificationService } from '../../../services/notification.service'; }) export class AddNewAccountComponent implements OnInit { private blockList = ['gab.com', 'gab.ai', 'exited.eu', 'cyzed.com']; + private comradList = ['juche.town']; - @Input() mastodonFullHandle: string; + private username: string; + private instance: string; + isComrad: boolean; + + private _mastodonFullHandle: string; + @Input() + set mastodonFullHandle(value: string) { + this._mastodonFullHandle = value; + this.checkComrad(); + } + get mastodonFullHandle(): string { + return this._mastodonFullHandle; + } constructor( private readonly notificationService: NotificationService, @@ -25,17 +38,34 @@ export class AddNewAccountComponent implements OnInit { ngOnInit() { } - onSubmit(): boolean { + checkComrad(): any { let fullHandle = this.mastodonFullHandle.split('@').filter(x => x != null && x !== ''); + this.username = fullHandle[0]; + this.instance = fullHandle[1]; - const username = fullHandle[0]; - const instance = fullHandle[1]; + if (this.username && this.instance) { + let cleanInstance = this.instance.replace('http://', '').replace('https://', '').toLowerCase(); + for (let b of this.comradList) { + if (cleanInstance == b || cleanInstance.includes(`.${b}`)) { + this.isComrad = true; + return; + } + } + } - this.checkBlockList(instance); + this.isComrad = false; + } - this.checkAndCreateApplication(instance) + onSubmit(): boolean { + // let fullHandle = this.mastodonFullHandle.split('@').filter(x => x != null && x !== ''); + // const username = fullHandle[0]; + // const instance = fullHandle[1]; + + this.checkBlockList(this.instance); + + this.checkAndCreateApplication(this.instance) .then((appData: AppData) => { - this.redirectToInstanceAuthPage(username, instance, appData); + this.redirectToInstanceAuthPage(this.username, this.instance, appData); }) .catch((err: HttpErrorResponse) => { if (err instanceof HttpErrorResponse) { @@ -50,10 +80,10 @@ export class AddNewAccountComponent implements OnInit { return false; } - private checkBlockList(instance: string){ + private checkBlockList(instance: string) { let cleanInstance = instance.replace('http://', '').replace('https://', '').toLowerCase(); for (let b of this.blockList) { - if (cleanInstance == b || cleanInstance.includes(`.${b}`)) { + if (cleanInstance == b || cleanInstance.includes(`.${b}`)) { let content = '