feat: add spinner
This commit is contained in:
parent
8138a63324
commit
16e25905dc
@ -75,3 +75,11 @@
|
|||||||
.provider-item.provider-unlink:hover::after {
|
.provider-item.provider-unlink:hover::after {
|
||||||
transform: translate(-50%, -50%) scale(1.0);
|
transform: translate(-50%, -50%) scale(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.provider-item .provider-spinner {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%) scale(1.0);
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
@ -6,9 +6,13 @@
|
|||||||
<div class="provider-container">
|
<div class="provider-container">
|
||||||
@for (provider of providers; track $index) {
|
@for (provider of providers; track $index) {
|
||||||
<a class="provider-item" (click)="provider.disabled ? confirmDelete(provider) : openOAuth(provider)"
|
<a class="provider-item" (click)="provider.disabled ? confirmDelete(provider) : openOAuth(provider)"
|
||||||
[class.disabled]="!canUnlink && provider.disabled" [class.provider-unlink]="canUnlink && provider.disabled">
|
[class.disabled]="!canUnlink && provider.disabled || provider.active"
|
||||||
|
[class.provider-unlink]="canUnlink && provider.disabled">
|
||||||
<img [alt]="provider.providerName" [src]="provider.icon"
|
<img [alt]="provider.providerName" [src]="provider.icon"
|
||||||
class="provider-icon" draggable="false"/>
|
class="provider-icon" draggable="false"/>
|
||||||
|
@if (provider.active) {
|
||||||
|
<app-data-spinner class="provider-spinner"/>
|
||||||
|
}
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,9 +10,11 @@ import {
|
|||||||
MatDialogTitle
|
MatDialogTitle
|
||||||
} from "@angular/material/dialog";
|
} from "@angular/material/dialog";
|
||||||
import {MatButton} from "@angular/material/button";
|
import {MatButton} from "@angular/material/button";
|
||||||
|
import {DataSpinnerComponent} from "@component/common/data-spinner/data-spinner.component";
|
||||||
|
|
||||||
interface AvailableOAuthProviders extends OAuthProviderData {
|
interface AvailableOAuthProviders extends OAuthProviderData {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
active: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -53,7 +55,9 @@ export class DeleteConfirmDialog {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'OAuthProviders',
|
selector: 'OAuthProviders',
|
||||||
imports: [],
|
imports: [
|
||||||
|
DataSpinnerComponent
|
||||||
|
],
|
||||||
templateUrl: './OAuthProviders.html',
|
templateUrl: './OAuthProviders.html',
|
||||||
styleUrl: './OAuthProviders.css',
|
styleUrl: './OAuthProviders.css',
|
||||||
providers: [AuthApiService]
|
providers: [AuthApiService]
|
||||||
@ -61,9 +65,14 @@ export class DeleteConfirmDialog {
|
|||||||
export class OAuthProviders implements OnInit {
|
export class OAuthProviders implements OnInit {
|
||||||
protected providers: AvailableOAuthProviders[] = [];
|
protected providers: AvailableOAuthProviders[] = [];
|
||||||
protected _activeProvidersId: OAuthProvider[] = [];
|
protected _activeProvidersId: OAuthProvider[] = [];
|
||||||
|
protected _activeProviders: string[] = [];
|
||||||
|
|
||||||
@Input() message: string = 'Вы можете войти в аккаунт через';
|
@Input() message: string = 'Вы можете войти в аккаунт через';
|
||||||
@Input() activeProviders: string[] = [];
|
|
||||||
|
@Input() set activeProviders(data: string[]) {
|
||||||
|
this._activeProviders = data;
|
||||||
|
this.updateDisabledProviders();
|
||||||
|
}
|
||||||
|
|
||||||
@Input() set activeProvidersId(data: OAuthProvider[]) {
|
@Input() set activeProvidersId(data: OAuthProvider[]) {
|
||||||
this._activeProvidersId = data;
|
this._activeProvidersId = data;
|
||||||
@ -80,7 +89,8 @@ export class OAuthProviders implements OnInit {
|
|||||||
this.providers = (data ?? this.providers).map(provider => {
|
this.providers = (data ?? this.providers).map(provider => {
|
||||||
return {
|
return {
|
||||||
...provider,
|
...provider,
|
||||||
disabled: this._activeProvidersId.includes(provider.provider) || this.activeProviders.includes(provider.providerName)
|
disabled: this._activeProvidersId.includes(provider.provider) || this._activeProviders.includes(provider.providerName),
|
||||||
|
active: false
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -108,6 +118,8 @@ export class OAuthProviders implements OnInit {
|
|||||||
this.notify.error('Не удалось открыть OAuth окно');
|
this.notify.error('Не удалось открыть OAuth окно');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected confirmDelete(provider: AvailableOAuthProviders) {
|
protected confirmDelete(provider: AvailableOAuthProviders) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user