Running Prettier in Project
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
}
|
||||
|
||||
.auth-body .btn {
|
||||
background-color: #D8291C !important;
|
||||
background-color: #d8291c !important;
|
||||
text-decoration: none;
|
||||
border-radius: 8px;
|
||||
color: #ffffff;
|
||||
@@ -70,7 +70,7 @@
|
||||
border-bottom: 2px solid #7676769b;
|
||||
}
|
||||
.input-div:after {
|
||||
content: '';
|
||||
content: "";
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 0;
|
||||
@@ -84,11 +84,12 @@
|
||||
.input-div:hover:after,
|
||||
.input-div:has(input.form-control:focus):after {
|
||||
width: 100%;
|
||||
transition: .4s;
|
||||
transition: 0.4s;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.input-div > .form-control, .input-div > .form-control:focus {
|
||||
.input-div > .form-control,
|
||||
.input-div > .form-control:focus {
|
||||
border: none;
|
||||
border-color: inherit;
|
||||
-webkit-box-shadow: none;
|
||||
@@ -101,7 +102,7 @@
|
||||
font-size: 17px;
|
||||
color: #767676;
|
||||
}
|
||||
.input-div >.form-control:-webkit-autofill {
|
||||
.input-div > .form-control:-webkit-autofill {
|
||||
-webkit-text-fill-color: #767676;
|
||||
box-shadow: 0 0 0px 1000px #ffffff inset;
|
||||
-webkit-box-shadow: 0 0 0px 1000px #ffffff inset;
|
||||
@@ -111,17 +112,16 @@
|
||||
.input-div:hover > .form-control::placeholder,
|
||||
.input-div:hover > .input-div-icon,
|
||||
.input-div:has(input.form-control:focus) > .input-div-icon {
|
||||
color: #D8291C;
|
||||
transition: .3s;
|
||||
color: #d8291c;
|
||||
transition: 0.3s;
|
||||
}
|
||||
.input-div:hover > .form-control::placeholder,
|
||||
.input-div:focus > .form-control::placeholder{
|
||||
.input-div:focus > .form-control::placeholder {
|
||||
font-weight: 500;
|
||||
transition: .3s;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
@media (min-width:767px) {
|
||||
|
||||
@media (min-width: 767px) {
|
||||
.authentication-container {
|
||||
min-width: 630px;
|
||||
}
|
||||
@@ -151,5 +151,4 @@
|
||||
border-right: 2px solid #80808076;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,60 +1,81 @@
|
||||
<app-popup [state]="state"
|
||||
<app-popup
|
||||
[state]="state"
|
||||
(stateChange)="onStateChange($event)"
|
||||
[ignoreClickOutside]="ignoreClickOutside">
|
||||
|
||||
|
||||
<div class="container m-0 overflow-hidden"
|
||||
[@resizeContainerForErrorMessage]="hideErrorMessage()">
|
||||
|
||||
<app-error-box [errorMessage]="errorMessage"
|
||||
[@showErrorMessage]="showErrorMessage()">
|
||||
[ignoreClickOutside]="ignoreClickOutside"
|
||||
>
|
||||
<div
|
||||
class="container m-0 overflow-hidden"
|
||||
[@resizeContainerForErrorMessage]="hideErrorMessage()"
|
||||
>
|
||||
<app-error-box
|
||||
[errorMessage]="errorMessage"
|
||||
[@showErrorMessage]="showErrorMessage()"
|
||||
>
|
||||
</app-error-box>
|
||||
|
||||
<div class="container authentication-container"
|
||||
[@hideAuthContainer]="hideErrorMessage()"
|
||||
(@hideAuthContainer.done)="hideAuthContainer($event)">
|
||||
<div
|
||||
class="container authentication-container"
|
||||
[@hideAuthContainer]="hideErrorMessage()"
|
||||
(@hideAuthContainer.done)="hideAuthContainer($event)"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 auth-body auth-body-form">
|
||||
<form [formGroup]="signupForm" (ngSubmit)="onSignUp()">
|
||||
<div class="input-div">
|
||||
<fa-icon class="input-div-icon"
|
||||
[icon]="_fullnameIcon">
|
||||
<fa-icon
|
||||
class="input-div-icon"
|
||||
[icon]="_fullnameIcon"
|
||||
>
|
||||
</fa-icon>
|
||||
<input type="text" id="fullname"
|
||||
<input
|
||||
type="text"
|
||||
id="fullname"
|
||||
formControlName="fullname"
|
||||
class="form-control"
|
||||
placeholder="Full Name">
|
||||
placeholder="Full Name"
|
||||
/>
|
||||
</div>
|
||||
<div class="input-div">
|
||||
<fa-icon class="input-div-icon"
|
||||
[icon]="_emailIcon">
|
||||
<fa-icon class="input-div-icon" [icon]="_emailIcon">
|
||||
</fa-icon>
|
||||
<input type="text" id="email"
|
||||
<input
|
||||
type="text"
|
||||
id="email"
|
||||
formControlName="email"
|
||||
class="form-control"
|
||||
placeholder="Email">
|
||||
placeholder="Email"
|
||||
/>
|
||||
</div>
|
||||
<div class="input-div">
|
||||
<fa-icon class="input-div-icon"
|
||||
[icon]="_userIcon">
|
||||
<fa-icon class="input-div-icon" [icon]="_userIcon">
|
||||
</fa-icon>
|
||||
<input type="text" id="username"
|
||||
<input
|
||||
type="text"
|
||||
id="username"
|
||||
formControlName="username"
|
||||
class="form-control"
|
||||
placeholder="Username">
|
||||
placeholder="Username"
|
||||
/>
|
||||
</div>
|
||||
<div class="input-div">
|
||||
<fa-icon class="input-div-icon"
|
||||
[icon]="_passwordIcon">
|
||||
<fa-icon
|
||||
class="input-div-icon"
|
||||
[icon]="_passwordIcon"
|
||||
>
|
||||
</fa-icon>
|
||||
<input type="password" id="password"
|
||||
<input
|
||||
type="password"
|
||||
id="password"
|
||||
formControlName="password"
|
||||
class="form-control"
|
||||
placeholder="Password">
|
||||
placeholder="Password"
|
||||
/>
|
||||
</div>
|
||||
<button class="btn"
|
||||
[disabled]="!signupForm.valid"
|
||||
type="submit">
|
||||
<button
|
||||
class="btn"
|
||||
[disabled]="!signupForm.valid"
|
||||
type="submit"
|
||||
>
|
||||
SignUp
|
||||
</button>
|
||||
</form>
|
||||
@@ -63,24 +84,30 @@
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<div class="col-lg-6 auth-body auth-body-links">
|
||||
<button mat-button
|
||||
class="oauth-button d-flex justify-content-center align-items-center"
|
||||
(click)="onGoogleLogin()">
|
||||
<mat-icon style="width: 50px; height:30px"
|
||||
svgIcon="google-logo"></mat-icon>
|
||||
<button
|
||||
mat-button
|
||||
class="oauth-button d-flex justify-content-center align-items-center"
|
||||
(click)="onGoogleLogin()"
|
||||
>
|
||||
<mat-icon
|
||||
style="width: 50px; height: 30px"
|
||||
svgIcon="google-logo"
|
||||
></mat-icon>
|
||||
Login With Google
|
||||
</button>
|
||||
<button mat-button
|
||||
class="oauth-button d-flex justify-content-center align-items-center"
|
||||
(click)="onGithubLogin()">
|
||||
<mat-icon style="width: 50px; height:30px"
|
||||
svgIcon="github-logo"></mat-icon>
|
||||
<button
|
||||
mat-button
|
||||
class="oauth-button d-flex justify-content-center align-items-center"
|
||||
(click)="onGithubLogin()"
|
||||
>
|
||||
<mat-icon
|
||||
style="width: 50px; height: 30px"
|
||||
svgIcon="github-logo"
|
||||
></mat-icon>
|
||||
Login With Github
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</app-popup>
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('SignupComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ SignupComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [SignupComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(SignupComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -2,21 +2,34 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { MatIconRegistry } from '@angular/material/icon';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { faEnvelope, faFingerprint, faLock, faUser } from '@fortawesome/free-solid-svg-icons';
|
||||
import {
|
||||
faEnvelope,
|
||||
faFingerprint,
|
||||
faLock,
|
||||
faUser,
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { AuthService } from 'src/app/shared/auth/auth.service';
|
||||
import { HttpError } from 'src/app/shared/model/httpError/httpError.model';
|
||||
import HttpErrorChecker from 'src/app/shared/model/httpError/httpErrorChecker';
|
||||
import UserChecker from 'src/app/shared/model/user/user.checker';
|
||||
import { User } from 'src/app/shared/model/user/user.model';
|
||||
import {animate, animateChild, group, query, state, style, transition, trigger} from "@angular/animations";
|
||||
import {ValidateEmailValidator} from "../../../shared/validators/validate-email.validator";
|
||||
import {ValidatePasswordValidator} from "../../../shared/validators/validate-password.validator";
|
||||
import {ValidateNotEmptyValidator} from "../../../shared/validators/validate-not-empty.validator";
|
||||
import {
|
||||
animate,
|
||||
animateChild,
|
||||
group,
|
||||
query,
|
||||
state,
|
||||
style,
|
||||
transition,
|
||||
trigger,
|
||||
} from '@angular/animations';
|
||||
import { ValidateEmailValidator } from '../../../shared/validators/validate-email.validator';
|
||||
import { ValidatePasswordValidator } from '../../../shared/validators/validate-password.validator';
|
||||
import { ValidateNotEmptyValidator } from '../../../shared/validators/validate-not-empty.validator';
|
||||
|
||||
|
||||
const GOOGLE_LOGO_SVG = "assets/img/providers/google.svg";
|
||||
const GITHUB_LOGO_SVG = "assets/img/providers/github.svg";
|
||||
const GOOGLE_LOGO_SVG = 'assets/img/providers/google.svg';
|
||||
const GITHUB_LOGO_SVG = 'assets/img/providers/github.svg';
|
||||
|
||||
@Component({
|
||||
selector: 'app-signup',
|
||||
@@ -24,78 +37,66 @@ const GITHUB_LOGO_SVG = "assets/img/providers/github.svg";
|
||||
styleUrls: ['./signup.component.css'],
|
||||
animations: [
|
||||
trigger('resizeContainerForErrorMessage', [
|
||||
state('hide',
|
||||
state(
|
||||
'hide',
|
||||
style({
|
||||
height: '100px',
|
||||
width: '320px',
|
||||
})
|
||||
}),
|
||||
),
|
||||
transition(
|
||||
'show => hide',
|
||||
group([
|
||||
query(
|
||||
"@*",
|
||||
animateChild(),
|
||||
{ optional: true }
|
||||
),
|
||||
animate('1s ease')
|
||||
])
|
||||
)
|
||||
query('@*', animateChild(), { optional: true }),
|
||||
animate('1s ease'),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
trigger('showErrorMessage', [
|
||||
state('show',
|
||||
state(
|
||||
'show',
|
||||
style({
|
||||
opacity: 1,
|
||||
height: '100px',
|
||||
width: '320px',
|
||||
})
|
||||
}),
|
||||
),
|
||||
state('hide',
|
||||
state(
|
||||
'hide',
|
||||
style({
|
||||
opacity: 0,
|
||||
height: '0px',
|
||||
width: '0px',
|
||||
})
|
||||
),
|
||||
transition(
|
||||
'* => show',
|
||||
animate(
|
||||
'500ms ease-in'
|
||||
)
|
||||
}),
|
||||
),
|
||||
transition('* => show', animate('500ms ease-in')),
|
||||
]),
|
||||
trigger('hideAuthContainer', [
|
||||
state('hide',
|
||||
state(
|
||||
'hide',
|
||||
style({
|
||||
opacity: 0,
|
||||
})
|
||||
}),
|
||||
),
|
||||
transition(
|
||||
'show => hide',
|
||||
group([
|
||||
query(
|
||||
"@*",
|
||||
animateChild(),
|
||||
{ optional: true }
|
||||
),
|
||||
animate(
|
||||
'250ms ease-out'
|
||||
)
|
||||
])
|
||||
)
|
||||
query('@*', animateChild(), { optional: true }),
|
||||
animate('250ms ease-out'),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
]
|
||||
],
|
||||
})
|
||||
export class SignupComponent implements OnInit {
|
||||
@Input()
|
||||
state: boolean = false;
|
||||
|
||||
@Input()
|
||||
state: boolean = false;
|
||||
|
||||
@Input()
|
||||
ignoreClickOutside!: HTMLDivElement[];
|
||||
ignoreClickOutside!: HTMLDivElement[];
|
||||
|
||||
@Output()
|
||||
stateChange = new EventEmitter<boolean>();
|
||||
stateChange = new EventEmitter<boolean>();
|
||||
|
||||
signupForm!: FormGroup;
|
||||
|
||||
@@ -113,34 +114,46 @@ export class SignupComponent implements OnInit {
|
||||
|
||||
_passwordIcon = faLock;
|
||||
|
||||
constructor(private authService: AuthService,
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private matIconRegistry: MatIconRegistry,
|
||||
private domSanitizer: DomSanitizer) {
|
||||
private domSanitizer: DomSanitizer,
|
||||
) {
|
||||
this.matIconRegistry.addSvgIcon(
|
||||
"google-logo",
|
||||
this.domSanitizer.bypassSecurityTrustResourceUrl(GOOGLE_LOGO_SVG)
|
||||
'google-logo',
|
||||
this.domSanitizer.bypassSecurityTrustResourceUrl(GOOGLE_LOGO_SVG),
|
||||
);
|
||||
this.matIconRegistry.addSvgIcon(
|
||||
"github-logo",
|
||||
this.domSanitizer.bypassSecurityTrustResourceUrl(GITHUB_LOGO_SVG)
|
||||
'github-logo',
|
||||
this.domSanitizer.bypassSecurityTrustResourceUrl(GITHUB_LOGO_SVG),
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.signupForm = new FormGroup({
|
||||
'fullname': new FormControl(null, [Validators.required, ValidateNotEmptyValidator]),
|
||||
fullname: new FormControl(null, [
|
||||
Validators.required,
|
||||
ValidateNotEmptyValidator,
|
||||
]),
|
||||
// Create a Email Validator
|
||||
'email': new FormControl(null, [Validators.required, ValidateEmailValidator]),
|
||||
'username': new FormControl(null, [Validators.required, ValidateNotEmptyValidator]),
|
||||
email: new FormControl(null, [
|
||||
Validators.required,
|
||||
ValidateEmailValidator,
|
||||
]),
|
||||
username: new FormControl(null, [
|
||||
Validators.required,
|
||||
ValidateNotEmptyValidator,
|
||||
]),
|
||||
// Create a Password Validator
|
||||
'password': new FormControl(null, [Validators.required, ValidatePasswordValidator])
|
||||
password: new FormControl(null, [
|
||||
Validators.required,
|
||||
ValidatePasswordValidator,
|
||||
]),
|
||||
});
|
||||
this.errorMessage = null;
|
||||
this.authSubject = this.authService.authSubject.subscribe(
|
||||
res => {
|
||||
this.validateSignup(res);
|
||||
}
|
||||
);
|
||||
this.authSubject = this.authService.authSubject.subscribe((res) => {
|
||||
this.validateSignup(res);
|
||||
});
|
||||
}
|
||||
|
||||
onStateChange(state: boolean) {
|
||||
@@ -152,8 +165,8 @@ export class SignupComponent implements OnInit {
|
||||
name: this.signupForm.controls['fullname'].value,
|
||||
email: this.signupForm.controls['email'].value,
|
||||
username: this.signupForm.controls['username'].value,
|
||||
password: this.signupForm.controls['password'].value
|
||||
}
|
||||
password: this.signupForm.controls['password'].value,
|
||||
};
|
||||
this.authService.signup(user);
|
||||
}
|
||||
|
||||
@@ -167,11 +180,11 @@ export class SignupComponent implements OnInit {
|
||||
|
||||
private validateSignup(res: User | HttpError | null) {
|
||||
if (res && UserChecker.test(res)) {
|
||||
this.closePopup()
|
||||
} if (HttpErrorChecker.test(res)) {
|
||||
this.closePopup();
|
||||
}
|
||||
if (HttpErrorChecker.test(res)) {
|
||||
this.errorMessage = (<HttpError>res).details;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private closePopup() {
|
||||
@@ -181,24 +194,22 @@ export class SignupComponent implements OnInit {
|
||||
|
||||
public showErrorMessage(): string {
|
||||
if (this.isShowErrorMessage) {
|
||||
return "show";
|
||||
return 'show';
|
||||
}
|
||||
return "hide";
|
||||
return 'hide';
|
||||
}
|
||||
|
||||
public hideErrorMessage(): string {
|
||||
if (!!this.errorMessage) {
|
||||
return "hide";
|
||||
return 'hide';
|
||||
}
|
||||
return "show";
|
||||
return 'show';
|
||||
}
|
||||
|
||||
hideAuthContainer(event: any) {
|
||||
if (event.toState === "hide") {
|
||||
event.element.style.display = "none";
|
||||
if (event.toState === 'hide') {
|
||||
event.element.style.display = 'none';
|
||||
this.isShowErrorMessage = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user