diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index cdc1771..428c0e4 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -1,9 +1,17 @@ import { Routes } from '@angular/router'; import { HomeComponent } from './component/home/home.component'; -import { AboutComponent } from './component/about/about.component'; export const routes: Routes = [ { path: '', component: HomeComponent }, { path: 'home', component: HomeComponent }, - { path: 'about', component: AboutComponent } + + { + path: 'tasks', + loadChildren: () => import('./module/task/task.component').then(m => m.TASKS_ROUTES) + }, + + { + path: 'about', + loadChildren: () => import('./module/about/about.component').then(m => m.ABOUT_ROUTES) + } ]; diff --git a/src/app/component/header/header.component.html b/src/app/component/header/header.component.html index 13a359d..6e6e073 100644 --- a/src/app/component/header/header.component.html +++ b/src/app/component/header/header.component.html @@ -2,6 +2,7 @@ diff --git a/src/app/component/home/home.component.html b/src/app/component/home/home.component.html index f5ae9c5..07d2b70 100644 --- a/src/app/component/home/home.component.html +++ b/src/app/component/home/home.component.html @@ -1,19 +1 @@ -
Loading tasks...
-} - -Elapsed time: {{ elapsedClock }}
- - - \ No newline at end of file +Home works!
diff --git a/src/app/component/home/home.component.ts b/src/app/component/home/home.component.ts index 84c2a96..891e67d 100644 --- a/src/app/component/home/home.component.ts +++ b/src/app/component/home/home.component.ts @@ -1,45 +1,13 @@ - -import { Component, inject } from '@angular/core'; -import { CommonModule, AsyncPipe } from '@angular/common'; -import { TaskService } from '../../service/task.service'; +import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; @Component({ selector: 'app-home', - imports: [CommonModule, AsyncPipe], + standalone: true, + imports: [CommonModule], templateUrl: './home.component.html', styleUrl: './home.component.css' }) export class HomeComponent { - protected count = 0; - private intervalId: any; - public elapsedClock: string = ''; - - private taskService = inject(TaskService); - tasks$ = this.taskService.tasks$; - - ngOnInit() { - this.updateElapsedClock(); - this.intervalId = setInterval(() => { - this.count++; - this.updateElapsedClock(); - }, 500); - } - - ngOnDestroy() { - if (this.intervalId) { - clearInterval(this.intervalId); - } - } - - private updateElapsedClock() { - const totalSeconds = Math.floor(this.count / 2); - const h = String(Math.floor(totalSeconds / 3600)).padStart(2, '0'); - const m = String(Math.floor((totalSeconds % 3600) / 60)).padStart(2, '0'); - const s = String(totalSeconds % 60).padStart(2, '0'); - this.elapsedClock = `${h}:${m}:${s}`; - } - - addTask(title: string) { - this.taskService.addTask(title); - } + } \ No newline at end of file diff --git a/src/app/component/tasks-page/tasks-page.component.css b/src/app/component/tasks-page/tasks-page.component.css new file mode 100644 index 0000000..ee8b85f --- /dev/null +++ b/src/app/component/tasks-page/tasks-page.component.css @@ -0,0 +1,18 @@ +.trash-btn { + background: none; + border: none; + cursor: pointer; + color: #c00; + font-size: 1.1em; + padding: 0.1em 0.3em; + border-radius: 4px; + transition: background 0.2s, color 0.2s; +} +.trash-btn:hover { + background: #ffeaea; + color: #fff; +} +.trash-btn:hover svg { + color: #fff; + fill: #fff; +} diff --git a/src/app/component/tasks-page/tasks-page.component.html b/src/app/component/tasks-page/tasks-page.component.html new file mode 100644 index 0000000..d9690c3 --- /dev/null +++ b/src/app/component/tasks-page/tasks-page.component.html @@ -0,0 +1,25 @@ +Loading tasks...
+} + +Elapsed time: {{ elapsedClock }}
+ + + \ No newline at end of file diff --git a/src/app/component/tasks-page/tasks-page.component.spec.ts b/src/app/component/tasks-page/tasks-page.component.spec.ts new file mode 100644 index 0000000..13b4888 --- /dev/null +++ b/src/app/component/tasks-page/tasks-page.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TasksPageComponent } from './tasks-page.component'; + +describe('TasksPageComponent', () => { + let component: TasksPageComponent; + let fixture: ComponentFixtureabout works!
diff --git a/src/app/module/about/about.component.spec.ts b/src/app/module/about/about.component.spec.ts new file mode 100644 index 0000000..74d6d9e --- /dev/null +++ b/src/app/module/about/about.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AboutComponent } from './about.component'; + +describe('AboutComponent', () => { + let component: AboutComponent; + let fixture: ComponentFixturetask works!
diff --git a/src/app/module/task/task.component.spec.ts b/src/app/module/task/task.component.spec.ts new file mode 100644 index 0000000..13dacb1 --- /dev/null +++ b/src/app/module/task/task.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TaskComponent } from './task.component'; + +describe('TaskComponent', () => { + let component: TaskComponent; + let fixture: ComponentFixture