clean code
This commit is contained in:
parent
cdf053982c
commit
7e2b04771f
10 changed files with 26 additions and 30 deletions
|
|
@ -173,7 +173,7 @@
|
||||||
'background-color':
|
'background-color':
|
||||||
taskData.priority == 'urgent' ? 'red' : 'white'
|
taskData.priority == 'urgent' ? 'red' : 'white'
|
||||||
}"
|
}"
|
||||||
(click)="tooglePriority('urgent')"
|
(click)="togglePriority('urgent')"
|
||||||
>
|
>
|
||||||
<div class="btn-text">
|
<div class="btn-text">
|
||||||
<span>{{ "addTask.urgent" | translate }}</span>
|
<span>{{ "addTask.urgent" | translate }}</span>
|
||||||
|
|
@ -190,7 +190,7 @@
|
||||||
'background-color':
|
'background-color':
|
||||||
taskData.priority == 'medium' ? 'orange' : 'white'
|
taskData.priority == 'medium' ? 'orange' : 'white'
|
||||||
}"
|
}"
|
||||||
(click)="tooglePriority('medium')"
|
(click)="togglePriority('medium')"
|
||||||
>
|
>
|
||||||
<div class="btn-text">
|
<div class="btn-text">
|
||||||
<span>{{ "addTask.medium" | translate }}</span>
|
<span>{{ "addTask.medium" | translate }}</span>
|
||||||
|
|
@ -207,7 +207,7 @@
|
||||||
'background-color':
|
'background-color':
|
||||||
taskData.priority == 'low' ? 'green' : 'white'
|
taskData.priority == 'low' ? 'green' : 'white'
|
||||||
}"
|
}"
|
||||||
(click)="tooglePriority('low')"
|
(click)="togglePriority('low')"
|
||||||
>
|
>
|
||||||
<div class="btn-text">
|
<div class="btn-text">
|
||||||
<span>{{ "addTask.low" | translate }}</span>
|
<span>{{ "addTask.low" | translate }}</span>
|
||||||
|
|
|
||||||
|
|
@ -176,9 +176,9 @@ export class AddTaskComponent implements OnInit {
|
||||||
: (this.dateInPast = false);
|
: (this.dateInPast = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
tooglePriority(prio: string) {
|
togglePriority(priority: string) {
|
||||||
this.taskData.priority !== prio
|
this.taskData.priority !== priority
|
||||||
? (this.taskData.priority = prio)
|
? (this.taskData.priority = priority)
|
||||||
: this.taskData.priority;
|
: this.taskData.priority;
|
||||||
this.saveTaskData();
|
this.saveTaskData();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import { FirebaseService } from '../../../services/firebase.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { User } from '../../../interfaces/user.interface';
|
import { User } from '../../../interfaces/user.interface';
|
||||||
import { AddTaskComponent } from '../add-task.component';
|
import { AddTaskComponent } from '../add-task.component';
|
||||||
import { SharedService } from '../../../services/shared.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-assigned',
|
selector: 'app-assigned',
|
||||||
|
|
@ -20,11 +19,8 @@ export class AssignedComponent {
|
||||||
|
|
||||||
assigned: string[] = [];
|
assigned: string[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(public firebaseService: FirebaseService) {
|
||||||
public firebaseService: FirebaseService,
|
this.loadTaskAssignedData();
|
||||||
private sharedService: SharedService
|
|
||||||
) {
|
|
||||||
this.loadTaskAssigedData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAssigned() {
|
updateAssigned() {
|
||||||
|
|
@ -50,7 +46,7 @@ export class AssignedComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadTaskAssigedData() {
|
loadTaskAssignedData() {
|
||||||
const taskDataString = localStorage.getItem('taskData');
|
const taskDataString = localStorage.getItem('taskData');
|
||||||
if (taskDataString !== null) {
|
if (taskDataString !== null) {
|
||||||
const taskData = JSON.parse(taskDataString);
|
const taskData = JSON.parse(taskDataString);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ firebaseService.getUserDataFromId(currentUserId); track user) {
|
||||||
</div>
|
</div>
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<app-contact-form
|
<app-contact-form
|
||||||
(inititalsEmitter)="inititalsEmitter($event)"
|
(initialsEmitter)="initialsEmitter($event)"
|
||||||
[currentUserId]="currentUserId"
|
[currentUserId]="currentUserId"
|
||||||
[newColor]="newColor"
|
[newColor]="newColor"
|
||||||
[currentColor]="user.color"
|
[currentColor]="user.color"
|
||||||
|
|
@ -56,7 +56,7 @@ firebaseService.getUserDataFromId(currentUserId); track user) {
|
||||||
</div>
|
</div>
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<app-contact-form
|
<app-contact-form
|
||||||
(inititalsEmitter)="inititalsEmitter($event)"
|
(initialsEmitter)="initialsEmitter($event)"
|
||||||
[randomColor]="randomColor"
|
[randomColor]="randomColor"
|
||||||
[newColor]="newColor"
|
[newColor]="newColor"
|
||||||
></app-contact-form>
|
></app-contact-form>
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export class ContactEditNewComponent implements OnInit {
|
||||||
public sharedService: SharedService
|
public sharedService: SharedService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
inititalsEmitter(emitter: string) {
|
initialsEmitter(emitter: string) {
|
||||||
this.userInitials = emitter;
|
this.userInitials = emitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
} @else { @if (email.touched &&
|
} @else { @if (email.touched &&
|
||||||
!checkIfUserEmailIsValid(contactData.email)) {
|
!checkIfUserEmailIsValid(contactData.email)) {
|
||||||
<p>{{ "contactDialogForm.invalidMail1" | translate }}</p>
|
<p>{{ "contactDialogForm.invalidMail1" | translate }}</p>
|
||||||
} @else { @if (existEmailonServer(contactData.email).length > 0 &&
|
} @else { @if (existEmailOnServer(contactData.email).length > 0 &&
|
||||||
!contactData.email) {
|
!contactData.email) {
|
||||||
<p>{{ "contactDialogForm.invalidMail2" | translate }}</p>
|
<p>{{ "contactDialogForm.invalidMail2" | translate }}</p>
|
||||||
} } }
|
} } }
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export class ContactFormComponent implements OnInit, OnChanges {
|
||||||
@Input() randomColor: string = '';
|
@Input() randomColor: string = '';
|
||||||
@Input() newColor: string = '';
|
@Input() newColor: string = '';
|
||||||
@Input() currentColor: string = '';
|
@Input() currentColor: string = '';
|
||||||
@Output() inititalsEmitter = new EventEmitter<string>();
|
@Output() initialsEmitter = new EventEmitter<string>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
|
@ -95,7 +95,7 @@ export class ContactFormComponent implements OnInit, OnChanges {
|
||||||
initials: initials,
|
initials: initials,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.inititalsEmitter.emit(initials);
|
this.initialsEmitter.emit(initials);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUserData() {
|
updateUserData() {
|
||||||
|
|
@ -129,7 +129,7 @@ export class ContactFormComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
existEmailonServer(mail: string) {
|
existEmailOnServer(mail: string) {
|
||||||
return this.firebaseService
|
return this.firebaseService
|
||||||
.getAllUsers()
|
.getAllUsers()
|
||||||
.filter((user) => user.email === mail);
|
.filter((user) => user.email === mail);
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,11 @@ export class ContactsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
sortFirstLetter() {
|
sortFirstLetter() {
|
||||||
let filteretArray = this.loadAllUserWithoutGuest().sort((a, b) =>
|
let filterteArray = this.loadAllUserWithoutGuest().sort((a, b) =>
|
||||||
a.firstName.localeCompare(b.firstName)
|
a.firstName.localeCompare(b.firstName)
|
||||||
);
|
);
|
||||||
let usersFirstLetter = Array.from(
|
let usersFirstLetter = Array.from(
|
||||||
new Set(filteretArray.map((user) => user.firstName[0].toUpperCase()))
|
new Set(filterteArray.map((user) => user.firstName[0].toUpperCase()))
|
||||||
);
|
);
|
||||||
return usersFirstLetter;
|
return usersFirstLetter;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
<div class="error-msg">
|
<div class="error-msg">
|
||||||
@if (!mail.valid && mail.touched && !sharedService.isBtnDisabled) {
|
@if (!mail.valid && mail.touched && !sharedService.isBtnDisabled) {
|
||||||
<p>{{ "login.errorMail0" | translate }}</p>
|
<p>{{ "login.errorMail0" | translate }}</p>
|
||||||
} @if (loginSerivce.errorCode == 'auth/invalid-email' &&
|
} @if (loginService.errorCode == 'auth/invalid-email' &&
|
||||||
!sharedService.isBtnDisabled) {
|
!sharedService.isBtnDisabled) {
|
||||||
<p>{{ "login.errorMail1" | translate }}</p>
|
<p>{{ "login.errorMail1" | translate }}</p>
|
||||||
} @if (mail.valid && mail.touched &&
|
} @if (mail.valid && mail.touched &&
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
id="password"
|
id="password"
|
||||||
name="password"
|
name="password"
|
||||||
#password="ngModel"
|
#password="ngModel"
|
||||||
[type]="loginSerivce.passwordFieldType"
|
[type]="loginService.passwordFieldType"
|
||||||
placeholder="{{ 'login.password' | translate }}"
|
placeholder="{{ 'login.password' | translate }}"
|
||||||
class="custom-input"
|
class="custom-input"
|
||||||
autocomplete="current-password"
|
autocomplete="current-password"
|
||||||
|
|
@ -67,15 +67,15 @@
|
||||||
<img
|
<img
|
||||||
class="passwordEye"
|
class="passwordEye"
|
||||||
*ngIf="isPasswordIconVisible"
|
*ngIf="isPasswordIconVisible"
|
||||||
(click)="loginSerivce.togglePasswordVisibility()"
|
(click)="loginService.togglePasswordVisibility()"
|
||||||
[src]="loginSerivce.passwordIcon"
|
[src]="loginService.passwordIcon"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
<div class="error-msg">
|
<div class="error-msg">
|
||||||
@if (!password.valid && password.touched &&
|
@if (!password.valid && password.touched &&
|
||||||
!sharedService.isBtnDisabled) {
|
!sharedService.isBtnDisabled) {
|
||||||
<p>{{ "login.errorPassword0" | translate }}</p>
|
<p>{{ "login.errorPassword0" | translate }}</p>
|
||||||
} @if (loginSerivce.errorCode == 'auth/invalid-credential' &&
|
} @if (loginService.errorCode == 'auth/invalid-credential' &&
|
||||||
!sharedService.isBtnDisabled) {
|
!sharedService.isBtnDisabled) {
|
||||||
<p>{{ "login.errorPassword1" | translate }}</p>
|
<p>{{ "login.errorPassword1" | translate }}</p>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export class LoginComponent {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private firebaseService: FirebaseService,
|
private firebaseService: FirebaseService,
|
||||||
public loginSerivce: LoginService,
|
public loginService: LoginService,
|
||||||
public sharedService: SharedService,
|
public sharedService: SharedService,
|
||||||
private overlayService: OverlayService,
|
private overlayService: OverlayService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
|
@ -63,7 +63,7 @@ export class LoginComponent {
|
||||||
onSubmit(ngForm: NgForm) {
|
onSubmit(ngForm: NgForm) {
|
||||||
this.sharedService.isBtnDisabled = true;
|
this.sharedService.isBtnDisabled = true;
|
||||||
if (ngForm.submitted && ngForm.form.valid) {
|
if (ngForm.submitted && ngForm.form.valid) {
|
||||||
this.loginSerivce.login(this.loginData);
|
this.loginService.login(this.loginData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,7 +77,7 @@ export class LoginComponent {
|
||||||
|
|
||||||
googleLogin() {
|
googleLogin() {
|
||||||
this.sharedService.isBtnDisabled = true;
|
this.sharedService.isBtnDisabled = true;
|
||||||
this.loginSerivce.googleLogin();
|
this.loginService.googleLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIfUserEmailIsValid(emailValue: string) {
|
checkIfUserEmailIsValid(emailValue: string) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue