From f91561db261a1534879215c0d5e25d1714632905 Mon Sep 17 00:00:00 2001 From: Maxime Delporte Date: Mon, 21 Apr 2025 21:44:20 -0300 Subject: [PATCH] Updating naming functions and variables. Adding onCancel call when click on the background. --- src/app/tasks/new-task/new-task.component.html | 4 ++-- src/app/tasks/new-task/new-task.component.ts | 9 ++++----- src/app/tasks/tasks.component.html | 2 +- src/app/tasks/tasks.component.ts | 10 +++++----- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/app/tasks/new-task/new-task.component.html b/src/app/tasks/new-task/new-task.component.html index 8d5e25c..57dc8af 100644 --- a/src/app/tasks/new-task/new-task.component.html +++ b/src/app/tasks/new-task/new-task.component.html @@ -1,4 +1,4 @@ -
+

Add Task

@@ -18,7 +18,7 @@

- +

diff --git a/src/app/tasks/new-task/new-task.component.ts b/src/app/tasks/new-task/new-task.component.ts index 1f80875..326a5d5 100644 --- a/src/app/tasks/new-task/new-task.component.ts +++ b/src/app/tasks/new-task/new-task.component.ts @@ -1,5 +1,4 @@ -import {Component, EventEmitter, Input, Output} from '@angular/core'; -import {Task} from '../../task/task.model'; +import {Component, EventEmitter, Output} from '@angular/core'; @Component({ selector: 'app-new-task', @@ -8,9 +7,9 @@ import {Task} from '../../task/task.model'; styleUrl: './new-task.component.css' }) export class NewTaskComponent { - @Output() close = new EventEmitter(); + @Output() cancel = new EventEmitter(); - onCloseTask() { - this.close.emit(); + onCancel() { + this.cancel.emit(); } } diff --git a/src/app/tasks/tasks.component.html b/src/app/tasks/tasks.component.html index 23b2525..8f67f7e 100644 --- a/src/app/tasks/tasks.component.html +++ b/src/app/tasks/tasks.component.html @@ -1,5 +1,5 @@ @if (isAddingTask) { - + }
diff --git a/src/app/tasks/tasks.component.ts b/src/app/tasks/tasks.component.ts index 44afdc6..7c7c3f6 100644 --- a/src/app/tasks/tasks.component.ts +++ b/src/app/tasks/tasks.component.ts @@ -43,15 +43,15 @@ export class TasksComponent { return this.tasks.filter((task) => task.userId === this.user.id); } + onCompleteTask(taskId: string) { + this.tasks = this.tasks.filter((task) => task.id !== taskId); + } + onStartAddTask() { this.isAddingTask = true; } - onStopAddTask() { + onCancelAddTask() { this.isAddingTask = false; } - - onCompleteTask(taskId: string) { - this.tasks = this.tasks.filter((task) => task.id !== taskId); - } }