added multi account faq, fix #608
This commit is contained in:
parent
d24441343a
commit
f4c87df078
|
@ -15,7 +15,9 @@
|
||||||
<button type="submit" class="form-button"
|
<button type="submit" class="form-button"
|
||||||
title="add account"
|
title="add account"
|
||||||
[class.comrade__button]="isComrade">
|
[class.comrade__button]="isComrade">
|
||||||
<span *ngIf="!isLoading">Submit</span>
|
|
||||||
|
<span *ngIf="!isLoading && !this.isInstanceMultiAccountLoading">Submit</span>
|
||||||
|
<span *ngIf="!isLoading && this.isInstanceMultiAccountLoading" class="faq__warning">See FAQ</span>
|
||||||
<app-waiting-animation *ngIf="isLoading" class="waiting-icon"></app-waiting-animation>
|
<app-waiting-animation *ngIf="isLoading" class="waiting-icon"></app-waiting-animation>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -29,5 +31,12 @@
|
||||||
allowfullscreen></iframe>
|
allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="faq" *ngIf="isInstanceMultiAccount">
|
||||||
|
<p>
|
||||||
|
FAQ<br/>
|
||||||
|
<a href="https://github.com/NicolasConstant/sengi/wiki/How-to-add-multiple-accounts-from-the-same-instance" target="_blank">How to add multiple accounts from the same instance?</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -110,3 +110,20 @@ $comrade_red: #a50000;
|
||||||
background-position: 0 0;
|
background-position: 0 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.faq {
|
||||||
|
margin: 20px 0 0 0;
|
||||||
|
|
||||||
|
& a {
|
||||||
|
color: #ffcc00;
|
||||||
|
text-decoration: underline;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #ffe88a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__warning {
|
||||||
|
color: #ffdc52;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import { RegisteredAppsStateModel, AppInfo, AddRegisteredApp } from '../../../st
|
||||||
import { AuthService, CurrentAuthProcess } from '../../../services/auth.service';
|
import { AuthService, CurrentAuthProcess } from '../../../services/auth.service';
|
||||||
import { AppData } from '../../../services/models/mastodon.interfaces';
|
import { AppData } from '../../../services/models/mastodon.interfaces';
|
||||||
import { NotificationService } from '../../../services/notification.service';
|
import { NotificationService } from '../../../services/notification.service';
|
||||||
|
import { ToolsService } from '../../../services/tools.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-add-new-account',
|
selector: 'app-add-new-account',
|
||||||
|
@ -24,12 +25,14 @@ export class AddNewAccountComponent implements OnInit {
|
||||||
set setInstance(value: string) {
|
set setInstance(value: string) {
|
||||||
this.instance = value.replace('http://', '').replace('https://', '').replace('/', '').toLowerCase().trim();
|
this.instance = value.replace('http://', '').replace('https://', '').replace('/', '').toLowerCase().trim();
|
||||||
this.checkComrad();
|
this.checkComrad();
|
||||||
|
this.checkInstanceMultiAccount(value);
|
||||||
}
|
}
|
||||||
get setInstance(): string {
|
get setInstance(): string {
|
||||||
return this.instance;
|
return this.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private readonly toolsService: ToolsService,
|
||||||
private readonly notificationService: NotificationService,
|
private readonly notificationService: NotificationService,
|
||||||
private readonly authService: AuthService,
|
private readonly authService: AuthService,
|
||||||
private readonly store: Store) { }
|
private readonly store: Store) { }
|
||||||
|
@ -51,8 +54,27 @@ export class AddNewAccountComponent implements OnInit {
|
||||||
this.isComrade = false;
|
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 {
|
onSubmit(): boolean {
|
||||||
if(this.isLoading || !this.instance) return false;
|
if(this.isLoading || !this.instance || this.isInstanceMultiAccountLoading) return false;
|
||||||
|
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue