From f4c87df078e6201d0a727a70cadebc0a887e4bf7 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 19 Aug 2023 21:28:20 -0400 Subject: [PATCH] added multi account faq, fix #608 --- .../add-new-account.component.html | 11 +++++++- .../add-new-account.component.scss | 17 ++++++++++++ .../add-new-account.component.ts | 26 +++++++++++++++++-- 3 files changed, 51 insertions(+), 3 deletions(-) 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 30c5f394..9337d937 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 @@ -15,7 +15,9 @@ @@ -29,5 +31,12 @@ allowfullscreen> +
+

+ FAQ
+ How to add multiple accounts from the same instance? +

+
+ \ 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 61d7b865..d6ed6723 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 @@ -109,4 +109,21 @@ $comrade_red: #a50000; background-color: $comrade_red; background-position: 0 0; } +} + +.faq { + margin: 20px 0 0 0; + + & a { + color: #ffcc00; + text-decoration: underline; + + &:hover { + color: #ffe88a; + } + } + + &__warning { + color: #ffdc52; + } } \ 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 4d5ef91e..5155ab45 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 @@ -6,13 +6,14 @@ import { RegisteredAppsStateModel, AppInfo, AddRegisteredApp } from '../../../st import { AuthService, CurrentAuthProcess } from '../../../services/auth.service'; import { AppData } from '../../../services/models/mastodon.interfaces'; import { NotificationService } from '../../../services/notification.service'; +import { ToolsService } from '../../../services/tools.service'; @Component({ selector: 'app-add-new-account', templateUrl: './add-new-account.component.html', styleUrls: ['./add-new-account.component.scss'] }) -export class AddNewAccountComponent implements OnInit { +export class AddNewAccountComponent implements OnInit { private blockList = ['gab.com', 'gab.ai', 'cyzed.com']; private comradeList = ['juche.town']; @@ -24,12 +25,14 @@ export class AddNewAccountComponent implements OnInit { set setInstance(value: string) { this.instance = value.replace('http://', '').replace('https://', '').replace('/', '').toLowerCase().trim(); this.checkComrad(); + this.checkInstanceMultiAccount(value); } get setInstance(): string { return this.instance; } constructor( + private readonly toolsService: ToolsService, private readonly notificationService: NotificationService, private readonly authService: AuthService, private readonly store: Store) { } @@ -51,8 +54,27 @@ export class AddNewAccountComponent implements OnInit { this.isComrade = false; } + isInstanceMultiAccount: boolean; + isInstanceMultiAccountLoading: boolean; + checkInstanceMultiAccount(value: string) { + if(value) { + const instances: string[] = this.toolsService.getAllAccounts().map(x => x.instance); + if(instances && instances.indexOf(value) > -1){ + this.isInstanceMultiAccount = true; + this.isInstanceMultiAccountLoading = true; + + setTimeout(() => { + this.isInstanceMultiAccountLoading = false; + }, 2000); + } else { + this.isInstanceMultiAccount = false; + this.isInstanceMultiAccountLoading = false; + } + } + } + onSubmit(): boolean { - if(this.isLoading || !this.instance) return false; + if(this.isLoading || !this.instance || this.isInstanceMultiAccountLoading) return false; this.isLoading = true;