🗑️ Clear project

This commit is contained in:
Lucàs
2023-06-13 18:08:55 +02:00
parent 73e7dc5d26
commit e9cfbacd2c
42 changed files with 1 additions and 21799 deletions
View File
-9
View File
@@ -1,9 +0,0 @@
<div class="w-screen h-screen justify-between flex flex-col">
<app-navbar></app-navbar>
<div class="container mx-auto">
<app-todolist class="mx-2"></app-todolist>
</div>
<app-footer></app-footer>
</div>
-31
View File
@@ -1,31 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'todo-list'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('todo-list');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('todo-list app is running!');
});
});
-8
View File
@@ -1,8 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {}
-24
View File
@@ -1,24 +0,0 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {FormsModule} from '@angular/forms';
import { NavbarComponent } from './navbar/navbar.component';
import { FooterComponent } from './footer/footer.component';
import { TodolistComponent } from './todolist/todolist.component';
@NgModule({
declarations: [
AppComponent,
NavbarComponent,
FooterComponent,
TodolistComponent
],
imports: [
BrowserModule,
FormsModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
View File
-9
View File
@@ -1,9 +0,0 @@
<footer class="footer footer-center p-4 bg-base-300 text-base-content">
<div>
<p>MIT Licence © 2022 -
<a href="https://github.com/LucasVbr/todo-list" class="link link-hover"
target="_blank">See code on GitHub
</a>
</p>
</div>
</footer>
-23
View File
@@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FooterComponent } from './footer.component';
describe('FooterComponent', () => {
let component: FooterComponent;
let fixture: ComponentFixture<FooterComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ FooterComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(FooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
-15
View File
@@ -1,15 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.css']
})
export class FooterComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
View File
-3
View File
@@ -1,3 +0,0 @@
<div class="navbar bg-base-100">
<a class="btn btn-ghost normal-case text-xl">Todo List App</a>
</div>
-23
View File
@@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NavbarComponent } from './navbar.component';
describe('NavbarComponent', () => {
let component: NavbarComponent;
let fixture: ComponentFixture<NavbarComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ NavbarComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(NavbarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
-15
View File
@@ -1,15 +0,0 @@
import {Component, OnInit} from '@angular/core';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.css']
})
export class NavbarComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
-49
View File
@@ -1,49 +0,0 @@
<div class="card m-auto w-96 bg-base-100 shadow-xl">
<div class="card-body">
<!-- Input -->
<div class="form-control">
<div class="input-group justify-center">
<input type="text" placeholder="Type here your task..."
class="input input-bordered w-full"
[(ngModel)]="todoInput" (keydown.enter)="addItem()"/>
<button class="btn btn-square" (click)="addItem()">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none"
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M12 4v16m8-8H4"/>
</svg>
</button>
</div>
</div>
<!-- List -->
<div class="form-control" *ngFor="let todoItem of todoList">
<label class="label cursor-pointer" for="task-{{ todoItem.id }}">
<input type="checkbox" checked="checked"
class="checkbox checkbox-primary"
id="task-{{ todoItem.id }}" name="task-{{ todoItem.id }}"
[(ngModel)]="todoItem.completed" (change)="saveList()"/>
<span class="label-text text-base break-all mx-2">{{ todoItem.task }}</span>
<button class="btn btn-error btn-square btn-outline"
(click)="removeItem(todoItem.id)">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round"
stroke-width="2"
d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</label>
</div>
<div class="card-actions justify-between">
You have {{ todoList.length }} pending task(s)
<button class="btn btn-error" (click)="clearList()">Clear All</button>
</div>
</div>
</div>
@@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TodolistComponent } from './todolist.component';
describe('TodolistComponent', () => {
let component: TodolistComponent;
let fixture: ComponentFixture<TodolistComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TodolistComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(TodolistComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
-58
View File
@@ -1,58 +0,0 @@
import { Component, OnInit } from '@angular/core';
import TodoItem from '../../models/TodoItem';
const LOCAL_STORAGE_KEY: string = "todoList";
@Component({
selector: 'app-todolist',
templateUrl: './todolist.component.html',
styleUrls: ['./todolist.component.css']
})
export class TodolistComponent implements OnInit {
public todoInput!: string;
public todoList!: TodoItem[];
ngOnInit() {
this.todoInput = "";
this.todoList = this.getSavedList();
}
public addItem(): void {
if (!this.todoInput) return;
const newItem: TodoItem = new TodoItem(this.getNextIndex(), this.todoInput);
this.todoList.push(newItem);
this.todoInput = "";
this.saveList();
}
public removeItem(index: number): void {
this.todoList = this.todoList.filter(item => {
return item.id !== index;
});
this.saveList();
}
public clearList(): void {
this.todoList = [];
this.saveList();
}
public saveList() {
console.info("Save todoList");
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(this.todoList))
}
private getSavedList(): TodoItem[] {
console.info("Load TodoList");
const loadedValues: string|null = localStorage.getItem(LOCAL_STORAGE_KEY);
if (loadedValues) return JSON.parse(loadedValues) as TodoItem[];
return [];
}
private getNextIndex() {
if (this.todoList.length === 0) return 1;
return Math.max(...this.todoList.map(item => item.id)) + 1
}
}
View File
-3
View File
@@ -1,3 +0,0 @@
export const environment = {
production: true
};
-16
View File
@@ -1,16 +0,0 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

-13
View File
@@ -1,13 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>TodoList</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
-12
View File
@@ -1,12 +0,0 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
-7
View File
@@ -1,7 +0,0 @@
export default class TodoItem {
public completed: boolean;
constructor(public id: number, public task: string) {
this.completed = false;
}
}
-53
View File
@@ -1,53 +0,0 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes recent versions of Safari, Chrome (including
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
-3
View File
@@ -1,3 +0,0 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
-26
View File
@@ -1,26 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
<T>(id: string): T;
keys(): string[];
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().forEach(context);