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